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

Side by Side Diff: chrome/browser/resources/options/personal_options.js

Issue 8503003: Seed test for SyncUI: sign in successfully with mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use makeAndRegisterMockHandler in new ChromeSendWebUITest. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/sync_setup_overlay.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 // State variables.
11 var syncEnabled = false;
12 var syncSetupCompleted = false;
13
14 /** 10 /**
15 * Encapsulated handling of personal options page. 11 * Encapsulated handling of personal options page.
16 * @constructor 12 * @constructor
17 */ 13 */
18 function PersonalOptions() { 14 function PersonalOptions() {
19 OptionsPage.call(this, 'personal', 15 OptionsPage.call(this, 'personal',
20 templateData.personalPageTabTitle, 16 templateData.personalPageTabTitle,
21 'personal-page'); 17 'personal-page');
22 if (cr.isChromeOS) { 18 if (cr.isChromeOS) {
23 // Email of the currently logged in user (or |kGuestUser|). 19 // Email of the currently logged in user (or |kGuestUser|).
24 this.userEmail_ = localStrings.getString('userEmail'); 20 this.userEmail_ = localStrings.getString('userEmail');
25 } 21 }
26 } 22 }
27 23
28 cr.addSingletonGetter(PersonalOptions); 24 cr.addSingletonGetter(PersonalOptions);
29 25
30 PersonalOptions.prototype = { 26 PersonalOptions.prototype = {
31 // Inherit PersonalOptions from OptionsPage. 27 // Inherit PersonalOptions from OptionsPage.
32 __proto__: options.OptionsPage.prototype, 28 __proto__: options.OptionsPage.prototype,
33 29
30 // State variables.
31 syncEnabled: false,
32 syncSetupCompleted: false,
33
34 // Initialize PersonalOptions page. 34 // Initialize PersonalOptions page.
35 initializePage: function() { 35 initializePage: function() {
36 // Call base class implementation to start preference initialization. 36 // Call base class implementation to start preference initialization.
37 OptionsPage.prototype.initializePage.call(this); 37 OptionsPage.prototype.initializePage.call(this);
38 38
39 var self = this; 39 var self = this;
40 40
41 // Sync. 41 // Sync.
42 $('sync-action-link').onclick = function(event) { 42 $('sync-action-link').onclick = function(event) {
43 SyncSetupOverlay.showErrorUI(); 43 SyncSetupOverlay.showErrorUI();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 setThemesResetButtonEnabled_: function(enabled) { 286 setThemesResetButtonEnabled_: function(enabled) {
287 $('themes-reset').disabled = !enabled; 287 $('themes-reset').disabled = !enabled;
288 }, 288 },
289 289
290 hideSyncSection_: function() { 290 hideSyncSection_: function() {
291 $('sync-section').hidden = true; 291 $('sync-section').hidden = true;
292 }, 292 },
293 293
294 /** 294 /**
295 * Get the start/stop sync button DOM element.
296 * @return {DOMElement} The start/stop sync button.
297 * @private
298 */
299 getStartStopSyncButton_: function() {
300 return $('start-stop-sync');
301 },
302
303 /**
295 * (Re)loads IMG element with current user account picture. 304 * (Re)loads IMG element with current user account picture.
296 */ 305 */
297 updateAccountPicture_: function() { 306 updateAccountPicture_: function() {
298 $('account-picture').src = 307 $('account-picture').src =
299 'chrome://userimage/' + this.userEmail_ + 308 'chrome://userimage/' + this.userEmail_ +
300 '?id=' + (new Date()).getTime(); 309 '?id=' + (new Date()).getTime();
301 }, 310 },
302 }; 311 };
303 312
304 /** 313 /**
(...skipping 18 matching lines...) Expand all
323 * Returns email of the user logged in (ChromeOS only). 332 * Returns email of the user logged in (ChromeOS only).
324 * @return {string} user email. 333 * @return {string} user email.
325 */ 334 */
326 PersonalOptions.getLoggedInUserEmail = function() { 335 PersonalOptions.getLoggedInUserEmail = function() {
327 return PersonalOptions.getInstance().userEmail_; 336 return PersonalOptions.getInstance().userEmail_;
328 }; 337 };
329 } 338 }
330 339
331 // Forward public APIs to private implementations. 340 // Forward public APIs to private implementations.
332 [ 341 [
342 'getStartStopSyncButton',
333 'hideSyncSection', 343 'hideSyncSection',
334 'setAutoLoginVisible', 344 'setAutoLoginVisible',
335 'setCustomizeSyncButtonEnabled', 345 'setCustomizeSyncButtonEnabled',
336 'setGtkThemeButtonEnabled', 346 'setGtkThemeButtonEnabled',
337 'setProfilesInfo', 347 'setProfilesInfo',
338 'setProfilesSectionVisible', 348 'setProfilesSectionVisible',
339 'setStartStopButtonEnabled', 349 'setStartStopButtonEnabled',
340 'setStartStopButtonLabel', 350 'setStartStopButtonLabel',
341 'setStartStopButtonVisible', 351 'setStartStopButtonVisible',
342 'setSyncActionLinkEnabled', 352 'setSyncActionLinkEnabled',
343 'setSyncActionLinkLabel', 353 'setSyncActionLinkLabel',
344 'setSyncEnabled', 354 'setSyncEnabled',
345 'setSyncSetupCompleted', 355 'setSyncSetupCompleted',
346 'setSyncStatus', 356 'setSyncStatus',
347 'setSyncStatusErrorVisible', 357 'setSyncStatusErrorVisible',
348 'setThemesResetButtonEnabled', 358 'setThemesResetButtonEnabled',
349 'updateAccountPicture', 359 'updateAccountPicture',
350 ].forEach(function(name) { 360 ].forEach(function(name) {
351 PersonalOptions[name] = function(value) { 361 PersonalOptions[name] = function(value) {
352 PersonalOptions.getInstance()[name + '_'](value); 362 return PersonalOptions.getInstance()[name + '_'](value);
353 }; 363 };
354 }); 364 });
355 365
356 // Export 366 // Export
357 return { 367 return {
358 PersonalOptions: PersonalOptions 368 PersonalOptions: PersonalOptions
359 }; 369 };
360 370
361 }); 371 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/sync_setup_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698