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

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

Issue 1900913002: Settings People Revamp: Split Profile Info out into its own handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 cr.exportPath('settings'); 5 cr.exportPath('settings');
6 6
7 /** 7 /**
8 * The state of sync. This is the data structure sent back and forth between 8 * The state of sync. This is the data structure sent back and forth between
9 * C++ and JS. Its naming and structure is not optimal, but changing it would 9 * C++ and JS. Its naming and structure is not optimal, but changing it would
10 * require changes to the C++ handler, which is already functional. 10 * require changes to the C++ handler, which is already functional.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 PASSPHRASE_ERROR: 'passphraseError', // Error in the passphrase. 83 PASSPHRASE_ERROR: 'passphraseError', // Error in the passphrase.
84 }; 84 };
85 85
86 cr.define('settings', function() { 86 cr.define('settings', function() {
87 /** 87 /**
88 * API which encapsulates messaging between JS and C++ for the sync page. 88 * API which encapsulates messaging between JS and C++ for the sync page.
89 * @constructor 89 * @constructor
90 */ 90 */
91 function SyncPrivateApi() {} 91 function SyncPrivateApi() {}
92 92
93 /** @private {?function(!string, !string)} */
94 SyncPrivateApi.getProfileInfoCallback_ = null;
95
96 /** @private {?function(settings.SyncPrefs)} */ 93 /** @private {?function(settings.SyncPrefs)} */
97 SyncPrivateApi.syncPrefsCallback_ = null; 94 SyncPrivateApi.syncPrefsCallback_ = null;
98 95
99 /** @private {?function(settings.PageStatus)} */ 96 /** @private {?function(settings.PageStatus)} */
100 SyncPrivateApi.setPageStatusCallback_ = null; 97 SyncPrivateApi.setPageStatusCallback_ = null;
101 98
102 /** 99 /**
103 * Called from JavaScript. Gets the current profile name and icon.
104 * @param {?function(!string, !string)} callback
105 */
106 SyncPrivateApi.getProfileInfo = function(callback) {
107 SyncPrivateApi.getProfileInfoCallback_ = callback;
108 chrome.send('getProfileInfo');
109 };
110
111 /**
112 * Called from C++ as a response to getIconsAndNames.
113 * @param {!string} name The current profile name.
114 * @param {!string} iconUrl The current profile icon's URL. Can be a data URL.
115 */
116 SyncPrivateApi.receiveProfileInfo = function(name, iconUrl) {
117 if (SyncPrivateApi.getProfileInfoCallback_)
118 SyncPrivateApi.getProfileInfoCallback_(name, iconUrl);
119 };
120
121 /**
122 * Starts the signin process for the user. Does nothing if the user is 100 * Starts the signin process for the user. Does nothing if the user is
123 * already signed in. 101 * already signed in.
124 * @private 102 * @private
125 */ 103 */
126 SyncPrivateApi.startSignIn = function() { 104 SyncPrivateApi.startSignIn = function() {
127 // TODO(tommycli): Currently this is always false, but this will become 105 // TODO(tommycli): Currently this is always false, but this will become
128 // a parameter once supervised users are implemented in MD Settings. 106 // a parameter once supervised users are implemented in MD Settings.
129 var creatingSupervisedUser = false; 107 var creatingSupervisedUser = false;
130 chrome.send('SyncSetupStartSignIn', [creatingSupervisedUser]); 108 chrome.send('SyncSetupStartSignIn', [creatingSupervisedUser]);
131 }; 109 };
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 break; 234 break;
257 default: 235 default:
258 // Other statuses (i.e. "spinner") are ignored. 236 // Other statuses (i.e. "spinner") are ignored.
259 } 237 }
260 }; 238 };
261 239
262 return { 240 return {
263 SyncPrivateApi: SyncPrivateApi, 241 SyncPrivateApi: SyncPrivateApi,
264 }; 242 };
265 }); 243 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698