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

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

Issue 1666623006: MD Settings: Manage search engines 3/3, hooking up UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manage_search_engines_handler
Patch Set: Addressing comments. Created 4 years, 10 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 * @group Chrome Settings Elements 9 * @group Chrome Settings Elements
10 * @element settings-search-engine-entry 10 * @element settings-search-engine-entry
11 */ 11 */
12 Polymer({ 12 Polymer({
13 is: 'settings-search-engine-entry', 13 is: 'settings-search-engine-entry',
14 14
15 properties: { 15 properties: {
16 /** @type {!SearchEngine} */ 16 /** @type {!SearchEngine} */
17 engine: Object 17 engine: Object,
18
19 /** @type {boolean} */
20 showEditSearchEngineDialog_: Boolean,
21 },
22
23 /** @private {!settings.SearchEnginesBrowserProxy} */
24 browserProxy_: null,
25
26 attached: function() {
27 this.browserProxy_ = settings.SearchEnginesBrowserProxy.getInstance();
18 }, 28 },
19 29
20 /** @private */ 30 /** @private */
21 onDeleteTap_: function() { 31 onDeleteTap_: function() {
22 chrome.searchEnginesPrivate.removeSearchEngine(this.engine.guid); 32 this.browserProxy_.removeSearchEngine(this.engine.modelIndex);
23 }, 33 },
24 34
25 /** @private */ 35 /** @private */
26 onEditTap_: function() { 36 onEditTap_: function() {
27 // TODO(dpapad): Implement edit mode. 37 this.closePopupMenu_();
38
39 this.showEditSearchEngineDialog_ = true;
40 this.async(function() {
41 var dialog = this.$$('settings-search-engine-dialog');
42 // Register listener to detect when the dialog is closed. Flip the boolean
43 // once closed to force a restamp next time it is shown such that the
44 // previous dialog's contents are cleared.
45 dialog.addEventListener('iron-overlay-closed', function() {
46 this.showEditSearchEngineDialog_ = false;
47 }.bind(this));
48 }.bind(this));
28 }, 49 },
29 50
30 /** @private */ 51 /** @private */
31 onMakeDefaultTap_: function() { 52 onMakeDefaultTap_: function() {
32 chrome.searchEnginesPrivate.setSelectedSearchEngine(this.engine.guid); 53 this.closePopupMenu_();
33 var popupMenu = this.$$('iron-dropdown'); 54 this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex);
34 popupMenu.close(); 55 },
56
57 closePopupMenu_: function() {
58 this.$$('iron-dropdown').close();
35 }, 59 },
36 }); 60 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698