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 (function() { | 5 (function() { |
6 | 6 |
7 /** | 7 /** |
8 * Names of the radio buttons which allow the user to choose their encryption | 8 * Names of the radio buttons which allow the user to choose their encryption |
9 * mechanism. | 9 * mechanism. |
10 * @enum {string} | 10 * @enum {string} |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 this.browserProxy_ = settings.SyncBrowserProxyImpl.getInstance(); | 133 this.browserProxy_ = settings.SyncBrowserProxyImpl.getInstance(); |
134 }, | 134 }, |
135 | 135 |
136 /** @override */ | 136 /** @override */ |
137 attached: function() { | 137 attached: function() { |
138 this.addWebUIListener( | 138 this.addWebUIListener( |
139 'page-status-changed', this.handlePageStatusChanged_.bind(this)); | 139 'page-status-changed', this.handlePageStatusChanged_.bind(this)); |
140 this.addWebUIListener( | 140 this.addWebUIListener( |
141 'sync-prefs-changed', this.handleSyncPrefsChanged_.bind(this)); | 141 'sync-prefs-changed', this.handleSyncPrefsChanged_.bind(this)); |
142 | 142 |
143 if (settings.getCurrentRoute() == settings.Route.SYNC) | 143 if (settings.getCurrentRoute() == settings.routes.SYNC) |
144 this.onNavigateToPage_(); | 144 this.onNavigateToPage_(); |
145 }, | 145 }, |
146 | 146 |
147 /** @override */ | 147 /** @override */ |
148 detached: function() { | 148 detached: function() { |
149 if (settings.getCurrentRoute() == settings.Route.SYNC) | 149 if (settings.getCurrentRoute() == settings.routes.SYNC) |
150 this.onNavigateAwayFromPage_(); | 150 this.onNavigateAwayFromPage_(); |
151 }, | 151 }, |
152 | 152 |
153 /** @protected */ | 153 /** @protected */ |
154 currentRouteChanged: function() { | 154 currentRouteChanged: function() { |
155 if (settings.getCurrentRoute() == settings.Route.SYNC) | 155 if (settings.getCurrentRoute() == settings.routes.SYNC) |
156 this.onNavigateToPage_(); | 156 this.onNavigateToPage_(); |
157 else | 157 else |
158 this.onNavigateAwayFromPage_(); | 158 this.onNavigateAwayFromPage_(); |
159 }, | 159 }, |
160 | 160 |
161 /** | 161 /** |
162 * @param {!settings.PageStatus} expectedPageStatus | 162 * @param {!settings.PageStatus} expectedPageStatus |
163 * @return {boolean} | 163 * @return {boolean} |
164 * @private | 164 * @private |
165 */ | 165 */ |
166 isStatus_: function(expectedPageStatus) { | 166 isStatus_: function(expectedPageStatus) { |
167 return expectedPageStatus == this.pageStatus_; | 167 return expectedPageStatus == this.pageStatus_; |
168 }, | 168 }, |
169 | 169 |
170 /** @private */ | 170 /** @private */ |
171 onNavigateToPage_: function() { | 171 onNavigateToPage_: function() { |
172 assert(settings.getCurrentRoute() == settings.Route.SYNC); | 172 assert(settings.getCurrentRoute() == settings.routes.SYNC); |
173 | 173 |
174 if (this.unloadCallback_) | 174 if (this.unloadCallback_) |
175 return; | 175 return; |
176 | 176 |
177 // Display loading page until the settings have been retrieved. | 177 // Display loading page until the settings have been retrieved. |
178 this.pageStatus_ = settings.PageStatus.SPINNER; | 178 this.pageStatus_ = settings.PageStatus.SPINNER; |
179 | 179 |
180 this.browserProxy_.didNavigateToSyncPage(); | 180 this.browserProxy_.didNavigateToSyncPage(); |
181 | 181 |
182 this.unloadCallback_ = this.onNavigateAwayFromPage_.bind(this); | 182 this.unloadCallback_ = this.onNavigateAwayFromPage_.bind(this); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 * @private | 343 * @private |
344 */ | 344 */ |
345 handlePageStatusChanged_: function(pageStatus) { | 345 handlePageStatusChanged_: function(pageStatus) { |
346 switch (pageStatus) { | 346 switch (pageStatus) { |
347 case settings.PageStatus.SPINNER: | 347 case settings.PageStatus.SPINNER: |
348 case settings.PageStatus.TIMEOUT: | 348 case settings.PageStatus.TIMEOUT: |
349 case settings.PageStatus.CONFIGURE: | 349 case settings.PageStatus.CONFIGURE: |
350 this.pageStatus_ = pageStatus; | 350 this.pageStatus_ = pageStatus; |
351 return; | 351 return; |
352 case settings.PageStatus.DONE: | 352 case settings.PageStatus.DONE: |
353 if (settings.getCurrentRoute() == settings.Route.SYNC) | 353 if (settings.getCurrentRoute() == settings.routes.SYNC) |
354 settings.navigateTo(settings.Route.PEOPLE); | 354 settings.navigateTo(settings.routes.PEOPLE); |
355 return; | 355 return; |
356 case settings.PageStatus.PASSPHRASE_FAILED: | 356 case settings.PageStatus.PASSPHRASE_FAILED: |
357 if (this.pageStatus_ == this.pages_.CONFIGURE && this.syncPrefs && | 357 if (this.pageStatus_ == this.pages_.CONFIGURE && this.syncPrefs && |
358 this.syncPrefs.passphraseRequired) { | 358 this.syncPrefs.passphraseRequired) { |
359 this.$$('#existingPassphraseInput').invalid = true; | 359 this.$$('#existingPassphraseInput').invalid = true; |
360 } | 360 } |
361 return; | 361 return; |
362 } | 362 } |
363 | 363 |
364 assertNotReached(); | 364 assertNotReached(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 onLearnMoreTap_: function(event) { | 438 onLearnMoreTap_: function(event) { |
439 if (event.target.tagName == 'A') { | 439 if (event.target.tagName == 'A') { |
440 // Stop the propagation of events, so that clicking on links inside | 440 // Stop the propagation of events, so that clicking on links inside |
441 // checkboxes or radio buttons won't change the value. | 441 // checkboxes or radio buttons won't change the value. |
442 event.stopPropagation(); | 442 event.stopPropagation(); |
443 } | 443 } |
444 } | 444 } |
445 }); | 445 }); |
446 | 446 |
447 })(); | 447 })(); |
OLD | NEW |