Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/browser/resources/settings/search_engines_page/search_engine_entry.js

Issue 2331423008: MD Settings: Search Engines: Move dropdown menu to search_engines_list (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 'settings-search-engine-entry' is a component for showing a 6 * @fileoverview 'settings-search-engine-entry' is a component for showing a
7 * search engine with its name, domain and query URL. 7 * search engine with its name, domain and query URL.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-search-engine-entry', 10 is: 'settings-search-engine-entry',
11 11
12 properties: { 12 properties: {
13 /** @type {!SearchEngine} */ 13 /** @type {!SearchEngine} */
14 engine: Object, 14 engine: Object,
15
16 /** @private {boolean} */
17 showEditSearchEngineDialog_: Boolean,
18
19 /** @type {boolean} */
20 isDefault: {
21 reflectToAttribute: true,
22 type: Boolean,
23 computed: 'computeIsDefault_(engine)'
24 },
25 },
26
27 /** @private {settings.SearchEnginesBrowserProxy} */
28 browserProxy_: null,
29
30 /** @override */
31 created: function() {
32 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance();
33 }, 15 },
34 16
35 /** 17 /**
36 * @return {boolean}
37 * @private
38 */
39 computeIsDefault_: function() {
40 return this.engine.default;
41 },
42
43 /** @private */
44 onDeleteTap_: function() {
45 this.browserProxy_.removeSearchEngine(this.engine.modelIndex);
46 },
47
48 /** @private */
49 onEditTap_: function() {
50 this.closePopupMenu_();
51
52 this.showEditSearchEngineDialog_ = true;
53 this.async(function() {
54 var dialog = this.$$('settings-search-engine-dialog');
55 // Register listener to detect when the dialog is closed. Flip the boolean
56 // once closed to force a restamp next time it is shown such that the
57 // previous dialog's contents are cleared.
58 dialog.addEventListener('close', function() {
59 this.showEditSearchEngineDialog_ = false;
60 }.bind(this));
61 }.bind(this));
62 },
63
64 /** @private */
65 onMakeDefaultTap_: function() {
66 this.closePopupMenu_();
67 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex);
68 },
69
70 /** @private */
71 closePopupMenu_: function() {
72 this.$$('iron-dropdown').close();
73 },
74
75 /**
76 * @param {?string} url The icon URL if available. 18 * @param {?string} url The icon URL if available.
77 * @return {string} A set of icon URLs. 19 * @return {string} A set of icon URLs.
78 * @private 20 * @private
79 */ 21 */
80 getIconSet_: function(url) { 22 getIconSet_: function(url) {
81 // Force default icon, if no |engine.iconURL| is available. 23 // Force default icon, if no |engine.iconURL| is available.
82 return cr.icon.getFavicon(url || ''); 24 return cr.icon.getFavicon(url || '');
83 }, 25 },
26
27 /** @private */
28 onOpenMenuTap_() {
29 this.fire('open-menu', this.engine);
30 },
84 }); 31 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698