| 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 * @typedef {{about: boolean, settings: boolean}} | 6 * @typedef {{about: boolean, settings: boolean}} |
| 7 */ | 7 */ |
| 8 var MainPageVisibility; | 8 var MainPageVisibility; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 value: false, | 69 value: false, |
| 70 notify: true, | 70 notify: true, |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Dictionary defining page visibility. | 74 * Dictionary defining page visibility. |
| 75 * @type {!GuestModePageVisibility} | 75 * @type {!GuestModePageVisibility} |
| 76 */ | 76 */ |
| 77 pageVisibility: { | 77 pageVisibility: { |
| 78 type: Object, | 78 type: Object, |
| 79 value: function() { return {}; }, | 79 value: function() { |
| 80 return {}; |
| 81 }, |
| 80 }, | 82 }, |
| 81 | 83 |
| 82 showAndroidApps: Boolean, | 84 showAndroidApps: Boolean, |
| 83 }, | 85 }, |
| 84 | 86 |
| 85 /** @override */ | 87 /** @override */ |
| 86 attached: function() { | 88 attached: function() { |
| 87 this.listen(this, 'freeze-scroll', 'onFreezeScroll_'); | 89 this.listen(this, 'freeze-scroll', 'onFreezeScroll_'); |
| 88 }, | 90 }, |
| 89 | 91 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 115 * @private | 117 * @private |
| 116 */ | 118 */ |
| 117 setOverscroll_: function(opt_minHeight) { | 119 setOverscroll_: function(opt_minHeight) { |
| 118 var scroller = this.offsetParent; | 120 var scroller = this.offsetParent; |
| 119 if (!scroller) | 121 if (!scroller) |
| 120 return; | 122 return; |
| 121 var overscroll = this.$.overscroll; | 123 var overscroll = this.$.overscroll; |
| 122 var visibleBottom = scroller.scrollTop + scroller.clientHeight; | 124 var visibleBottom = scroller.scrollTop + scroller.clientHeight; |
| 123 var overscrollBottom = overscroll.offsetTop + overscroll.scrollHeight; | 125 var overscrollBottom = overscroll.offsetTop + overscroll.scrollHeight; |
| 124 // How much of the overscroll is visible (may be negative). | 126 // How much of the overscroll is visible (may be negative). |
| 125 var visibleOverscroll = overscroll.scrollHeight - | 127 var visibleOverscroll = |
| 126 (overscrollBottom - visibleBottom); | 128 overscroll.scrollHeight - (overscrollBottom - visibleBottom); |
| 127 this.overscroll_ = Math.max(opt_minHeight || 0, visibleOverscroll); | 129 this.overscroll_ = Math.max(opt_minHeight || 0, visibleOverscroll); |
| 128 }, | 130 }, |
| 129 | 131 |
| 130 /** | 132 /** |
| 131 * Enables or disables user scrolling, via overscroll: hidden. Room for the | 133 * Enables or disables user scrolling, via overscroll: hidden. Room for the |
| 132 * hidden scrollbar is added to prevent the page width from changing back and | 134 * hidden scrollbar is added to prevent the page width from changing back and |
| 133 * forth. Also freezes the overscroll height. | 135 * forth. Also freezes the overscroll height. |
| 134 * @param {!Event} e |e.detail| is true to freeze, false to unfreeze. | 136 * @param {!Event} e |e.detail| is true to freeze, false to unfreeze. |
| 135 * @private | 137 * @private |
| 136 */ | 138 */ |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return Math.max(0, this.offsetParent.clientHeight - distance); | 224 return Math.max(0, this.offsetParent.clientHeight - distance); |
| 223 }, | 225 }, |
| 224 | 226 |
| 225 /** | 227 /** |
| 226 * Returns the root page (if it exists) for a route. | 228 * Returns the root page (if it exists) for a route. |
| 227 * @param {!settings.Route} route | 229 * @param {!settings.Route} route |
| 228 * @return {(?SettingsAboutPageElement|?SettingsBasicPageElement)} | 230 * @return {(?SettingsAboutPageElement|?SettingsBasicPageElement)} |
| 229 */ | 231 */ |
| 230 getPage_: function(route) { | 232 getPage_: function(route) { |
| 231 if (settings.Route.ABOUT.contains(route)) { | 233 if (settings.Route.ABOUT.contains(route)) { |
| 232 return /** @type {?SettingsAboutPageElement} */( | 234 return /** @type {?SettingsAboutPageElement} */ ( |
| 233 this.$$('settings-about-page')); | 235 this.$$('settings-about-page')); |
| 234 } | 236 } |
| 235 if (settings.Route.BASIC.contains(route) || | 237 if (settings.Route.BASIC.contains(route) || |
| 236 settings.Route.ADVANCED.contains(route)) { | 238 settings.Route.ADVANCED.contains(route)) { |
| 237 return /** @type {?SettingsBasicPageElement} */( | 239 return /** @type {?SettingsBasicPageElement} */ ( |
| 238 this.$$('settings-basic-page')); | 240 this.$$('settings-basic-page')); |
| 239 } | 241 } |
| 240 assertNotReached(); | 242 assertNotReached(); |
| 241 }, | 243 }, |
| 242 | 244 |
| 243 /** | 245 /** |
| 244 * @param {string} query | 246 * @param {string} query |
| 245 * @return {!Promise} A promise indicating that searching finished. | 247 * @return {!Promise} A promise indicating that searching finished. |
| 246 */ | 248 */ |
| 247 searchContents: function(query) { | 249 searchContents: function(query) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 264 | 266 |
| 265 this.toolbarSpinnerActive = false; | 267 this.toolbarSpinnerActive = false; |
| 266 this.inSearchMode_ = !request.isSame(''); | 268 this.inSearchMode_ = !request.isSame(''); |
| 267 this.showNoResultsFound_ = | 269 this.showNoResultsFound_ = |
| 268 this.inSearchMode_ && !request.didFindMatches(); | 270 this.inSearchMode_ && !request.didFindMatches(); |
| 269 }.bind(this)); | 271 }.bind(this)); |
| 270 }.bind(this), 0); | 272 }.bind(this), 0); |
| 271 }.bind(this)); | 273 }.bind(this)); |
| 272 }, | 274 }, |
| 273 }); | 275 }); |
| OLD | NEW |