summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.js
blob: a89c03f05e14ee74fcb058d68b3855f575f7a34f (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
44
45
46
47
48
49
50
51
52
// Copyright 2016 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.

/**
 * @fileoverview 'settings-omnibox-extension-entry' is a component for showing
 * an omnibox extension with its name and keyword.
 */
Polymer({
  is: 'settings-omnibox-extension-entry',

  properties: {
    /** @type {!SearchEngine} */
    engine: Object,
  },

  behaviors: [cr.ui.FocusRowBehavior],

  /** @private {?settings.ExtensionControlBrowserProxy} */
  browserProxy_: null,

  /** @override */
  created: function() {
    this.browserProxy_ =
        settings.ExtensionControlBrowserProxyImpl.getInstance();
  },

  /** @private */
  onManageTap_: function() {
    this.closePopupMenu_();
    this.browserProxy_.manageExtension(this.engine.extension.id);
  },

  /** @private */
  onDisableTap_: function() {
    this.closePopupMenu_();
    this.browserProxy_.disableExtension(this.engine.extension.id);
  },

  /** @private */
  closePopupMenu_: function() {
    this.$$('cr-action-menu').close();
  },

  /** @private */
  onDotsTap_: function() {
    /** @type {!CrActionMenuElement} */ (this.$$('cr-action-menu'))
        .showAt(assert(this.$$('cr-icon-button')), {
          anchorAlignmentY: AnchorAlignment.AFTER_END,
        });
  },
});