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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 // Since the iron-list for extensions is enclosed in a dom-if, observe both | 52 // Since the iron-list for extensions is enclosed in a dom-if, observe both |
53 // |extensions| and |showExtensionsList_|. | 53 // |extensions| and |showExtensionsList_|. |
54 observers: ['extensionsChanged_(extensions, showExtensionsList_)'], | 54 observers: ['extensionsChanged_(extensions, showExtensionsList_)'], |
55 | 55 |
56 /** @override */ | 56 /** @override */ |
57 ready: function() { | 57 ready: function() { |
58 settings.SearchEnginesBrowserProxyImpl.getInstance(). | 58 settings.SearchEnginesBrowserProxyImpl.getInstance(). |
59 getSearchEnginesList().then(this.enginesChanged_.bind(this)); | 59 getSearchEnginesList().then(this.enginesChanged_.bind(this)); |
60 this.addWebUIListener( | 60 this.addWebUIListener( |
61 'search-engines-changed', this.enginesChanged_.bind(this)); | 61 'search-engines-changed', this.enginesChanged_.bind(this)); |
62 | |
63 // Sets offset in iron-list that uses the page as a scrollTarget. | |
64 // The scrollTarget doesn't know about headers and items above the list. | |
65 Polymer.RenderStatus.afterNextRender(this, function() { | |
66 // Size of headers is constant, but defaultEngines size can vary. | |
67 this.$.otherEngines.scrollOffset = 184 + | |
Dan Beam
2017/04/07 23:32:53
this looks brittle, where does the 184 come from?
hcarmona
2017/04/08 00:02:01
Agreed, for parts that are in this file, I can add
Dan Beam
2017/04/08 00:09:44
offsetTop
hcarmona
2017/04/08 00:24:40
Sweet. Done.
| |
68 this.$.defaultEngines.getBoundingClientRect().height; | |
69 }); | |
62 }, | 70 }, |
63 | 71 |
64 /** @private */ | 72 /** @private */ |
65 extensionsChanged_: function() { | 73 extensionsChanged_: function() { |
66 if (this.showExtensionsList_ && this.$.extensions) | 74 if (this.showExtensionsList_ && this.$.extensions) |
67 this.$.extensions.notifyResize(); | 75 this.$.extensions.notifyResize(); |
68 }, | 76 }, |
69 | 77 |
70 /** | 78 /** |
71 * @param {!SearchEnginesInfo} searchEnginesInfo | 79 * @param {!SearchEnginesInfo} searchEnginesInfo |
(...skipping 22 matching lines...) Expand all Loading... | |
94 this.$.addSearchEngine.focus(); | 102 this.$.addSearchEngine.focus(); |
95 }.bind(this)); | 103 }.bind(this)); |
96 }.bind(this)); | 104 }.bind(this)); |
97 }, | 105 }, |
98 | 106 |
99 /** @private */ | 107 /** @private */ |
100 computeShowExtensionsList_: function() { | 108 computeShowExtensionsList_: function() { |
101 return this.extensions.length > 0; | 109 return this.extensions.length > 0; |
102 }, | 110 }, |
103 }); | 111 }); |
OLD | NEW |