summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/extensions/sidebar.js
blob: 19619f179120167a55c6b35fe18da7d86f39eb12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('extensions', function() {
  const Sidebar = Polymer({
    is: 'extensions-sidebar',

    properties: {
      isSupervised: Boolean,
    },

    hostAttributes: {
      role: 'navigation',
    },

    /** @override */
    attached: function() {
      this.$.sectionMenu.select(
          extensions.navigation.getCurrentPage().page ==
                  extensions.Page.SHORTCUTS ?
              1 :
              0);
    },

    /**
     * @param {!Event} e
     * @private
     */
    onLinkTap_: function(e) {
      e.preventDefault();
      extensions.navigation.navigateTo({page: e.target.dataset.path});
      this.fire('close-drawer');
    },

    /** @private */
    onMoreExtensionsTap_: function() {
      assert(!this.isSupervised);
      chrome.metricsPrivate.recordUserAction('Options_GetMoreExtensions');
    },
  });

  return {Sidebar: Sidebar};
});