| OLD | NEW |
| 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-engines-page' is the settings page | 6 * @fileoverview 'settings-search-engines-page' is the settings page |
| 7 * containing search engines settings. | 7 * containing search engines settings. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-search-engines-page', | 10 is: 'settings-search-engines-page', |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 /** @private {boolean} */ | 33 /** @private {boolean} */ |
| 34 showAddSearchEngineDialog_: Boolean, | 34 showAddSearchEngineDialog_: Boolean, |
| 35 | 35 |
| 36 /** @private {boolean} */ | 36 /** @private {boolean} */ |
| 37 showExtensionsList_: { | 37 showExtensionsList_: { |
| 38 type: Boolean, | 38 type: Boolean, |
| 39 computed: 'computeShowExtensionsList_(extensions)', | 39 computed: 'computeShowExtensionsList_(extensions)', |
| 40 } | 40 } |
| 41 }, | 41 }, |
| 42 | 42 |
| 43 // Since the iron-list for extensions is enclosed in a dom-if, observe both |
| 44 // |extensions| and |showExtensionsList_|. |
| 45 observers: ['extensionsChanged_(extensions, showExtensionsList_)'], |
| 46 |
| 43 /** @override */ | 47 /** @override */ |
| 44 ready: function() { | 48 ready: function() { |
| 45 settings.SearchEnginesBrowserProxyImpl.getInstance(). | 49 settings.SearchEnginesBrowserProxyImpl.getInstance(). |
| 46 getSearchEnginesList().then(this.enginesChanged_.bind(this)); | 50 getSearchEnginesList().then(this.enginesChanged_.bind(this)); |
| 47 this.addWebUIListener( | 51 this.addWebUIListener( |
| 48 'search-engines-changed', this.enginesChanged_.bind(this)); | 52 'search-engines-changed', this.enginesChanged_.bind(this)); |
| 49 }, | 53 }, |
| 50 | 54 |
| 55 /** @private */ |
| 56 extensionsChanged_: function() { |
| 57 if (this.showExtensionsList_ && this.$.extensions) |
| 58 this.$.extensions.notifyResize(); |
| 59 }, |
| 60 |
| 51 /** | 61 /** |
| 52 * @param {!SearchEnginesInfo} searchEnginesInfo | 62 * @param {!SearchEnginesInfo} searchEnginesInfo |
| 53 * @private | 63 * @private |
| 54 */ | 64 */ |
| 55 enginesChanged_: function(searchEnginesInfo) { | 65 enginesChanged_: function(searchEnginesInfo) { |
| 56 this.defaultEngines = searchEnginesInfo['defaults']; | 66 this.defaultEngines = searchEnginesInfo['defaults']; |
| 57 this.otherEngines = searchEnginesInfo['others']; | 67 this.otherEngines = searchEnginesInfo['others']; |
| 58 this.extensions = searchEnginesInfo['extensions']; | 68 this.extensions = searchEnginesInfo['extensions']; |
| 59 }, | 69 }, |
| 60 | 70 |
| 61 /** @private */ | 71 /** @private */ |
| 62 onAddSearchEngineTap_: function() { | 72 onAddSearchEngineTap_: function() { |
| 63 this.showAddSearchEngineDialog_ = true; | 73 this.showAddSearchEngineDialog_ = true; |
| 64 this.async(function() { | 74 this.async(function() { |
| 65 var dialog = this.$$('settings-search-engine-dialog'); | 75 var dialog = this.$$('settings-search-engine-dialog'); |
| 66 // Register listener to detect when the dialog is closed. Flip the boolean | 76 // Register listener to detect when the dialog is closed. Flip the boolean |
| 67 // once closed to force a restamp next time it is shown such that the | 77 // once closed to force a restamp next time it is shown such that the |
| 68 // previous dialog's contents are cleared. | 78 // previous dialog's contents are cleared. |
| 69 dialog.addEventListener('close', function() { | 79 dialog.addEventListener('close', function() { |
| 70 this.showAddSearchEngineDialog_ = false; | 80 this.showAddSearchEngineDialog_ = false; |
| 71 }.bind(this)); | 81 }.bind(this)); |
| 72 }.bind(this)); | 82 }.bind(this)); |
| 73 }, | 83 }, |
| 74 | 84 |
| 75 /** @private */ | 85 /** @private */ |
| 76 computeShowExtensionsList_: function() { | 86 computeShowExtensionsList_: function() { |
| 77 return this.extensions.length > 0; | 87 return this.extensions.length > 0; |
| 78 }, | 88 }, |
| 79 }); | 89 }); |
| OLD | NEW |