Get rid of global Gerrit.Nav

* Replace the global Gerrit.Nav variable with named imports.
* Update gr-app-global-var-init.js

Note: This is not a recommended approach. The change focuses on
removing global variable. See todo in gr-navigation.js

Change-Id: If389574d6d3bc1d643538f6776740bca82f71049
diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.js b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.js
index c8724c3..2b87548 100644
--- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.js
+++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.js
@@ -14,735 +14,729 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-(function(window) {
-  'use strict';
 
-  // Navigation parameters object format:
-  //
-  // Each object has a `view` property with a value from Gerrit.Nav.View. The
-  // remaining properties depend on the value used for view.
-  //
-  //  - Gerrit.Nav.View.CHANGE:
-  //    - `changeNum`, required, String: the numeric ID of the change.
-  //    - `project`, optional, String: the project name.
-  //    - `patchNum`, optional, Number: the patch for the right-hand-side of
-  //        the diff.
-  //    - `basePatchNum`, optional, Number: the patch for the left-hand-side
-  //        of the diff. If `basePatchNum` is provided, then `patchNum` must
-  //        also be provided.
-  //    - `edit`, optional, Boolean: whether or not to load the file list with
-  //        edit controls.
-  //    - `messageHash`, optional, String: the hash of the change message to
-  //        scroll to.
-  //
-  // - Gerrit.Nav.View.SEARCH:
-  //    - `query`, optional, String: the literal search query. If provided,
-  //        the string will be used as the query, and all other params will be
-  //        ignored.
-  //    - `owner`, optional, String: the owner name.
-  //    - `project`, optional, String: the project name.
-  //    - `branch`, optional, String: the branch name.
-  //    - `topic`, optional, String: the topic name.
-  //    - `hashtag`, optional, String: the hashtag name.
-  //    - `statuses`, optional, Array<String>: the list of change statuses to
-  //        search for. If more than one is provided, the search will OR them
-  //        together.
-  //    - `offset`, optional, Number: the offset for the query.
-  //
-  //  - Gerrit.Nav.View.DIFF:
-  //    - `changeNum`, required, String: the numeric ID of the change.
-  //    - `path`, required, String: the filepath of the diff.
-  //    - `patchNum`, required, Number: the patch for the right-hand-side of
-  //        the diff.
-  //    - `basePatchNum`, optional, Number: the patch for the left-hand-side
-  //        of the diff. If `basePatchNum` is provided, then `patchNum` must
-  //        also be provided.
-  //    - `lineNum`, optional, Number: the line number to be selected on load.
-  //    - `leftSide`, optional, Boolean: if a `lineNum` is provided, a value
-  //        of true selects the line from base of the patch range. False by
-  //        default.
-  //
-  //  - Gerrit.Nav.View.GROUP:
-  //    - `groupId`, required, String: the ID of the group.
-  //    - `detail`, optional, String: the name of the group detail view.
-  //      Takes any value from Gerrit.Nav.GroupDetailView.
-  //
-  //  - Gerrit.Nav.View.REPO:
-  //    - `repoName`, required, String: the name of the repo
-  //    - `detail`, optional, String: the name of the repo detail view.
-  //      Takes any value from Gerrit.Nav.RepoDetailView.
-  //
-  //  - Gerrit.Nav.View.DASHBOARD
-  //    - `repo`, optional, String.
-  //    - `sections`, optional, Array of objects with `title` and `query`
-  //      strings.
-  //    - `user`, optional, String.
-  //
-  //  - Gerrit.Nav.View.ROOT:
-  //    - no possible parameters.
+// Navigation parameters object format:
+//
+// Each object has a `view` property with a value from GerritNav.View. The
+// remaining properties depend on the value used for view.
+//
+//  - GerritNav.View.CHANGE:
+//    - `changeNum`, required, String: the numeric ID of the change.
+//    - `project`, optional, String: the project name.
+//    - `patchNum`, optional, Number: the patch for the right-hand-side of
+//        the diff.
+//    - `basePatchNum`, optional, Number: the patch for the left-hand-side
+//        of the diff. If `basePatchNum` is provided, then `patchNum` must
+//        also be provided.
+//    - `edit`, optional, Boolean: whether or not to load the file list with
+//        edit controls.
+//    - `messageHash`, optional, String: the hash of the change message to
+//        scroll to.
+//
+// - GerritNav.View.SEARCH:
+//    - `query`, optional, String: the literal search query. If provided,
+//        the string will be used as the query, and all other params will be
+//        ignored.
+//    - `owner`, optional, String: the owner name.
+//    - `project`, optional, String: the project name.
+//    - `branch`, optional, String: the branch name.
+//    - `topic`, optional, String: the topic name.
+//    - `hashtag`, optional, String: the hashtag name.
+//    - `statuses`, optional, Array<String>: the list of change statuses to
+//        search for. If more than one is provided, the search will OR them
+//        together.
+//    - `offset`, optional, Number: the offset for the query.
+//
+//  - GerritNav.View.DIFF:
+//    - `changeNum`, required, String: the numeric ID of the change.
+//    - `path`, required, String: the filepath of the diff.
+//    - `patchNum`, required, Number: the patch for the right-hand-side of
+//        the diff.
+//    - `basePatchNum`, optional, Number: the patch for the left-hand-side
+//        of the diff. If `basePatchNum` is provided, then `patchNum` must
+//        also be provided.
+//    - `lineNum`, optional, Number: the line number to be selected on load.
+//    - `leftSide`, optional, Boolean: if a `lineNum` is provided, a value
+//        of true selects the line from base of the patch range. False by
+//        default.
+//
+//  - GerritNav.View.GROUP:
+//    - `groupId`, required, String: the ID of the group.
+//    - `detail`, optional, String: the name of the group detail view.
+//      Takes any value from GerritNav.GroupDetailView.
+//
+//  - GerritNav.View.REPO:
+//    - `repoName`, required, String: the name of the repo
+//    - `detail`, optional, String: the name of the repo detail view.
+//      Takes any value from GerritNav.RepoDetailView.
+//
+//  - GerritNav.View.DASHBOARD
+//    - `repo`, optional, String.
+//    - `sections`, optional, Array of objects with `title` and `query`
+//      strings.
+//    - `user`, optional, String.
+//
+//  - GerritNav.View.ROOT:
+//    - no possible parameters.
 
-  window.Gerrit = window.Gerrit || {};
+const uninitialized = () => {
+  console.warn('Use of uninitialized routing');
+};
 
-  // Prevent redefinition.
-  if (window.Gerrit.hasOwnProperty('Nav')) { return; }
+const EDIT_PATCHNUM = 'edit';
+const PARENT_PATCHNUM = 'PARENT';
 
-  const uninitialized = () => {
-    console.warn('Use of uninitialized routing');
-  };
+const USER_PLACEHOLDER_PATTERN = /\$\{user\}/g;
 
-  const EDIT_PATCHNUM = 'edit';
-  const PARENT_PATCHNUM = 'PARENT';
+// NOTE: These queries are tested in Java. Any changes made to definitions
+// here require corresponding changes to:
+// javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
+const DEFAULT_SECTIONS = [
+  {
+    // Changes with unpublished draft comments. This section is omitted when
+    // viewing other users, so we don't need to filter anything out.
+    name: 'Has draft comments',
+    query: 'has:draft',
+    selfOnly: true,
+    hideIfEmpty: true,
+    suffixForDashboard: 'limit:10',
+  },
+  {
+    // Changes that are assigned to the viewed user.
+    name: 'Assigned reviews',
+    query: 'assignee:${user} (-is:wip OR owner:self OR assignee:self) ' +
+        'is:open -is:ignored',
+    hideIfEmpty: true,
+    suffixForDashboard: 'limit:25',
+  },
+  {
+    // WIP open changes owned by viewing user. This section is omitted when
+    // viewing other users, so we don't need to filter anything out.
+    name: 'Work in progress',
+    query: 'is:open owner:${user} is:wip',
+    selfOnly: true,
+    hideIfEmpty: true,
+    suffixForDashboard: 'limit:25',
+  },
+  {
+    // Non-WIP open changes owned by viewed user. Filter out changes ignored
+    // by the viewing user.
+    name: 'Outgoing reviews',
+    query: 'is:open owner:${user} -is:wip -is:ignored',
+    isOutgoing: true,
+    suffixForDashboard: 'limit:25',
+  },
+  {
+    // Non-WIP open changes not owned by the viewed user, that the viewed user
+    // is associated with (as either a reviewer or the assignee). Changes
+    // ignored by the viewing user are filtered out.
+    name: 'Incoming reviews',
+    query: 'is:open -owner:${user} -is:wip -is:ignored ' +
+        '(reviewer:${user} OR assignee:${user})',
+    suffixForDashboard: 'limit:25',
+  },
+  {
+    // Open changes the viewed user is CCed on. Changes ignored by the viewing
+    // user are filtered out.
+    name: 'CCed on',
+    query: 'is:open -is:ignored cc:${user}',
+    suffixForDashboard: 'limit:10',
+  },
+  {
+    name: 'Recently closed',
+    // Closed changes where viewed user is owner, reviewer, or assignee.
+    // Changes ignored by the viewing user are filtered out, and so are WIP
+    // changes not owned by the viewing user (the one instance of
+    // 'owner:self' is intentional and implements this logic).
+    query: 'is:closed -is:ignored (-is:wip OR owner:self) ' +
+        '(owner:${user} OR reviewer:${user} OR assignee:${user} ' +
+        'OR cc:${user})',
+    suffixForDashboard: '-age:4w limit:10',
+  },
+];
 
-  const USER_PLACEHOLDER_PATTERN = /\$\{user\}/g;
+// TODO(dmfilippov) Convert to class, extract consts, give better name and
+// expose as a service from appContext
+export const GerritNav = {
 
-  // NOTE: These queries are tested in Java. Any changes made to definitions
-  // here require corresponding changes to:
-  // javatests/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java
-  const DEFAULT_SECTIONS = [
-    {
-      // Changes with unpublished draft comments. This section is omitted when
-      // viewing other users, so we don't need to filter anything out.
-      name: 'Has draft comments',
-      query: 'has:draft',
-      selfOnly: true,
-      hideIfEmpty: true,
-      suffixForDashboard: 'limit:10',
-    },
-    {
-      // Changes that are assigned to the viewed user.
-      name: 'Assigned reviews',
-      query: 'assignee:${user} (-is:wip OR owner:self OR assignee:self) ' +
-          'is:open -is:ignored',
-      hideIfEmpty: true,
-      suffixForDashboard: 'limit:25',
-    },
-    {
-      // WIP open changes owned by viewing user. This section is omitted when
-      // viewing other users, so we don't need to filter anything out.
-      name: 'Work in progress',
-      query: 'is:open owner:${user} is:wip',
-      selfOnly: true,
-      hideIfEmpty: true,
-      suffixForDashboard: 'limit:25',
-    },
-    {
-      // Non-WIP open changes owned by viewed user. Filter out changes ignored
-      // by the viewing user.
-      name: 'Outgoing reviews',
-      query: 'is:open owner:${user} -is:wip -is:ignored',
-      isOutgoing: true,
-      suffixForDashboard: 'limit:25',
-    },
-    {
-      // Non-WIP open changes not owned by the viewed user, that the viewed user
-      // is associated with (as either a reviewer or the assignee). Changes
-      // ignored by the viewing user are filtered out.
-      name: 'Incoming reviews',
-      query: 'is:open -owner:${user} -is:wip -is:ignored ' +
-          '(reviewer:${user} OR assignee:${user})',
-      suffixForDashboard: 'limit:25',
-    },
-    {
-      // Open changes the viewed user is CCed on. Changes ignored by the viewing
-      // user are filtered out.
-      name: 'CCed on',
-      query: 'is:open -is:ignored cc:${user}',
-      suffixForDashboard: 'limit:10',
-    },
-    {
-      name: 'Recently closed',
-      // Closed changes where viewed user is owner, reviewer, or assignee.
-      // Changes ignored by the viewing user are filtered out, and so are WIP
-      // changes not owned by the viewing user (the one instance of
-      // 'owner:self' is intentional and implements this logic).
-      query: 'is:closed -is:ignored (-is:wip OR owner:self) ' +
-          '(owner:${user} OR reviewer:${user} OR assignee:${user} ' +
-          'OR cc:${user})',
-      suffixForDashboard: '-age:4w limit:10',
-    },
-  ];
+  View: {
+    ADMIN: 'admin',
+    AGREEMENTS: 'agreements',
+    CHANGE: 'change',
+    DASHBOARD: 'dashboard',
+    DIFF: 'diff',
+    DOCUMENTATION_SEARCH: 'documentation-search',
+    EDIT: 'edit',
+    GROUP: 'group',
+    PLUGIN_SCREEN: 'plugin-screen',
+    REPO: 'repo',
+    ROOT: 'root',
+    SEARCH: 'search',
+    SETTINGS: 'settings',
+  },
 
-  window.Gerrit.Nav = {
+  GroupDetailView: {
+    MEMBERS: 'members',
+    LOG: 'log',
+  },
 
-    View: {
-      ADMIN: 'admin',
-      AGREEMENTS: 'agreements',
-      CHANGE: 'change',
-      DASHBOARD: 'dashboard',
-      DIFF: 'diff',
-      DOCUMENTATION_SEARCH: 'documentation-search',
-      EDIT: 'edit',
-      GROUP: 'group',
-      PLUGIN_SCREEN: 'plugin-screen',
-      REPO: 'repo',
-      ROOT: 'root',
-      SEARCH: 'search',
-      SETTINGS: 'settings',
-    },
+  RepoDetailView: {
+    ACCESS: 'access',
+    BRANCHES: 'branches',
+    COMMANDS: 'commands',
+    DASHBOARDS: 'dashboards',
+    TAGS: 'tags',
+  },
 
-    GroupDetailView: {
-      MEMBERS: 'members',
-      LOG: 'log',
-    },
+  WeblinkType: {
+    CHANGE: 'change',
+    FILE: 'file',
+    PATCHSET: 'patchset',
+  },
 
-    RepoDetailView: {
-      ACCESS: 'access',
-      BRANCHES: 'branches',
-      COMMANDS: 'commands',
-      DASHBOARDS: 'dashboards',
-      TAGS: 'tags',
-    },
+  /** @type {Function} */
+  _navigate: uninitialized,
 
-    WeblinkType: {
-      CHANGE: 'change',
-      FILE: 'file',
-      PATCHSET: 'patchset',
-    },
+  /** @type {Function} */
+  _generateUrl: uninitialized,
 
-    /** @type {Function} */
-    _navigate: uninitialized,
+  /** @type {Function} */
+  _generateWeblinks: uninitialized,
 
-    /** @type {Function} */
-    _generateUrl: uninitialized,
+  /** @type {Function} */
+  mapCommentlinks: uninitialized,
 
-    /** @type {Function} */
-    _generateWeblinks: uninitialized,
+  /**
+   * @param {number=} patchNum
+   * @param {number|string=} basePatchNum
+   */
+  _checkPatchRange(patchNum, basePatchNum) {
+    if (basePatchNum && !patchNum) {
+      throw new Error('Cannot use base patch number without patch number.');
+    }
+  },
 
-    /** @type {Function} */
-    mapCommentlinks: uninitialized,
+  /**
+   * Setup router implementation.
+   *
+   * @param {function(!string)} navigate the router-abstracted equivalent of
+   *     `window.location.href = ...`. Takes a string.
+   * @param {function(!Object): string} generateUrl generates a URL given
+   *     navigation parameters, detailed in the file header.
+   * @param {function(!Object): string} generateWeblinks weblinks generator
+   *     function takes single payload parameter with type property that
+   *  determines which
+   *     part of the UI is the consumer of the weblinks. type property can
+   *     be one of file, change, or patchset.
+   *     - For file type, payload will also contain string properties: repo,
+   *         commit, file.
+   *     - For patchset type, payload will also contain string properties:
+   *         repo, commit.
+   *     - For change type, payload will also contain string properties:
+   *         repo, commit. If server provides weblinks, those will be passed
+   *         as options.weblinks property on the main payload object.
+   * @param {function(!Object): Object} mapCommentlinks provides an escape
+   *     hatch to modify the commentlinks object, e.g. if it contains any
+   *     relative URLs.
+   */
+  setup(navigate, generateUrl, generateWeblinks, mapCommentlinks) {
+    this._navigate = navigate;
+    this._generateUrl = generateUrl;
+    this._generateWeblinks = generateWeblinks;
+    this.mapCommentlinks = mapCommentlinks;
+  },
 
-    /**
-     * @param {number=} patchNum
-     * @param {number|string=} basePatchNum
-     */
-    _checkPatchRange(patchNum, basePatchNum) {
-      if (basePatchNum && !patchNum) {
-        throw new Error('Cannot use base patch number without patch number.');
-      }
-    },
+  destroy() {
+    this._navigate = uninitialized;
+    this._generateUrl = uninitialized;
+    this._generateWeblinks = uninitialized;
+    this.mapCommentlinks = uninitialized;
+  },
 
-    /**
-     * Setup router implementation.
-     *
-     * @param {function(!string)} navigate the router-abstracted equivalent of
-     *     `window.location.href = ...`. Takes a string.
-     * @param {function(!Object): string} generateUrl generates a URL given
-     *     navigation parameters, detailed in the file header.
-     * @param {function(!Object): string} generateWeblinks weblinks generator
-     *     function takes single payload parameter with type property that
-     *  determines which
-     *     part of the UI is the consumer of the weblinks. type property can
-     *     be one of file, change, or patchset.
-     *     - For file type, payload will also contain string properties: repo,
-     *         commit, file.
-     *     - For patchset type, payload will also contain string properties:
-     *         repo, commit.
-     *     - For change type, payload will also contain string properties:
-     *         repo, commit. If server provides weblinks, those will be passed
-     *         as options.weblinks property on the main payload object.
-     * @param {function(!Object): Object} mapCommentlinks provides an escape
-     *     hatch to modify the commentlinks object, e.g. if it contains any
-     *     relative URLs.
-     */
-    setup(navigate, generateUrl, generateWeblinks, mapCommentlinks) {
-      this._navigate = navigate;
-      this._generateUrl = generateUrl;
-      this._generateWeblinks = generateWeblinks;
-      this.mapCommentlinks = mapCommentlinks;
-    },
+  /**
+   * Generate a URL for the given route parameters.
+   *
+   * @param {Object} params
+   * @return {string}
+   */
+  _getUrlFor(params) {
+    return this._generateUrl(params);
+  },
 
-    destroy() {
-      this._navigate = uninitialized;
-      this._generateUrl = uninitialized;
-      this._generateWeblinks = uninitialized;
-      this.mapCommentlinks = uninitialized;
-    },
+  getUrlForSearchQuery(query, opt_offset) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      query,
+      offset: opt_offset,
+    });
+  },
 
-    /**
-     * Generate a URL for the given route parameters.
-     *
-     * @param {Object} params
-     * @return {string}
-     */
-    _getUrlFor(params) {
-      return this._generateUrl(params);
-    },
+  /**
+   * @param {!string} project The name of the project.
+   * @param {boolean=} opt_openOnly When true, only search open changes in
+   *     the project.
+   * @param {string=} opt_host The host in which to search.
+   * @return {string}
+   */
+  getUrlForProjectChanges(project, opt_openOnly, opt_host) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      project,
+      statuses: opt_openOnly ? ['open'] : [],
+      host: opt_host,
+    });
+  },
 
-    getUrlForSearchQuery(query, opt_offset) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        query,
-        offset: opt_offset,
-      });
-    },
+  /**
+   * @param {string} branch The name of the branch.
+   * @param {string} project The name of the project.
+   * @param {string=} opt_status The status to search.
+   * @param {string=} opt_host The host in which to search.
+   * @return {string}
+   */
+  getUrlForBranch(branch, project, opt_status, opt_host) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      branch,
+      project,
+      statuses: opt_status ? [opt_status] : undefined,
+      host: opt_host,
+    });
+  },
 
-    /**
-     * @param {!string} project The name of the project.
-     * @param {boolean=} opt_openOnly When true, only search open changes in
-     *     the project.
-     * @param {string=} opt_host The host in which to search.
-     * @return {string}
-     */
-    getUrlForProjectChanges(project, opt_openOnly, opt_host) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        project,
-        statuses: opt_openOnly ? ['open'] : [],
-        host: opt_host,
-      });
-    },
+  /**
+   * @param {string} topic The name of the topic.
+   * @param {string=} opt_host The host in which to search.
+   * @return {string}
+   */
+  getUrlForTopic(topic, opt_host) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      topic,
+      statuses: ['open', 'merged'],
+      host: opt_host,
+    });
+  },
 
-    /**
-     * @param {string} branch The name of the branch.
-     * @param {string} project The name of the project.
-     * @param {string=} opt_status The status to search.
-     * @param {string=} opt_host The host in which to search.
-     * @return {string}
-     */
-    getUrlForBranch(branch, project, opt_status, opt_host) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        branch,
-        project,
-        statuses: opt_status ? [opt_status] : undefined,
-        host: opt_host,
-      });
-    },
+  /**
+   * @param {string} hashtag The name of the hashtag.
+   * @return {string}
+   */
+  getUrlForHashtag(hashtag) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      hashtag,
+      statuses: ['open', 'merged'],
+    });
+  },
 
-    /**
-     * @param {string} topic The name of the topic.
-     * @param {string=} opt_host The host in which to search.
-     * @return {string}
-     */
-    getUrlForTopic(topic, opt_host) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        topic,
-        statuses: ['open', 'merged'],
-        host: opt_host,
-      });
-    },
+  /**
+   * Navigate to a search for changes with the given status.
+   *
+   * @param {string} status
+   */
+  navigateToStatusSearch(status) {
+    this._navigate(this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      statuses: [status],
+    }));
+  },
 
-    /**
-     * @param {string} hashtag The name of the hashtag.
-     * @return {string}
-     */
-    getUrlForHashtag(hashtag) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        hashtag,
-        statuses: ['open', 'merged'],
-      });
-    },
+  /**
+   * Navigate to a search query
+   *
+   * @param {string} query
+   * @param {number=} opt_offset
+   */
+  navigateToSearchQuery(query, opt_offset) {
+    return this._navigate(this.getUrlForSearchQuery(query, opt_offset));
+  },
 
-    /**
-     * Navigate to a search for changes with the given status.
-     *
-     * @param {string} status
-     */
-    navigateToStatusSearch(status) {
-      this._navigate(this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        statuses: [status],
-      }));
-    },
+  /**
+   * Navigate to the user's dashboard
+   */
+  navigateToUserDashboard() {
+    return this._navigate(this.getUrlForUserDashboard('self'));
+  },
 
-    /**
-     * Navigate to a search query
-     *
-     * @param {string} query
-     * @param {number=} opt_offset
-     */
-    navigateToSearchQuery(query, opt_offset) {
-      return this._navigate(this.getUrlForSearchQuery(query, opt_offset));
-    },
+  /**
+   * @param {!Object} change The change object.
+   * @param {number=} opt_patchNum
+   * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
+   *     used for none.
+   * @param {boolean=} opt_isEdit
+   * @param {string=} opt_messageHash
+   * @return {string}
+   */
+  getUrlForChange(change, opt_patchNum, opt_basePatchNum, opt_isEdit,
+      opt_messageHash) {
+    if (opt_basePatchNum === PARENT_PATCHNUM) {
+      opt_basePatchNum = undefined;
+    }
 
-    /**
-     * Navigate to the user's dashboard
-     */
-    navigateToUserDashboard() {
-      return this._navigate(this.getUrlForUserDashboard('self'));
-    },
+    this._checkPatchRange(opt_patchNum, opt_basePatchNum);
+    return this._getUrlFor({
+      view: GerritNav.View.CHANGE,
+      changeNum: change._number,
+      project: change.project,
+      patchNum: opt_patchNum,
+      basePatchNum: opt_basePatchNum,
+      edit: opt_isEdit,
+      host: change.internalHost || undefined,
+      messageHash: opt_messageHash,
+    });
+  },
 
-    /**
-     * @param {!Object} change The change object.
-     * @param {number=} opt_patchNum
-     * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
-     *     used for none.
-     * @param {boolean=} opt_isEdit
-     * @param {string=} opt_messageHash
-     * @return {string}
-     */
-    getUrlForChange(change, opt_patchNum, opt_basePatchNum, opt_isEdit,
-        opt_messageHash) {
-      if (opt_basePatchNum === PARENT_PATCHNUM) {
-        opt_basePatchNum = undefined;
-      }
+  /**
+   * @param {number} changeNum
+   * @param {string} project The name of the project.
+   * @param {number=} opt_patchNum
+   * @return {string}
+   */
+  getUrlForChangeById(changeNum, project, opt_patchNum) {
+    return this._getUrlFor({
+      view: GerritNav.View.CHANGE,
+      changeNum,
+      project,
+      patchNum: opt_patchNum,
+    });
+  },
 
-      this._checkPatchRange(opt_patchNum, opt_basePatchNum);
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.CHANGE,
-        changeNum: change._number,
-        project: change.project,
-        patchNum: opt_patchNum,
-        basePatchNum: opt_basePatchNum,
-        edit: opt_isEdit,
-        host: change.internalHost || undefined,
-        messageHash: opt_messageHash,
-      });
-    },
+  /**
+   * @param {!Object} change The change object.
+   * @param {number=} opt_patchNum
+   * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
+   *     used for none.
+   * @param {boolean=} opt_isEdit
+   */
+  navigateToChange(change, opt_patchNum, opt_basePatchNum, opt_isEdit) {
+    this._navigate(this.getUrlForChange(change, opt_patchNum,
+        opt_basePatchNum, opt_isEdit));
+  },
 
-    /**
-     * @param {number} changeNum
-     * @param {string} project The name of the project.
-     * @param {number=} opt_patchNum
-     * @return {string}
-     */
-    getUrlForChangeById(changeNum, project, opt_patchNum) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.CHANGE,
-        changeNum,
-        project,
-        patchNum: opt_patchNum,
-      });
-    },
+  /**
+   * @param {{ _number: number, project: string }} change The change object.
+   * @param {string} path The file path.
+   * @param {number=} opt_patchNum
+   * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
+   *     used for none.
+   * @param {number|string=} opt_lineNum
+   * @return {string}
+   */
+  getUrlForDiff(change, path, opt_patchNum, opt_basePatchNum, opt_lineNum) {
+    return this.getUrlForDiffById(change._number, change.project, path,
+        opt_patchNum, opt_basePatchNum, opt_lineNum);
+  },
 
-    /**
-     * @param {!Object} change The change object.
-     * @param {number=} opt_patchNum
-     * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
-     *     used for none.
-     * @param {boolean=} opt_isEdit
-     */
-    navigateToChange(change, opt_patchNum, opt_basePatchNum, opt_isEdit) {
-      this._navigate(this.getUrlForChange(change, opt_patchNum,
-          opt_basePatchNum, opt_isEdit));
-    },
+  /**
+   * @param {number} changeNum
+   * @param {string} project The name of the project.
+   * @param {string} path The file path.
+   * @param {number=} opt_patchNum
+   * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
+   *     used for none.
+   * @param {number=} opt_lineNum
+   * @param {boolean=} opt_leftSide
+   * @return {string}
+   */
+  getUrlForDiffById(changeNum, project, path, opt_patchNum,
+      opt_basePatchNum, opt_lineNum, opt_leftSide) {
+    if (opt_basePatchNum === PARENT_PATCHNUM) {
+      opt_basePatchNum = undefined;
+    }
 
-    /**
-     * @param {{ _number: number, project: string }} change The change object.
-     * @param {string} path The file path.
-     * @param {number=} opt_patchNum
-     * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
-     *     used for none.
-     * @param {number|string=} opt_lineNum
-     * @return {string}
-     */
-    getUrlForDiff(change, path, opt_patchNum, opt_basePatchNum, opt_lineNum) {
-      return this.getUrlForDiffById(change._number, change.project, path,
-          opt_patchNum, opt_basePatchNum, opt_lineNum);
-    },
+    this._checkPatchRange(opt_patchNum, opt_basePatchNum);
+    return this._getUrlFor({
+      view: GerritNav.View.DIFF,
+      changeNum,
+      project,
+      path,
+      patchNum: opt_patchNum,
+      basePatchNum: opt_basePatchNum,
+      lineNum: opt_lineNum,
+      leftSide: opt_leftSide,
+    });
+  },
 
-    /**
-     * @param {number} changeNum
-     * @param {string} project The name of the project.
-     * @param {string} path The file path.
-     * @param {number=} opt_patchNum
-     * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
-     *     used for none.
-     * @param {number=} opt_lineNum
-     * @param {boolean=} opt_leftSide
-     * @return {string}
-     */
-    getUrlForDiffById(changeNum, project, path, opt_patchNum,
-        opt_basePatchNum, opt_lineNum, opt_leftSide) {
-      if (opt_basePatchNum === PARENT_PATCHNUM) {
-        opt_basePatchNum = undefined;
-      }
+  /**
+   * @param {{ _number: number, project: string }} change The change object.
+   * @param {string} path The file path.
+   * @param {number=} opt_patchNum
+   * @return {string}
+   */
+  getEditUrlForDiff(change, path, opt_patchNum) {
+    return this.getEditUrlForDiffById(change._number, change.project, path,
+        opt_patchNum);
+  },
 
-      this._checkPatchRange(opt_patchNum, opt_basePatchNum);
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.DIFF,
-        changeNum,
-        project,
-        path,
-        patchNum: opt_patchNum,
-        basePatchNum: opt_basePatchNum,
-        lineNum: opt_lineNum,
-        leftSide: opt_leftSide,
-      });
-    },
+  /**
+   * @param {number} changeNum
+   * @param {string} project The name of the project.
+   * @param {string} path The file path.
+   * @param {number|string=} opt_patchNum The patchNum the file content
+   *    should be based on, or ${EDIT_PATCHNUM} if left undefined.
+   * @return {string}
+   */
+  getEditUrlForDiffById(changeNum, project, path, opt_patchNum) {
+    return this._getUrlFor({
+      view: GerritNav.View.EDIT,
+      changeNum,
+      project,
+      path,
+      patchNum: opt_patchNum || EDIT_PATCHNUM,
+    });
+  },
 
-    /**
-     * @param {{ _number: number, project: string }} change The change object.
-     * @param {string} path The file path.
-     * @param {number=} opt_patchNum
-     * @return {string}
-     */
-    getEditUrlForDiff(change, path, opt_patchNum) {
-      return this.getEditUrlForDiffById(change._number, change.project, path,
-          opt_patchNum);
-    },
+  /**
+   * @param {!Object} change The change object.
+   * @param {string} path The file path.
+   * @param {number=} opt_patchNum
+   * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
+   *     used for none.
+   */
+  navigateToDiff(change, path, opt_patchNum, opt_basePatchNum) {
+    this._navigate(this.getUrlForDiff(change, path, opt_patchNum,
+        opt_basePatchNum));
+  },
 
-    /**
-     * @param {number} changeNum
-     * @param {string} project The name of the project.
-     * @param {string} path The file path.
-     * @param {number|string=} opt_patchNum The patchNum the file content
-     *    should be based on, or ${EDIT_PATCHNUM} if left undefined.
-     * @return {string}
-     */
-    getEditUrlForDiffById(changeNum, project, path, opt_patchNum) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.EDIT,
-        changeNum,
-        project,
-        path,
-        patchNum: opt_patchNum || EDIT_PATCHNUM,
-      });
-    },
+  /**
+   * @param {string} owner The name of the owner.
+   * @return {string}
+   */
+  getUrlForOwner(owner) {
+    return this._getUrlFor({
+      view: GerritNav.View.SEARCH,
+      owner,
+    });
+  },
 
-    /**
-     * @param {!Object} change The change object.
-     * @param {string} path The file path.
-     * @param {number=} opt_patchNum
-     * @param {number|string=} opt_basePatchNum The string 'PARENT' can be
-     *     used for none.
-     */
-    navigateToDiff(change, path, opt_patchNum, opt_basePatchNum) {
-      this._navigate(this.getUrlForDiff(change, path, opt_patchNum,
-          opt_basePatchNum));
-    },
+  /**
+   * @param {string} user The name of the user.
+   * @return {string}
+   */
+  getUrlForUserDashboard(user) {
+    return this._getUrlFor({
+      view: GerritNav.View.DASHBOARD,
+      user,
+    });
+  },
 
-    /**
-     * @param {string} owner The name of the owner.
-     * @return {string}
-     */
-    getUrlForOwner(owner) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.SEARCH,
-        owner,
-      });
-    },
+  /**
+   * @return {string}
+   */
+  getUrlForRoot() {
+    return this._getUrlFor({
+      view: GerritNav.View.ROOT,
+    });
+  },
 
-    /**
-     * @param {string} user The name of the user.
-     * @return {string}
-     */
-    getUrlForUserDashboard(user) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.DASHBOARD,
-        user,
-      });
-    },
+  /**
+   * @param {string} repo The name of the repo.
+   * @param {string} dashboard The ID of the dashboard, in the form of
+   *     '<ref>:<path>'.
+   * @return {string}
+   */
+  getUrlForRepoDashboard(repo, dashboard) {
+    return this._getUrlFor({
+      view: GerritNav.View.DASHBOARD,
+      repo,
+      dashboard,
+    });
+  },
 
-    /**
-     * @return {string}
-     */
-    getUrlForRoot() {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.ROOT,
-      });
-    },
+  /**
+   * Navigate to an arbitrary relative URL.
+   *
+   * @param {string} relativeUrl
+   */
+  navigateToRelativeUrl(relativeUrl) {
+    if (!relativeUrl.startsWith('/')) {
+      throw new Error('navigateToRelativeUrl with non-relative URL');
+    }
+    this._navigate(relativeUrl);
+  },
 
-    /**
-     * @param {string} repo The name of the repo.
-     * @param {string} dashboard The ID of the dashboard, in the form of
-     *     '<ref>:<path>'.
-     * @return {string}
-     */
-    getUrlForRepoDashboard(repo, dashboard) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.DASHBOARD,
-        repo,
-        dashboard,
-      });
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepo(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+    });
+  },
 
-    /**
-     * Navigate to an arbitrary relative URL.
-     *
-     * @param {string} relativeUrl
-     */
-    navigateToRelativeUrl(relativeUrl) {
-      if (!relativeUrl.startsWith('/')) {
-        throw new Error('navigateToRelativeUrl with non-relative URL');
-      }
-      this._navigate(relativeUrl);
-    },
+  /**
+   * Navigate to a repo settings page.
+   *
+   * @param {string} repoName
+   */
+  navigateToRepo(repoName) {
+    this._navigate(this.getUrlForRepo(repoName));
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepo(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-      });
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepoTags(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+      detail: GerritNav.RepoDetailView.TAGS,
+    });
+  },
 
-    /**
-     * Navigate to a repo settings page.
-     *
-     * @param {string} repoName
-     */
-    navigateToRepo(repoName) {
-      this._navigate(this.getUrlForRepo(repoName));
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepoBranches(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+      detail: GerritNav.RepoDetailView.BRANCHES,
+    });
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepoTags(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-        detail: Gerrit.Nav.RepoDetailView.TAGS,
-      });
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepoAccess(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+      detail: GerritNav.RepoDetailView.ACCESS,
+    });
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepoBranches(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-        detail: Gerrit.Nav.RepoDetailView.BRANCHES,
-      });
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepoCommands(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+      detail: GerritNav.RepoDetailView.COMMANDS,
+    });
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepoAccess(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-        detail: Gerrit.Nav.RepoDetailView.ACCESS,
-      });
-    },
+  /**
+   * @param {string} repoName
+   * @return {string}
+   */
+  getUrlForRepoDashboards(repoName) {
+    return this._getUrlFor({
+      view: GerritNav.View.REPO,
+      repoName,
+      detail: GerritNav.RepoDetailView.DASHBOARDS,
+    });
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepoCommands(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-        detail: Gerrit.Nav.RepoDetailView.COMMANDS,
-      });
-    },
+  /**
+   * @param {string} groupId
+   * @return {string}
+   */
+  getUrlForGroup(groupId) {
+    return this._getUrlFor({
+      view: GerritNav.View.GROUP,
+      groupId,
+    });
+  },
 
-    /**
-     * @param {string} repoName
-     * @return {string}
-     */
-    getUrlForRepoDashboards(repoName) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.REPO,
-        repoName,
-        detail: Gerrit.Nav.RepoDetailView.DASHBOARDS,
-      });
-    },
+  /**
+   * @param {string} groupId
+   * @return {string}
+   */
+  getUrlForGroupLog(groupId) {
+    return this._getUrlFor({
+      view: GerritNav.View.GROUP,
+      groupId,
+      detail: GerritNav.GroupDetailView.LOG,
+    });
+  },
 
-    /**
-     * @param {string} groupId
-     * @return {string}
-     */
-    getUrlForGroup(groupId) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.GROUP,
-        groupId,
-      });
-    },
+  /**
+   * @param {string} groupId
+   * @return {string}
+   */
+  getUrlForGroupMembers(groupId) {
+    return this._getUrlFor({
+      view: GerritNav.View.GROUP,
+      groupId,
+      detail: GerritNav.GroupDetailView.MEMBERS,
+    });
+  },
 
-    /**
-     * @param {string} groupId
-     * @return {string}
-     */
-    getUrlForGroupLog(groupId) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.GROUP,
-        groupId,
-        detail: Gerrit.Nav.GroupDetailView.LOG,
-      });
-    },
+  getUrlForSettings() {
+    return this._getUrlFor({view: GerritNav.View.SETTINGS});
+  },
 
-    /**
-     * @param {string} groupId
-     * @return {string}
-     */
-    getUrlForGroupMembers(groupId) {
-      return this._getUrlFor({
-        view: Gerrit.Nav.View.GROUP,
-        groupId,
-        detail: Gerrit.Nav.GroupDetailView.MEMBERS,
-      });
-    },
+  /**
+   * @param {string} repo
+   * @param {string} commit
+   * @param {string} file
+   * @param {Object=} opt_options
+   * @return {
+   *   Array<{label: string, url: string}>|
+   *   {label: string, url: string}
+   *  }
+   */
+  getFileWebLinks(repo, commit, file, opt_options) {
+    const params = {type: GerritNav.WeblinkType.FILE, repo, commit, file};
+    if (opt_options) {
+      params.options = opt_options;
+    }
+    return [].concat(this._generateWeblinks(params));
+  },
 
-    getUrlForSettings() {
-      return this._getUrlFor({view: Gerrit.Nav.View.SETTINGS});
-    },
+  /**
+   * @param {string} repo
+   * @param {string} commit
+   * @param {Object=} opt_options
+   * @return {{label: string, url: string}}
+   */
+  getPatchSetWeblink(repo, commit, opt_options) {
+    const params = {type: GerritNav.WeblinkType.PATCHSET, repo, commit};
+    if (opt_options) {
+      params.options = opt_options;
+    }
+    const result = this._generateWeblinks(params);
+    if (Array.isArray(result)) {
+      return result.pop();
+    } else {
+      return result;
+    }
+  },
 
-    /**
-     * @param {string} repo
-     * @param {string} commit
-     * @param {string} file
-     * @param {Object=} opt_options
-     * @return {
-     *   Array<{label: string, url: string}>|
-     *   {label: string, url: string}
-     *  }
-     */
-    getFileWebLinks(repo, commit, file, opt_options) {
-      const params = {type: Gerrit.Nav.WeblinkType.FILE, repo, commit, file};
-      if (opt_options) {
-        params.options = opt_options;
-      }
-      return [].concat(this._generateWeblinks(params));
-    },
+  /**
+   * @param {string} repo
+   * @param {string} commit
+   * @param {Object=} opt_options
+   * @return {
+   *   Array<{label: string, url: string}>|
+   *   {label: string, url: string}
+   *  }
+   */
+  getChangeWeblinks(repo, commit, opt_options) {
+    const params = {type: GerritNav.WeblinkType.CHANGE, repo, commit};
+    if (opt_options) {
+      params.options = opt_options;
+    }
+    return [].concat(this._generateWeblinks(params));
+  },
 
-    /**
-     * @param {string} repo
-     * @param {string} commit
-     * @param {Object=} opt_options
-     * @return {{label: string, url: string}}
-     */
-    getPatchSetWeblink(repo, commit, opt_options) {
-      const params = {type: Gerrit.Nav.WeblinkType.PATCHSET, repo, commit};
-      if (opt_options) {
-        params.options = opt_options;
-      }
-      const result = this._generateWeblinks(params);
-      if (Array.isArray(result)) {
-        return result.pop();
-      } else {
-        return result;
-      }
-    },
-
-    /**
-     * @param {string} repo
-     * @param {string} commit
-     * @param {Object=} opt_options
-     * @return {
-     *   Array<{label: string, url: string}>|
-     *   {label: string, url: string}
-     *  }
-     */
-    getChangeWeblinks(repo, commit, opt_options) {
-      const params = {type: Gerrit.Nav.WeblinkType.CHANGE, repo, commit};
-      if (opt_options) {
-        params.options = opt_options;
-      }
-      return [].concat(this._generateWeblinks(params));
-    },
-
-    getUserDashboard(user = 'self', sections = DEFAULT_SECTIONS,
-        title = '') {
-      sections = sections
-          .filter(section => (user === 'self' || !section.selfOnly))
-          .map(section => Object.assign({}, section, {
-            name: section.name,
-            query: section.query.replace(USER_PLACEHOLDER_PATTERN, user),
-          }));
-      return {title, sections};
-    },
-  };
-})(window);
+  getUserDashboard(user = 'self', sections = DEFAULT_SECTIONS,
+      title = '') {
+    sections = sections
+        .filter(section => (user === 'self' || !section.selfOnly))
+        .map(section => Object.assign({}, section, {
+          name: section.name,
+          query: section.query.replace(USER_PLACEHOLDER_PATTERN, user),
+        }));
+    return {title, sections};
+  },
+};
diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation_test.html b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation_test.html
index 33f6215..150c23b 100644
--- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation_test.html
+++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation_test.html
@@ -25,10 +25,12 @@
 <script src="/components/wct-browser-legacy/browser.js"></script>
 <script type="module">
 import '../../../test/common-test-setup.js';
+import {GerritNav} from './gr-navigation.js';
+
 suite('gr-navigation tests', () => {
   test('invalid patch ranges throw exceptions', () => {
-    assert.throw(() => Gerrit.Nav.getUrlForChange('123', undefined, 12));
-    assert.throw(() => Gerrit.Nav.getUrlForDiff('123', 'x.c', undefined, 12));
+    assert.throw(() => GerritNav.getUrlForChange('123', undefined, 12));
+    assert.throw(() => GerritNav.getUrlForDiff('123', 'x.c', undefined, 12));
   });
 
   suite('_getUserDashboard', () => {
@@ -41,7 +43,7 @@
 
     test('dashboard for self', () => {
       const dashboard =
-          Gerrit.Nav.getUserDashboard('self', sections, 'title');
+           GerritNav.getUserDashboard('self', sections, 'title');
       assert.deepEqual(
           dashboard,
           {
@@ -64,7 +66,7 @@
 
     test('dashboard for other user', () => {
       const dashboard =
-          Gerrit.Nav.getUserDashboard('user', sections, 'title');
+           GerritNav.getUserDashboard('user', sections, 'title');
       assert.deepEqual(
           dashboard,
           {
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.js b/polygerrit-ui/app/elements/core/gr-router/gr-router.js
index 9aebd97..56e087e 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.js
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.js
@@ -16,7 +16,6 @@
  */
 import '../../../scripts/bundled-polymer.js';
 
-import '../gr-navigation/gr-navigation.js';
 import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
 import '../gr-reporting/gr-reporting.js';
 import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
@@ -28,6 +27,7 @@
 import {BaseUrlBehavior} from '../../../behaviors/base-url-behavior/base-url-behavior.js';
 import {PatchSetBehavior} from '../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.js';
 import {URLEncodingBehavior} from '../../../behaviors/gr-url-encoding-behavior/gr-url-encoding-behavior.js';
+import {GerritNav} from '../gr-navigation/gr-navigation.js';
 
 const RoutePattern = {
   ROOT: '/',
@@ -276,7 +276,7 @@
   _generateUrl(params) {
     const base = this.getBaseUrl();
     let url = '';
-    const Views = Gerrit.Nav.View;
+    const Views = GerritNav.View;
 
     if (params.view === Views.SEARCH) {
       url = this._generateSearchUrl(params);
@@ -304,11 +304,11 @@
   _generateWeblinks(params) {
     const type = params.type;
     switch (type) {
-      case Gerrit.Nav.WeblinkType.FILE:
+      case GerritNav.WeblinkType.FILE:
         return this._getFileWebLinks(params);
-      case Gerrit.Nav.WeblinkType.CHANGE:
+      case GerritNav.WeblinkType.CHANGE:
         return this._getChangeWeblinks(params);
-      case Gerrit.Nav.WeblinkType.PATCHSET:
+      case GerritNav.WeblinkType.PATCHSET:
         return this._getPatchSetWeblink(params);
       default:
         console.warn(`Unsupported weblink ${type}!`);
@@ -491,7 +491,7 @@
 
     let suffix = `${range}/${this.encodeURL(params.path, true)}`;
 
-    if (params.view === Gerrit.Nav.View.EDIT) { suffix += ',edit'; }
+    if (params.view === GerritNav.View.EDIT) { suffix += ',edit'; }
 
     if (params.lineNum) {
       suffix += '#';
@@ -513,9 +513,9 @@
    */
   _generateGroupUrl(params) {
     let url = `/admin/groups/${this.encodeURL(params.groupId + '', true)}`;
-    if (params.detail === Gerrit.Nav.GroupDetailView.MEMBERS) {
+    if (params.detail === GerritNav.GroupDetailView.MEMBERS) {
       url += ',members';
-    } else if (params.detail === Gerrit.Nav.GroupDetailView.LOG) {
+    } else if (params.detail === GerritNav.GroupDetailView.LOG) {
       url += ',audit-log';
     }
     return url;
@@ -527,15 +527,15 @@
    */
   _generateRepoUrl(params) {
     let url = `/admin/repos/${this.encodeURL(params.repoName + '', true)}`;
-    if (params.detail === Gerrit.Nav.RepoDetailView.ACCESS) {
+    if (params.detail === GerritNav.RepoDetailView.ACCESS) {
       url += ',access';
-    } else if (params.detail === Gerrit.Nav.RepoDetailView.BRANCHES) {
+    } else if (params.detail === GerritNav.RepoDetailView.BRANCHES) {
       url += ',branches';
-    } else if (params.detail === Gerrit.Nav.RepoDetailView.TAGS) {
+    } else if (params.detail === GerritNav.RepoDetailView.TAGS) {
       url += ',tags';
-    } else if (params.detail === Gerrit.Nav.RepoDetailView.COMMANDS) {
+    } else if (params.detail === GerritNav.RepoDetailView.COMMANDS) {
       url += ',commands';
-    } else if (params.detail === Gerrit.Nav.RepoDetailView.DASHBOARDS) {
+    } else if (params.detail === GerritNav.RepoDetailView.DASHBOARDS) {
       url += ',dashboards';
     }
     return url;
@@ -727,7 +727,7 @@
       page.base(base);
     }
 
-    Gerrit.Nav.setup(
+    GerritNav.setup(
         url => { page.show(url); },
         this._generateUrl.bind(this),
         params => this._generateWeblinks(params),
@@ -1021,7 +1021,7 @@
         }
       } else {
         this._setParams({
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           user: data.params[0],
         });
       }
@@ -1067,7 +1067,7 @@
     if (sections.length > 0) {
       // Custom dashboard view.
       this._setParams({
-        view: Gerrit.Nav.View.DASHBOARD,
+        view: GerritNav.View.DASHBOARD,
         user: 'self',
         sections,
         title,
@@ -1083,7 +1083,7 @@
   _handleProjectDashboardRoute(data) {
     const project = data.params[0];
     this._setParams({
-      view: Gerrit.Nav.View.DASHBOARD,
+      view: GerritNav.View.DASHBOARD,
       project,
       dashboard: decodeURIComponent(data.params[1]),
     });
@@ -1100,30 +1100,30 @@
 
   _handleGroupRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.GROUP,
+      view: GerritNav.View.GROUP,
       groupId: data.params[0],
     });
   }
 
   _handleGroupAuditLogRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.GROUP,
-      detail: Gerrit.Nav.GroupDetailView.LOG,
+      view: GerritNav.View.GROUP,
+      detail: GerritNav.GroupDetailView.LOG,
       groupId: data.params[0],
     });
   }
 
   _handleGroupMembersRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.GROUP,
-      detail: Gerrit.Nav.GroupDetailView.MEMBERS,
+      view: GerritNav.View.GROUP,
+      detail: GerritNav.GroupDetailView.MEMBERS,
       groupId: data.params[0],
     });
   }
 
   _handleGroupListOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-admin-group-list',
       offset: data.params[1] || 0,
       filter: null,
@@ -1133,7 +1133,7 @@
 
   _handleGroupListFilterOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-admin-group-list',
       offset: data.params.offset,
       filter: data.params.filter,
@@ -1142,7 +1142,7 @@
 
   _handleGroupListFilterRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-admin-group-list',
       filter: data.params.filter || null,
     });
@@ -1164,8 +1164,8 @@
   _handleRepoCommandsRoute(data) {
     const repo = data.params[0];
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.COMMANDS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.COMMANDS,
       repo,
     });
     this.$.reporting.setRepoName(repo);
@@ -1174,8 +1174,8 @@
   _handleRepoAccessRoute(data) {
     const repo = data.params[0];
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.ACCESS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.ACCESS,
       repo,
     });
     this.$.reporting.setRepoName(repo);
@@ -1184,8 +1184,8 @@
   _handleRepoDashboardsRoute(data) {
     const repo = data.params[0];
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.DASHBOARDS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.DASHBOARDS,
       repo,
     });
     this.$.reporting.setRepoName(repo);
@@ -1193,8 +1193,8 @@
 
   _handleBranchListOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.BRANCHES,
       repo: data.params[0],
       offset: data.params[2] || 0,
       filter: null,
@@ -1203,8 +1203,8 @@
 
   _handleBranchListFilterOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.BRANCHES,
       repo: data.params.repo,
       offset: data.params.offset,
       filter: data.params.filter,
@@ -1213,8 +1213,8 @@
 
   _handleBranchListFilterRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.BRANCHES,
       repo: data.params.repo,
       filter: data.params.filter || null,
     });
@@ -1222,8 +1222,8 @@
 
   _handleTagListOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.TAGS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.TAGS,
       repo: data.params[0],
       offset: data.params[2] || 0,
       filter: null,
@@ -1232,8 +1232,8 @@
 
   _handleTagListFilterOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.TAGS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.TAGS,
       repo: data.params.repo,
       offset: data.params.offset,
       filter: data.params.filter,
@@ -1242,8 +1242,8 @@
 
   _handleTagListFilterRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
-      detail: Gerrit.Nav.RepoDetailView.TAGS,
+      view: GerritNav.View.REPO,
+      detail: GerritNav.RepoDetailView.TAGS,
       repo: data.params.repo,
       filter: data.params.filter || null,
     });
@@ -1251,7 +1251,7 @@
 
   _handleRepoListOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-repo-list',
       offset: data.params[1] || 0,
       filter: null,
@@ -1261,7 +1261,7 @@
 
   _handleRepoListFilterOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-repo-list',
       offset: data.params.offset,
       filter: data.params.filter,
@@ -1270,7 +1270,7 @@
 
   _handleRepoListFilterRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-repo-list',
       filter: data.params.filter || null,
     });
@@ -1291,7 +1291,7 @@
   _handleRepoRoute(data) {
     const repo = data.params[0];
     this._setParams({
-      view: Gerrit.Nav.View.REPO,
+      view: GerritNav.View.REPO,
       repo,
     });
     this.$.reporting.setRepoName(repo);
@@ -1299,7 +1299,7 @@
 
   _handlePluginListOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-plugin-list',
       offset: data.params[1] || 0,
       filter: null,
@@ -1308,7 +1308,7 @@
 
   _handlePluginListFilterOffsetRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-plugin-list',
       offset: data.params.offset,
       filter: data.params.filter,
@@ -1317,7 +1317,7 @@
 
   _handlePluginListFilterRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-plugin-list',
       filter: data.params.filter || null,
     });
@@ -1325,14 +1325,14 @@
 
   _handlePluginListRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.ADMIN,
+      view: GerritNav.View.ADMIN,
       adminView: 'gr-plugin-list',
     });
   }
 
   _handleQueryRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.SEARCH,
+      view: GerritNav.View.SEARCH,
       query: data.params[0],
       offset: data.params[2],
     });
@@ -1353,7 +1353,7 @@
       changeNum: ctx.params[1],
       basePatchNum: ctx.params[4],
       patchNum: ctx.params[6],
-      view: Gerrit.Nav.View.CHANGE,
+      view: GerritNav.View.CHANGE,
       queryMap: ctx.queryMap,
     };
 
@@ -1369,7 +1369,7 @@
       basePatchNum: ctx.params[4],
       patchNum: ctx.params[6],
       path: ctx.params[8],
-      view: Gerrit.Nav.View.DIFF,
+      view: GerritNav.View.DIFF,
     };
 
     const address = this._parseLineAddress(ctx.hash);
@@ -1387,7 +1387,7 @@
       changeNum: ctx.params[0],
       basePatchNum: ctx.params[3],
       patchNum: ctx.params[5],
-      view: Gerrit.Nav.View.CHANGE,
+      view: GerritNav.View.CHANGE,
       querystring: ctx.querystring,
     };
 
@@ -1405,7 +1405,7 @@
       basePatchNum: ctx.params[2],
       patchNum: ctx.params[4],
       path: ctx.params[5],
-      view: Gerrit.Nav.View.DIFF,
+      view: GerritNav.View.DIFF,
     };
 
     const address = this._parseLineAddress(ctx.hash);
@@ -1426,7 +1426,7 @@
       patchNum: ctx.params[2],
       path: ctx.params[3],
       lineNum: ctx.hash,
-      view: Gerrit.Nav.View.EDIT,
+      view: GerritNav.View.EDIT,
     });
     this.$.reporting.setRepoName(project);
   }
@@ -1438,7 +1438,7 @@
       project,
       changeNum: ctx.params[1],
       patchNum: ctx.params[3],
-      view: Gerrit.Nav.View.CHANGE,
+      view: GerritNav.View.CHANGE,
       edit: true,
     });
     this.$.reporting.setRepoName(project);
@@ -1462,7 +1462,7 @@
   }
 
   _handleNewAgreementsRoute(data) {
-    data.params.view = Gerrit.Nav.View.AGREEMENTS;
+    data.params.view = GerritNav.View.AGREEMENTS;
     this._setParams(data.params);
   }
 
@@ -1472,13 +1472,13 @@
     // undo that to have valid tokens.
     const token = data.params[0].replace(/ /g, '+');
     this._setParams({
-      view: Gerrit.Nav.View.SETTINGS,
+      view: GerritNav.View.SETTINGS,
       emailToken: token,
     });
   }
 
   _handleSettingsRoute(data) {
-    this._setParams({view: Gerrit.Nav.View.SETTINGS});
+    this._setParams({view: GerritNav.View.SETTINGS});
   }
 
   _handleRegisterRoute(ctx) {
@@ -1511,7 +1511,7 @@
   }
 
   _handlePluginScreen(ctx) {
-    const view = Gerrit.Nav.View.PLUGIN_SCREEN;
+    const view = GerritNav.View.PLUGIN_SCREEN;
     const plugin = ctx.params[0];
     const screen = ctx.params[1];
     this._setParams({view, plugin, screen});
@@ -1519,7 +1519,7 @@
 
   _handleDocumentationSearchRoute(data) {
     this._setParams({
-      view: Gerrit.Nav.View.DOCUMENTATION_SEARCH,
+      view: GerritNav.View.DOCUMENTATION_SEARCH,
       filter: data.params.filter || null,
     });
   }
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.html b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.html
index 73b6fb0..9e3a7a8 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.html
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.html
@@ -34,6 +34,8 @@
 import '../../../test/common-test-setup.js';
 import './gr-router.js';
 import page from 'page/page.mjs';
+import {GerritNav} from '../gr-navigation/gr-navigation.js';
+
 suite('gr-router tests', () => {
   let element;
   let sandbox;
@@ -149,7 +151,7 @@
 
     const requiresAuth = {};
     const doesNotRequireAuth = {};
-    sandbox.stub(Gerrit.Nav, 'setup');
+    sandbox.stub(GerritNav, 'setup');
     sandbox.stub(page, 'start');
     sandbox.stub(page, 'base');
     sandbox.stub(element, '_mapRoute', (pattern, methodName, usesAuth) => {
@@ -268,7 +270,7 @@
   suite('generateUrl', () => {
     test('search', () => {
       let params = {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         owner: 'a%b',
         project: 'c%d',
         branch: 'e%f',
@@ -293,7 +295,7 @@
       assert.equal(element._generateUrl(params), '/q/foo%2524bar,100');
 
       params = {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         statuses: ['a', 'b', 'c'],
       };
       assert.equal(element._generateUrl(params),
@@ -302,12 +304,12 @@
 
     test('change', () => {
       const params = {
-        view: Gerrit.Nav.View.CHANGE,
+        view: GerritNav.View.CHANGE,
         changeNum: '1234',
         project: 'test',
       };
       const paramsWithQuery = {
-        view: Gerrit.Nav.View.CHANGE,
+        view: GerritNav.View.CHANGE,
         changeNum: '1234',
         project: 'test',
         querystring: 'revert&foo=bar',
@@ -335,7 +337,7 @@
 
     test('change with repo name encoding', () => {
       const params = {
-        view: Gerrit.Nav.View.CHANGE,
+        view: GerritNav.View.CHANGE,
         changeNum: '1234',
         project: 'x+/y+/z+/w',
       };
@@ -345,7 +347,7 @@
 
     test('diff', () => {
       const params = {
-        view: Gerrit.Nav.View.DIFF,
+        view: GerritNav.View.DIFF,
         changeNum: '42',
         path: 'x+y/path.cpp',
         patchNum: 12,
@@ -379,7 +381,7 @@
 
     test('diff with repo name encoding', () => {
       const params = {
-        view: Gerrit.Nav.View.DIFF,
+        view: GerritNav.View.DIFF,
         changeNum: '42',
         path: 'x+y/path.cpp',
         patchNum: 12,
@@ -391,7 +393,7 @@
 
     test('edit', () => {
       const params = {
-        view: Gerrit.Nav.View.EDIT,
+        view: GerritNav.View.EDIT,
         changeNum: '42',
         project: 'test',
         path: 'x+y/path.cpp',
@@ -421,14 +423,14 @@
     suite('dashboard', () => {
       test('self dashboard', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
         };
         assert.equal(element._generateUrl(params), '/dashboard/self');
       });
 
       test('user dashboard', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           user: 'user',
         };
         assert.equal(element._generateUrl(params), '/dashboard/user');
@@ -436,7 +438,7 @@
 
       test('custom self dashboard, no title', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           sections: [
             {name: 'section 1', query: 'query 1'},
             {name: 'section 2', query: 'query 2'},
@@ -449,7 +451,7 @@
 
       test('custom repo dashboard', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           sections: [
             {name: 'section 1', query: 'query 1 ${project}'},
             {name: 'section 2', query: 'query 2 ${repo}'},
@@ -464,7 +466,7 @@
 
       test('custom user dashboard, with title', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           user: 'user',
           sections: [{name: 'name', query: 'query'}],
           title: 'custom dashboard',
@@ -476,7 +478,7 @@
 
       test('repo dashboard', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           repo: 'gerrit/repo',
           dashboard: 'default:main',
         };
@@ -487,7 +489,7 @@
 
       test('project dashboard (legacy)', () => {
         const params = {
-          view: Gerrit.Nav.View.DASHBOARD,
+          view: GerritNav.View.DASHBOARD,
           project: 'gerrit/project',
           dashboard: 'default:main',
         };
@@ -500,7 +502,7 @@
     suite('groups', () => {
       test('group info', () => {
         const params = {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           groupId: 1234,
         };
         assert.equal(element._generateUrl(params), '/admin/groups/1234');
@@ -508,7 +510,7 @@
 
       test('group members', () => {
         const params = {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           groupId: 1234,
           detail: 'members',
         };
@@ -518,7 +520,7 @@
 
       test('group audit log', () => {
         const params = {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           groupId: 1234,
           detail: 'log',
         };
@@ -635,13 +637,13 @@
       element._handleNewAgreementsRoute({params: {}});
       assert.isTrue(setParamsStub.calledOnce);
       assert.equal(setParamsStub.lastCall.args[0].view,
-          Gerrit.Nav.View.AGREEMENTS);
+          GerritNav.View.AGREEMENTS);
     });
 
     test('_handleSettingsLegacyRoute', () => {
       const data = {params: {0: 'my-token'}};
       assertDataToParams(data, '_handleSettingsLegacyRoute', {
-        view: Gerrit.Nav.View.SETTINGS,
+        view: GerritNav.View.SETTINGS,
         emailToken: 'my-token',
       });
     });
@@ -649,7 +651,7 @@
     test('_handleSettingsLegacyRoute with +', () => {
       const data = {params: {0: 'my-token test'}};
       assertDataToParams(data, '_handleSettingsLegacyRoute', {
-        view: Gerrit.Nav.View.SETTINGS,
+        view: GerritNav.View.SETTINGS,
         emailToken: 'my-token+test',
       });
     });
@@ -657,7 +659,7 @@
     test('_handleSettingsRoute', () => {
       const data = {};
       assertDataToParams(data, '_handleSettingsRoute', {
-        view: Gerrit.Nav.View.SETTINGS,
+        view: GerritNav.View.SETTINGS,
       });
     });
 
@@ -677,7 +679,7 @@
         onExit = _onExit;
       };
       sandbox.stub(page, 'exit', onRegisteringExit);
-      sandbox.stub(Gerrit.Nav, 'setup');
+      sandbox.stub(GerritNav, 'setup');
       sandbox.stub(page, 'start');
       sandbox.stub(page, 'base');
       element._startRouter();
@@ -712,14 +714,14 @@
     test('_handleQueryRoute', () => {
       const data = {params: ['project:foo/bar/baz']};
       assertDataToParams(data, '_handleQueryRoute', {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         query: 'project:foo/bar/baz',
         offset: undefined,
       });
 
       data.params.push(',123', '123');
       assertDataToParams(data, '_handleQueryRoute', {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         query: 'project:foo/bar/baz',
         offset: '123',
       });
@@ -734,14 +736,14 @@
     test('_handleQueryRoute', () => {
       const data = {params: ['project:foo/bar/baz']};
       assertDataToParams(data, '_handleQueryRoute', {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         query: 'project:foo/bar/baz',
         offset: undefined,
       });
 
       data.params.push(',123', '123');
       assertDataToParams(data, '_handleQueryRoute', {
-        view: Gerrit.Nav.View.SEARCH,
+        view: GerritNav.View.SEARCH,
         query: 'project:foo/bar/baz',
         offset: '123',
       });
@@ -926,7 +928,7 @@
           assert.isFalse(redirectStub.called);
           assert.isTrue(setParamsStub.calledOnce);
           assert.deepEqual(setParamsStub.lastCall.args[0], {
-            view: Gerrit.Nav.View.DASHBOARD,
+            view: GerritNav.View.DASHBOARD,
             user: 'foo',
           });
         });
@@ -956,7 +958,7 @@
               assert.isFalse(redirectStub.called);
               assert.isTrue(setParamsStub.calledOnce);
               assert.deepEqual(setParamsStub.lastCall.args[0], {
-                view: Gerrit.Nav.View.DASHBOARD,
+                view: GerritNav.View.DASHBOARD,
                 user: 'self',
                 sections: [
                   {name: 'a', query: 'b'},
@@ -976,7 +978,7 @@
               assert.isFalse(redirectStub.called);
               assert.isTrue(setParamsStub.calledOnce);
               assert.deepEqual(setParamsStub.lastCall.args[0], {
-                view: Gerrit.Nav.View.DASHBOARD,
+                view: GerritNav.View.DASHBOARD,
                 user: 'self',
                 sections: [
                   {name: 'a', query: 'b'},
@@ -995,7 +997,7 @@
               assert.isFalse(redirectStub.called);
               assert.isTrue(setParamsStub.calledOnce);
               assert.deepEqual(setParamsStub.lastCall.args[0], {
-                view: Gerrit.Nav.View.DASHBOARD,
+                view: GerritNav.View.DASHBOARD,
                 user: 'self',
                 sections: [
                   {name: 'a', query: 'is:open b'},
@@ -1017,7 +1019,7 @@
       test('_handleGroupAuditLogRoute', () => {
         const data = {params: {0: 1234}};
         assertDataToParams(data, '_handleGroupAuditLogRoute', {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           detail: 'log',
           groupId: 1234,
         });
@@ -1026,7 +1028,7 @@
       test('_handleGroupMembersRoute', () => {
         const data = {params: {0: 1234}};
         assertDataToParams(data, '_handleGroupMembersRoute', {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           detail: 'members',
           groupId: 1234,
         });
@@ -1035,7 +1037,7 @@
       test('_handleGroupListOffsetRoute', () => {
         const data = {params: {}};
         assertDataToParams(data, '_handleGroupListOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-admin-group-list',
           offset: 0,
           filter: null,
@@ -1044,7 +1046,7 @@
 
         data.params[1] = 42;
         assertDataToParams(data, '_handleGroupListOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-admin-group-list',
           offset: 42,
           filter: null,
@@ -1053,7 +1055,7 @@
 
         data.hash = 'create';
         assertDataToParams(data, '_handleGroupListOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-admin-group-list',
           offset: 42,
           filter: null,
@@ -1064,7 +1066,7 @@
       test('_handleGroupListFilterOffsetRoute', () => {
         const data = {params: {filter: 'foo', offset: 42}};
         assertDataToParams(data, '_handleGroupListFilterOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-admin-group-list',
           offset: 42,
           filter: 'foo',
@@ -1074,7 +1076,7 @@
       test('_handleGroupListFilterRoute', () => {
         const data = {params: {filter: 'foo'}};
         assertDataToParams(data, '_handleGroupListFilterRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-admin-group-list',
           filter: 'foo',
         });
@@ -1083,7 +1085,7 @@
       test('_handleGroupRoute', () => {
         const data = {params: {0: 4321}};
         assertDataToParams(data, '_handleGroupRoute', {
-          view: Gerrit.Nav.View.GROUP,
+          view: GerritNav.View.GROUP,
           groupId: 4321,
         });
       });
@@ -1115,7 +1117,7 @@
       test('_handleRepoRoute', () => {
         const data = {params: {0: 4321}};
         assertDataToParams(data, '_handleRepoRoute', {
-          view: Gerrit.Nav.View.REPO,
+          view: GerritNav.View.REPO,
           repo: 4321,
         });
       });
@@ -1123,8 +1125,8 @@
       test('_handleRepoCommandsRoute', () => {
         const data = {params: {0: 4321}};
         assertDataToParams(data, '_handleRepoCommandsRoute', {
-          view: Gerrit.Nav.View.REPO,
-          detail: Gerrit.Nav.RepoDetailView.COMMANDS,
+          view: GerritNav.View.REPO,
+          detail: GerritNav.RepoDetailView.COMMANDS,
           repo: 4321,
         });
       });
@@ -1132,8 +1134,8 @@
       test('_handleRepoAccessRoute', () => {
         const data = {params: {0: 4321}};
         assertDataToParams(data, '_handleRepoAccessRoute', {
-          view: Gerrit.Nav.View.REPO,
-          detail: Gerrit.Nav.RepoDetailView.ACCESS,
+          view: GerritNav.View.REPO,
+          detail: GerritNav.RepoDetailView.ACCESS,
           repo: 4321,
         });
       });
@@ -1142,8 +1144,8 @@
         test('_handleBranchListOffsetRoute', () => {
           const data = {params: {0: 4321}};
           assertDataToParams(data, '_handleBranchListOffsetRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.BRANCHES,
             repo: 4321,
             offset: 0,
             filter: null,
@@ -1151,8 +1153,8 @@
 
           data.params[2] = 42;
           assertDataToParams(data, '_handleBranchListOffsetRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.BRANCHES,
             repo: 4321,
             offset: 42,
             filter: null,
@@ -1162,8 +1164,8 @@
         test('_handleBranchListFilterOffsetRoute', () => {
           const data = {params: {repo: 4321, filter: 'foo', offset: 42}};
           assertDataToParams(data, '_handleBranchListFilterOffsetRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.BRANCHES,
             repo: 4321,
             offset: 42,
             filter: 'foo',
@@ -1173,8 +1175,8 @@
         test('_handleBranchListFilterRoute', () => {
           const data = {params: {repo: 4321, filter: 'foo'}};
           assertDataToParams(data, '_handleBranchListFilterRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.BRANCHES,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.BRANCHES,
             repo: 4321,
             filter: 'foo',
           });
@@ -1185,8 +1187,8 @@
         test('_handleTagListOffsetRoute', () => {
           const data = {params: {0: 4321}};
           assertDataToParams(data, '_handleTagListOffsetRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.TAGS,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.TAGS,
             repo: 4321,
             offset: 0,
             filter: null,
@@ -1196,8 +1198,8 @@
         test('_handleTagListFilterOffsetRoute', () => {
           const data = {params: {repo: 4321, filter: 'foo', offset: 42}};
           assertDataToParams(data, '_handleTagListFilterOffsetRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.TAGS,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.TAGS,
             repo: 4321,
             offset: 42,
             filter: 'foo',
@@ -1207,16 +1209,16 @@
         test('_handleTagListFilterRoute', () => {
           const data = {params: {repo: 4321}};
           assertDataToParams(data, '_handleTagListFilterRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.TAGS,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.TAGS,
             repo: 4321,
             filter: null,
           });
 
           data.params.filter = 'foo';
           assertDataToParams(data, '_handleTagListFilterRoute', {
-            view: Gerrit.Nav.View.REPO,
-            detail: Gerrit.Nav.RepoDetailView.TAGS,
+            view: GerritNav.View.REPO,
+            detail: GerritNav.RepoDetailView.TAGS,
             repo: 4321,
             filter: 'foo',
           });
@@ -1227,7 +1229,7 @@
         test('_handleRepoListOffsetRoute', () => {
           const data = {params: {}};
           assertDataToParams(data, '_handleRepoListOffsetRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             offset: 0,
             filter: null,
@@ -1236,7 +1238,7 @@
 
           data.params[1] = 42;
           assertDataToParams(data, '_handleRepoListOffsetRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             offset: 42,
             filter: null,
@@ -1245,7 +1247,7 @@
 
           data.hash = 'create';
           assertDataToParams(data, '_handleRepoListOffsetRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             offset: 42,
             filter: null,
@@ -1256,7 +1258,7 @@
         test('_handleRepoListFilterOffsetRoute', () => {
           const data = {params: {filter: 'foo', offset: 42}};
           assertDataToParams(data, '_handleRepoListFilterOffsetRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             offset: 42,
             filter: 'foo',
@@ -1266,14 +1268,14 @@
         test('_handleRepoListFilterRoute', () => {
           const data = {params: {}};
           assertDataToParams(data, '_handleRepoListFilterRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             filter: null,
           });
 
           data.params.filter = 'foo';
           assertDataToParams(data, '_handleRepoListFilterRoute', {
-            view: Gerrit.Nav.View.ADMIN,
+            view: GerritNav.View.ADMIN,
             adminView: 'gr-repo-list',
             filter: 'foo',
           });
@@ -1285,7 +1287,7 @@
       test('_handlePluginListOffsetRoute', () => {
         const data = {params: {}};
         assertDataToParams(data, '_handlePluginListOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
           offset: 0,
           filter: null,
@@ -1293,7 +1295,7 @@
 
         data.params[1] = 42;
         assertDataToParams(data, '_handlePluginListOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
           offset: 42,
           filter: null,
@@ -1303,7 +1305,7 @@
       test('_handlePluginListFilterOffsetRoute', () => {
         const data = {params: {filter: 'foo', offset: 42}};
         assertDataToParams(data, '_handlePluginListFilterOffsetRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
           offset: 42,
           filter: 'foo',
@@ -1313,14 +1315,14 @@
       test('_handlePluginListFilterRoute', () => {
         const data = {params: {}};
         assertDataToParams(data, '_handlePluginListFilterRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
           filter: null,
         });
 
         data.params.filter = 'foo';
         assertDataToParams(data, '_handlePluginListFilterRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
           filter: 'foo',
         });
@@ -1329,7 +1331,7 @@
       test('_handlePluginListRoute', () => {
         const data = {params: {}};
         assertDataToParams(data, '_handlePluginListRoute', {
-          view: Gerrit.Nav.View.ADMIN,
+          view: GerritNav.View.ADMIN,
           adminView: 'gr-plugin-list',
         });
       });
@@ -1363,7 +1365,7 @@
           changeNum: 1234,
           basePatchNum: 6,
           patchNum: 9,
-          view: Gerrit.Nav.View.CHANGE,
+          view: GerritNav.View.CHANGE,
           querystring: '',
         });
       });
@@ -1390,7 +1392,7 @@
           changeNum: 1234,
           basePatchNum: 3,
           patchNum: 8,
-          view: Gerrit.Nav.View.DIFF,
+          view: GerritNav.View.DIFF,
           path: 'foo/bar',
           lineNum: 123,
           leftSide: true,
@@ -1453,7 +1455,7 @@
           sandbox.stub(element, '_generateUrl').returns('foo');
           const ctx = makeParams(null, '');
           assertDataToParams(ctx, '_handleChangeRoute', {
-            view: Gerrit.Nav.View.CHANGE,
+            view: GerritNav.View.CHANGE,
             project: 'foo/bar',
             changeNum: 1234,
             basePatchNum: 4,
@@ -1507,7 +1509,7 @@
           sandbox.stub(element, '_generateUrl').returns('foo');
           const ctx = makeParams('foo/bar/baz', 'b44');
           assertDataToParams(ctx, '_handleDiffRoute', {
-            view: Gerrit.Nav.View.DIFF,
+            view: GerritNav.View.DIFF,
             project: 'foo/bar',
             changeNum: 1234,
             basePatchNum: 4,
@@ -1536,7 +1538,7 @@
         const appParams = {
           project: 'foo/bar',
           changeNum: 1234,
-          view: Gerrit.Nav.View.EDIT,
+          view: GerritNav.View.EDIT,
           path: 'foo/bar/baz',
           patchNum: 3,
           lineNum: undefined,
@@ -1566,7 +1568,7 @@
         const appParams = {
           project: 'foo/bar',
           changeNum: 1234,
-          view: Gerrit.Nav.View.EDIT,
+          view: GerritNav.View.EDIT,
           path: 'foo/bar/baz',
           patchNum: 3,
           lineNum: 4,
@@ -1595,7 +1597,7 @@
         const appParams = {
           project: 'foo/bar',
           changeNum: 1234,
-          view: Gerrit.Nav.View.CHANGE,
+          view: GerritNav.View.CHANGE,
           patchNum: 3,
           edit: true,
         };
@@ -1612,7 +1614,7 @@
     test('_handlePluginScreen', () => {
       const ctx = {params: ['foo', 'bar']};
       assertDataToParams(ctx, '_handlePluginScreen', {
-        view: Gerrit.Nav.View.PLUGIN_SCREEN,
+        view: GerritNav.View.PLUGIN_SCREEN,
         plugin: 'foo',
         screen: 'bar',
       });
diff --git a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js
index 305d2c1..dcece30 100644
--- a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js
+++ b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js
@@ -16,7 +16,6 @@
  */
 import '../../../scripts/bundled-polymer.js';
 
-import '../gr-navigation/gr-navigation.js';
 import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
 import '../gr-search-bar/gr-search-bar.js';
 import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
@@ -25,6 +24,7 @@
 import {PolymerElement} from '@polymer/polymer/polymer-element.js';
 import {htmlTemplate} from './gr-smart-search_html.js';
 import {DisplayNameBehavior} from '../../../behaviors/gr-display-name-behavior/gr-display-name-behavior.js';
+import {GerritNav} from '../gr-navigation/gr-navigation.js';
 
 const MAX_AUTOCOMPLETE_RESULTS = 10;
 const SELF_EXPRESSION = 'self';
@@ -78,7 +78,7 @@
   _handleSearch(e) {
     const input = e.detail.inputVal;
     if (input) {
-      Gerrit.Nav.navigateToSearchQuery(input);
+      GerritNav.navigateToSearchQuery(input);
     }
   }