| 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', |
| 11 | 11 |
| 12 behaviors: [settings.GlobalScrollTargetBehavior, WebUIListenerBehavior], | 12 behaviors: [settings.GlobalScrollTargetBehavior, WebUIListenerBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** @type {!Array<!SearchEngine>} */ | 15 /** @type {!Array<!SearchEngine>} */ |
| 16 defaultEngines: { | 16 defaultEngines: { |
| 17 type: Array, | 17 type: Array, |
| 18 value: function() { return []; } | 18 value: function() { |
| 19 return []; |
| 20 } |
| 19 }, | 21 }, |
| 20 | 22 |
| 21 /** @type {!Array<!SearchEngine>} */ | 23 /** @type {!Array<!SearchEngine>} */ |
| 22 otherEngines: { | 24 otherEngines: { |
| 23 type: Array, | 25 type: Array, |
| 24 value: function() { return []; } | 26 value: function() { |
| 27 return []; |
| 28 } |
| 25 }, | 29 }, |
| 26 | 30 |
| 27 /** @type {!Array<!SearchEngine>} */ | 31 /** @type {!Array<!SearchEngine>} */ |
| 28 extensions: { | 32 extensions: { |
| 29 type: Array, | 33 type: Array, |
| 30 value: function() { return []; } | 34 value: function() { |
| 35 return []; |
| 36 } |
| 31 }, | 37 }, |
| 32 | 38 |
| 33 /** | 39 /** |
| 34 * Needed by GlobalScrollTargetBehavior. | 40 * Needed by GlobalScrollTargetBehavior. |
| 35 * @override | 41 * @override |
| 36 */ | 42 */ |
| 37 subpageRoute: { | 43 subpageRoute: { |
| 38 type: Object, | 44 type: Object, |
| 39 value: settings.Route.SEARCH_ENGINES, | 45 value: settings.Route.SEARCH_ENGINES, |
| 40 }, | 46 }, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 /** @private {HTMLElement} */ | 57 /** @private {HTMLElement} */ |
| 52 omniboxExtensionlastFocused_: Object, | 58 omniboxExtensionlastFocused_: Object, |
| 53 }, | 59 }, |
| 54 | 60 |
| 55 // Since the iron-list for extensions is enclosed in a dom-if, observe both | 61 // Since the iron-list for extensions is enclosed in a dom-if, observe both |
| 56 // |extensions| and |showExtensionsList_|. | 62 // |extensions| and |showExtensionsList_|. |
| 57 observers: ['extensionsChanged_(extensions, showExtensionsList_)'], | 63 observers: ['extensionsChanged_(extensions, showExtensionsList_)'], |
| 58 | 64 |
| 59 /** @override */ | 65 /** @override */ |
| 60 ready: function() { | 66 ready: function() { |
| 61 settings.SearchEnginesBrowserProxyImpl.getInstance(). | 67 settings.SearchEnginesBrowserProxyImpl.getInstance() |
| 62 getSearchEnginesList().then(this.enginesChanged_.bind(this)); | 68 .getSearchEnginesList() |
| 69 .then(this.enginesChanged_.bind(this)); |
| 63 this.addWebUIListener( | 70 this.addWebUIListener( |
| 64 'search-engines-changed', this.enginesChanged_.bind(this)); | 71 'search-engines-changed', this.enginesChanged_.bind(this)); |
| 65 | 72 |
| 66 // Sets offset in iron-list that uses the page as a scrollTarget. | 73 // Sets offset in iron-list that uses the page as a scrollTarget. |
| 67 Polymer.RenderStatus.afterNextRender(this, function() { | 74 Polymer.RenderStatus.afterNextRender(this, function() { |
| 68 this.$.otherEngines.scrollOffset = this.$.otherEngines.offsetTop; | 75 this.$.otherEngines.scrollOffset = this.$.otherEngines.offsetTop; |
| 69 }); | 76 }); |
| 70 }, | 77 }, |
| 71 | 78 |
| 72 /** @private */ | 79 /** @private */ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 cr.ui.focusWithoutInk(assert(this.$.addSearchEngine)); | 115 cr.ui.focusWithoutInk(assert(this.$.addSearchEngine)); |
| 109 }.bind(this)); | 116 }.bind(this)); |
| 110 }.bind(this)); | 117 }.bind(this)); |
| 111 }, | 118 }, |
| 112 | 119 |
| 113 /** @private */ | 120 /** @private */ |
| 114 computeShowExtensionsList_: function() { | 121 computeShowExtensionsList_: function() { |
| 115 return this.extensions.length > 0; | 122 return this.extensions.length > 0; |
| 116 }, | 123 }, |
| 117 }); | 124 }); |
| OLD | NEW |