Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/resources/settings/people_page/sync_page.js

Issue 2230833003: MD Settings: Remove iron-pages usage from <settings-sync-page>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 his encryption 8 * Names of the radio buttons which allow the user to choose his encryption
9 * mechanism. 9 * mechanism.
10 * @enum {string} 10 * @enum {string}
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 properties: { 55 properties: {
56 /** @private */ 56 /** @private */
57 pages: { 57 pages: {
58 type: Object, 58 type: Object,
59 value: settings.PageStatus, 59 value: settings.PageStatus,
60 readOnly: true, 60 readOnly: true,
61 }, 61 },
62 62
63 /** 63 /**
64 * The curerntly displayed page. 64 * The curernt page status.
tommycli 2016/08/11 22:14:28 nit: typo
dpapad 2016/08/11 23:00:49 Fixed.
65 * @private {?settings.PageStatus} 65 * @private {?settings.PageStatus}
66 */ 66 */
67 selectedPage_: { 67 pageStatus_: {
68 type: String, 68 type: String,
69 value: settings.PageStatus.SPINNER, 69 value: settings.PageStatus.SPINNER,
70 }, 70 },
71 71
72 /** 72 /**
73 * The current sync preferences, supplied by SyncBrowserProxy. 73 * The current sync preferences, supplied by SyncBrowserProxy.
74 * @type {settings.SyncPrefs|undefined} 74 * @type {settings.SyncPrefs|undefined}
75 */ 75 */
76 syncPrefs: { 76 syncPrefs: {
77 type: Object, 77 type: Object,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 }, 117 },
118 }, 118 },
119 119
120 /** @override */ 120 /** @override */
121 attached: function() { 121 attached: function() {
122 this.addWebUIListener('page-status-changed', 122 this.addWebUIListener('page-status-changed',
123 this.handlePageStatusChanged_.bind(this)); 123 this.handlePageStatusChanged_.bind(this));
124 this.addWebUIListener('sync-prefs-changed', 124 this.addWebUIListener('sync-prefs-changed',
125 this.handleSyncPrefsChanged_.bind(this)); 125 this.handleSyncPrefsChanged_.bind(this));
126 126
127 if (settings.getCurrentRoute() == settings.Route.SYNC) 127 //if (settings.getCurrentRoute() == settings.Route.SYNC)
dpapad 2016/08/11 01:25:20 Tommy, I commented out lines 127 and line 161 beca
tommycli 2016/08/11 22:14:28 Fuuu I think that would be bad... I think I need t
dpapad 2016/08/11 23:00:49 Per our discussion, when the didNavigateToSyncPage
128 this.onNavigateToPage_(); 128 this.onNavigateToPage_();
129 }, 129 },
130 130
131 /** @override */ 131 /** @override */
132 detached: function() { 132 detached: function() {
133 if (settings.getCurrentRoute() == settings.Route.SYNC) 133 if (settings.getCurrentRoute() == settings.Route.SYNC)
134 this.onNavigateAwayFromPage_(); 134 this.onNavigateAwayFromPage_();
135 }, 135 },
136 136
137 /** @protected */ 137 /** @protected */
138 currentRouteChanged: function() { 138 currentRouteChanged: function() {
139 if (!this.isAttached) 139 if (!this.isAttached)
140 return; 140 return;
141 141
142 if (settings.getCurrentRoute() == settings.Route.SYNC) 142 if (settings.getCurrentRoute() == settings.Route.SYNC)
143 this.onNavigateToPage_(); 143 this.onNavigateToPage_();
144 else 144 else
145 this.onNavigateAwayFromPage_(); 145 this.onNavigateAwayFromPage_();
146 }, 146 },
147 147
148 /**
149 * @param {!settings.PageStatus} pageStatus
150 * @return {boolean}
151 * @private
152 */
153 isStatus_: function(pageStatus) {
154 return pageStatus == this.pageStatus_;
155 },
156
148 /** @private */ 157 /** @private */
149 onNavigateToPage_: function() { 158 onNavigateToPage_: function() {
150 // The element is not ready for C++ interaction until it is attached. 159 // The element is not ready for C++ interaction until it is attached.
151 assert(this.isAttached); 160 assert(this.isAttached);
152 assert(settings.getCurrentRoute() == settings.Route.SYNC); 161 //assert(settings.getCurrentRoute() == settings.Route.SYNC);
153 162
154 if (this.unloadCallback_) 163 if (this.unloadCallback_)
155 return; 164 return;
156 165
157 // Display loading page until the settings have been retrieved. 166 // Display loading page until the settings have been retrieved.
158 this.selectedPage_ = settings.PageStatus.SPINNER; 167 this.pageStatus_ = settings.PageStatus.SPINNER;
159 168
160 this.browserProxy_.didNavigateToSyncPage(); 169 this.browserProxy_.didNavigateToSyncPage();
161 170
162 this.unloadCallback_ = this.onNavigateAwayFromPage_.bind(this); 171 this.unloadCallback_ = this.onNavigateAwayFromPage_.bind(this);
163 window.addEventListener('unload', this.unloadCallback_); 172 window.addEventListener('unload', this.unloadCallback_);
164 }, 173 },
165 174
166 /** @private */ 175 /** @private */
167 onNavigateAwayFromPage_: function() { 176 onNavigateAwayFromPage_: function() {
168 if (!this.unloadCallback_) 177 if (!this.unloadCallback_)
169 return; 178 return;
170 179
171 this.browserProxy_.didNavigateAwayFromSyncPage(); 180 this.browserProxy_.didNavigateAwayFromSyncPage();
172 181
173 window.removeEventListener('unload', this.unloadCallback_); 182 window.removeEventListener('unload', this.unloadCallback_);
174 this.unloadCallback_ = null; 183 this.unloadCallback_ = null;
175 }, 184 },
176 185
177 /** 186 /**
178 * Handler for when the sync preferences are updated. 187 * Handler for when the sync preferences are updated.
179 * @private 188 * @private
180 */ 189 */
181 handleSyncPrefsChanged_: function(syncPrefs) { 190 handleSyncPrefsChanged_: function(syncPrefs) {
182 this.syncPrefs = syncPrefs; 191 this.syncPrefs = syncPrefs;
183 this.selectedPage_ = settings.PageStatus.CONFIGURE; 192 this.pageStatus_ = settings.PageStatus.CONFIGURE;
184 193
185 // If autofill is not registered or synced, force Payments integration off. 194 // If autofill is not registered or synced, force Payments integration off.
186 if (!this.syncPrefs.autofillRegistered || !this.syncPrefs.autofillSynced) 195 if (!this.syncPrefs.autofillRegistered || !this.syncPrefs.autofillSynced)
187 this.set('syncPrefs.paymentsIntegrationEnabled', false); 196 this.set('syncPrefs.paymentsIntegrationEnabled', false);
188 197
189 // Hide the new passphrase box if the sync data has been encrypted. 198 // Hide the new passphrase box if the sync data has been encrypted.
190 if (this.syncPrefs.encryptAllData) 199 if (this.syncPrefs.encryptAllData)
191 this.creatingNewPassphrase_ = false; 200 this.creatingNewPassphrase_ = false;
192 }, 201 },
193 202
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 /** 293 /**
285 * Called when the page status updates. 294 * Called when the page status updates.
286 * @param {!settings.PageStatus} pageStatus 295 * @param {!settings.PageStatus} pageStatus
287 * @private 296 * @private
288 */ 297 */
289 handlePageStatusChanged_: function(pageStatus) { 298 handlePageStatusChanged_: function(pageStatus) {
290 switch (pageStatus) { 299 switch (pageStatus) {
291 case settings.PageStatus.SPINNER: 300 case settings.PageStatus.SPINNER:
292 case settings.PageStatus.TIMEOUT: 301 case settings.PageStatus.TIMEOUT:
293 case settings.PageStatus.CONFIGURE: 302 case settings.PageStatus.CONFIGURE:
294 this.selectedPage_ = pageStatus; 303 this.pageStatus_ = pageStatus;
295 return; 304 return;
296 case settings.PageStatus.DONE: 305 case settings.PageStatus.DONE:
297 if (settings.getCurrentRoute() == settings.Route.SYNC) 306 if (settings.getCurrentRoute() == settings.Route.SYNC)
298 settings.navigateTo(settings.Route.PEOPLE); 307 settings.navigateTo(settings.Route.PEOPLE);
299 return; 308 return;
300 case settings.PageStatus.PASSPHRASE_FAILED: 309 case settings.PageStatus.PASSPHRASE_FAILED:
301 if (this.selectedPage_ == this.pages.CONFIGURE && 310 if (this.pageStatus_ == this.pages.CONFIGURE &&
302 this.syncPrefs && this.syncPrefs.passphraseRequired) { 311 this.syncPrefs && this.syncPrefs.passphraseRequired) {
303 this.$$('#existingPassphraseInput').invalid = true; 312 this.$$('#existingPassphraseInput').invalid = true;
304 } 313 }
305 return; 314 return;
306 } 315 }
307 316
308 assertNotReached(); 317 assertNotReached();
309 }, 318 },
310 319
311 /** 320 /**
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 386
378 passphraseInput.invalid = emptyPassphrase; 387 passphraseInput.invalid = emptyPassphrase;
379 passphraseConfirmationInput.invalid = 388 passphraseConfirmationInput.invalid =
380 !emptyPassphrase && mismatchedPassphrase; 389 !emptyPassphrase && mismatchedPassphrase;
381 390
382 return !emptyPassphrase && !mismatchedPassphrase; 391 return !emptyPassphrase && !mismatchedPassphrase;
383 }, 392 },
384 }); 393 });
385 394
386 })(); 395 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698