Chromium Code Reviews| Index: chrome/browser/resources/settings/search_engines_page/search_engine_entry.js |
| diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js |
| index 12f7d82c85e7588448bea2b2e05a25ce4c29cc32..68529dae712f7a9d9bb9c75ec9f6ee5558497b39 100644 |
| --- a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js |
| +++ b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js |
| @@ -13,15 +13,24 @@ Polymer({ |
| /** @type {!SearchEngine} */ |
| engine: Object, |
| - /** @private {boolean} */ |
| - showEditSearchEngineDialog_: Boolean, |
| - |
| /** @type {boolean} */ |
| isDefault: { |
| reflectToAttribute: true, |
| type: Boolean, |
| computed: 'computeIsDefault_(engine)' |
| }, |
| + |
| + /** @private {boolean} */ |
| + showDots_: { |
| + reflectToAttribute: true, |
| + type: Boolean, |
| + computed: 'computeShowDots_(engine.canBeDefault,' + |
|
dpapad
2016/11/23 19:59:54
Could this be computeShowDots_(engine.*) instead?
Dan Beam
2016/12/01 06:21:52
Acknowledged.
|
| + 'engine.canBeEdited,' + |
| + 'engine.canBeRemoved)', |
| + }, |
| + |
| + /** @private {boolean} */ |
| + showEditSearchEngineDialog_: Boolean, |
| }, |
| /** @private {settings.SearchEnginesBrowserProxy} */ |
| @@ -32,6 +41,11 @@ Polymer({ |
| this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance(); |
| }, |
| + /** @private */ |
| + closePopupMenu_: function() { |
| + this.$$('dialog[is=cr-action-menu]').close(); |
| + }, |
| + |
| /** |
| * @return {boolean} |
| * @private |
| @@ -40,6 +54,27 @@ Polymer({ |
| return this.engine.default; |
| }, |
| + /** |
| + * @param {boolean} canBeDefault |
| + * @param {boolean} canBeEdited |
| + * @param {boolean} canBeRemoved |
| + * @return {boolean} Whether to show the dots menu. |
| + * @private |
| + */ |
| + computeShowDots_: function(canBeDefault, canBeEdited, canBeRemoved) { |
| + return canBeDefault || canBeEdited || canBeRemoved; |
|
dpapad
2016/11/23 19:59:54
Related to previous comment, you could simplify th
Dan Beam
2016/12/01 06:21:52
Acknowledged.
|
| + }, |
| + |
| + /** |
| + * @param {?string} url The icon URL if available. |
| + * @return {string} A set of icon URLs. |
| + * @private |
| + */ |
| + getIconSet_: function(url) { |
| + // Force default icon, if no |engine.iconURL| is available. |
| + return cr.icon.getFavicon(url || ''); |
| + }, |
| + |
| /** @private */ |
| onDeleteTap_: function() { |
| this.browserProxy_.removeSearchEngine(this.engine.modelIndex); |
| @@ -47,6 +82,13 @@ Polymer({ |
| }, |
| /** @private */ |
| + onDotsTap_: function() { |
| + /** @type {!CrActionMenuElement} */ ( |
| + this.$$('dialog[is=cr-action-menu]')).showAt( |
| + assert(this.$$('paper-icon-button'))); |
| + }, |
| + |
| + /** @private */ |
| onEditTap_: function() { |
| this.closePopupMenu_(); |
| @@ -67,26 +109,4 @@ Polymer({ |
| this.closePopupMenu_(); |
| this.browserProxy_.setDefaultSearchEngine(this.engine.modelIndex); |
| }, |
| - |
| - /** @private */ |
| - closePopupMenu_: function() { |
| - this.$$('dialog[is=cr-action-menu]').close(); |
| - }, |
| - |
| - /** |
| - * @param {?string} url The icon URL if available. |
| - * @return {string} A set of icon URLs. |
| - * @private |
| - */ |
| - getIconSet_: function(url) { |
| - // Force default icon, if no |engine.iconURL| is available. |
| - return cr.icon.getFavicon(url || ''); |
| - }, |
| - |
| - /** @private */ |
| - onDotsTap_: function() { |
| - /** @type {!CrActionMenuElement} */ ( |
| - this.$$('dialog[is=cr-action-menu]')).showAt( |
| - assert(this.$$('paper-icon-button'))); |
| - }, |
| }); |