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 #include "chrome/browser/ui/webui/settings/sync_handler.h" | 5 #include "chrome/browser/ui/webui/settings/people_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 bool sync_nothing; | 72 bool sync_nothing; |
73 syncer::ModelTypeSet data_types; | 73 syncer::ModelTypeSet data_types; |
74 std::string passphrase; | 74 std::string passphrase; |
75 bool passphrase_is_gaia; | 75 bool passphrase_is_gaia; |
76 }; | 76 }; |
77 | 77 |
78 SyncConfigInfo::SyncConfigInfo() | 78 SyncConfigInfo::SyncConfigInfo() |
79 : encrypt_all(false), | 79 : encrypt_all(false), |
80 sync_everything(false), | 80 sync_everything(false), |
81 sync_nothing(false), | 81 sync_nothing(false), |
82 passphrase_is_gaia(false) { | 82 passphrase_is_gaia(false) {} |
83 } | |
84 | 83 |
85 SyncConfigInfo::~SyncConfigInfo() {} | 84 SyncConfigInfo::~SyncConfigInfo() {} |
86 | 85 |
87 bool GetConfiguration(const std::string& json, SyncConfigInfo* config) { | 86 bool GetConfiguration(const std::string& json, SyncConfigInfo* config) { |
88 scoped_ptr<base::Value> parsed_value = base::JSONReader::Read(json); | 87 scoped_ptr<base::Value> parsed_value = base::JSONReader::Read(json); |
89 base::DictionaryValue* result; | 88 base::DictionaryValue* result; |
90 if (!parsed_value || !parsed_value->GetAsDictionary(&result)) { | 89 if (!parsed_value || !parsed_value->GetAsDictionary(&result)) { |
91 DLOG(ERROR) << "GetConfiguration() not passed a Dictionary"; | 90 DLOG(ERROR) << "GetConfiguration() not passed a Dictionary"; |
92 return false; | 91 return false; |
93 } | 92 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 return false; | 142 return false; |
144 } | 143 } |
145 } | 144 } |
146 return true; | 145 return true; |
147 } | 146 } |
148 | 147 |
149 } // namespace | 148 } // namespace |
150 | 149 |
151 namespace settings { | 150 namespace settings { |
152 | 151 |
153 SyncHandler::SyncHandler(Profile* profile) | 152 PeopleHandler::PeopleHandler(Profile* profile) |
154 : profile_(profile), | 153 : profile_(profile), |
155 configuring_sync_(false), | 154 configuring_sync_(false), |
156 sync_service_observer_(this) { | 155 sync_service_observer_(this) { |
157 PrefService* prefs = profile_->GetPrefs(); | 156 PrefService* prefs = profile_->GetPrefs(); |
158 profile_pref_registrar_.Init(prefs); | 157 profile_pref_registrar_.Init(prefs); |
159 profile_pref_registrar_.Add( | 158 profile_pref_registrar_.Add( |
160 prefs::kSigninAllowed, base::Bind(&SyncHandler::OnSigninAllowedPrefChange, | 159 prefs::kSigninAllowed, |
161 base::Unretained(this))); | 160 base::Bind(&PeopleHandler::OnSigninAllowedPrefChange, |
161 base::Unretained(this))); | |
162 | 162 |
163 ProfileSyncService* sync_service( | 163 ProfileSyncService* sync_service( |
164 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_)); | 164 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_)); |
165 if (sync_service) | 165 if (sync_service) |
166 sync_service_observer_.Add(sync_service); | 166 sync_service_observer_.Add(sync_service); |
167 } | 167 } |
168 | 168 |
169 SyncHandler::~SyncHandler() { | 169 PeopleHandler::~PeopleHandler() { |
170 // Just exit if running unit tests (no actual WebUI is attached). | 170 // Just exit if running unit tests (no actual WebUI is attached). |
171 if (!web_ui()) | 171 if (!web_ui()) |
172 return; | 172 return; |
173 | 173 |
174 // This case is hit when the user performs a back navigation. | 174 // This case is hit when the user performs a back navigation. |
175 CloseSyncSetup(); | 175 CloseSyncSetup(); |
176 } | 176 } |
177 | 177 |
178 void SyncHandler::ConfigureSyncDone() { | 178 void PeopleHandler::ConfigureSyncDone() { |
179 base::StringValue page("done"); | 179 base::StringValue page("done"); |
180 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", | 180 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", |
181 page); | 181 page); |
182 | 182 |
183 // Suppress the sign in promo once the user starts sync. This way the user | 183 // Suppress the sign in promo once the user starts sync. This way the user |
184 // doesn't see the sign in promo even if they sign out later on. | 184 // doesn't see the sign in promo even if they sign out later on. |
185 signin::SetUserSkippedPromo(profile_); | 185 signin::SetUserSkippedPromo(profile_); |
186 | 186 |
187 ProfileSyncService* service = GetSyncService(); | 187 ProfileSyncService* service = GetSyncService(); |
188 DCHECK(service); | 188 DCHECK(service); |
189 if (!service->HasSyncSetupCompleted()) { | 189 if (!service->HasSyncSetupCompleted()) { |
190 // This is the first time configuring sync, so log it. | 190 // This is the first time configuring sync, so log it. |
191 base::FilePath profile_file_path = profile_->GetPath(); | 191 base::FilePath profile_file_path = profile_->GetPath(); |
192 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 192 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
193 | 193 |
194 // We're done configuring, so notify ProfileSyncService that it is OK to | 194 // We're done configuring, so notify ProfileSyncService that it is OK to |
195 // start syncing. | 195 // start syncing. |
196 service->SetSetupInProgress(false); | 196 service->SetSetupInProgress(false); |
197 service->SetSyncSetupCompleted(); | 197 service->SetSyncSetupCompleted(); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 bool SyncHandler::IsActiveLogin() const { | 201 bool PeopleHandler::IsActiveLogin() const { |
202 // LoginUIService can be nullptr if page is brought up in incognito mode | 202 // LoginUIService can be nullptr if page is brought up in incognito mode |
203 // (i.e. if the user is running in guest mode in cros and brings up settings). | 203 // (i.e. if the user is running in guest mode in cros and brings up settings). |
204 LoginUIService* service = GetLoginUIService(); | 204 LoginUIService* service = GetLoginUIService(); |
205 return service && (service->current_login_ui() == this); | 205 return service && (service->current_login_ui() == this); |
206 } | 206 } |
207 | 207 |
208 void SyncHandler::RegisterMessages() { | 208 void PeopleHandler::RegisterMessages() { |
209 web_ui()->RegisterMessageCallback( | 209 web_ui()->RegisterMessageCallback( |
210 "SyncSetupDidClosePage", | 210 "SyncSetupDidClosePage", |
211 base::Bind(&SyncHandler::OnDidClosePage, | 211 base::Bind(&PeopleHandler::OnDidClosePage, base::Unretained(this))); |
212 base::Unretained(this))); | |
213 web_ui()->RegisterMessageCallback( | 212 web_ui()->RegisterMessageCallback( |
214 "SyncSetupConfigure", | 213 "SyncSetupConfigure", |
215 base::Bind(&SyncHandler::HandleConfigure, | 214 base::Bind(&PeopleHandler::HandleConfigure, base::Unretained(this))); |
216 base::Unretained(this))); | |
217 web_ui()->RegisterMessageCallback( | 215 web_ui()->RegisterMessageCallback( |
218 "SyncSetupShowSetupUI", | 216 "SyncSetupShowSetupUI", |
219 base::Bind(&SyncHandler::HandleShowSetupUI, | 217 base::Bind(&PeopleHandler::HandleShowSetupUI, base::Unretained(this))); |
220 base::Unretained(this))); | |
221 web_ui()->RegisterMessageCallback( | 218 web_ui()->RegisterMessageCallback( |
222 "SyncSetupCloseTimeout", | 219 "SyncSetupCloseTimeout", |
223 base::Bind(&SyncHandler::HandleCloseTimeout, base::Unretained(this))); | 220 base::Bind(&PeopleHandler::HandleCloseTimeout, base::Unretained(this))); |
224 web_ui()->RegisterMessageCallback( | 221 web_ui()->RegisterMessageCallback( |
225 "SyncSetupGetSyncStatus", | 222 "SyncSetupGetSyncStatus", |
226 base::Bind(&SyncHandler::HandleGetSyncStatus, base::Unretained(this))); | 223 base::Bind(&PeopleHandler::HandleGetSyncStatus, base::Unretained(this))); |
227 web_ui()->RegisterMessageCallback( | 224 web_ui()->RegisterMessageCallback( |
228 "SyncSetupManageOtherPeople", | 225 "SyncSetupManageOtherPeople", |
229 base::Bind(&SyncHandler::HandleManageOtherPeople, | 226 base::Bind(&PeopleHandler::HandleManageOtherPeople, |
230 base::Unretained(this))); | 227 base::Unretained(this))); |
231 #if defined(OS_CHROMEOS) | 228 #if defined(OS_CHROMEOS) |
232 web_ui()->RegisterMessageCallback( | 229 web_ui()->RegisterMessageCallback( |
233 "SyncSetupDoSignOutOnAuthError", | 230 "SyncSetupDoSignOutOnAuthError", |
234 base::Bind(&SyncHandler::HandleDoSignOutOnAuthError, | 231 base::Bind(&PeopleHandler::HandleDoSignOutOnAuthError, |
235 base::Unretained(this))); | 232 base::Unretained(this))); |
236 #else | 233 #else |
237 web_ui()->RegisterMessageCallback("SyncSetupStopSyncing", | 234 web_ui()->RegisterMessageCallback( |
238 base::Bind(&SyncHandler::HandleStopSyncing, | 235 "SyncSetupStopSyncing", |
239 base::Unretained(this))); | 236 base::Bind(&PeopleHandler::HandleStopSyncing, base::Unretained(this))); |
240 web_ui()->RegisterMessageCallback("SyncSetupStartSignIn", | 237 web_ui()->RegisterMessageCallback( |
241 base::Bind(&SyncHandler::HandleStartSignin, | 238 "SyncSetupStartSignIn", |
242 base::Unretained(this))); | 239 base::Bind(&PeopleHandler::HandleStartSignin, base::Unretained(this))); |
243 #endif | 240 #endif |
244 } | 241 } |
245 | 242 |
246 #if !defined(OS_CHROMEOS) | 243 #if !defined(OS_CHROMEOS) |
247 void SyncHandler::DisplayGaiaLogin(signin_metrics::AccessPoint access_point) { | 244 void PeopleHandler::DisplayGaiaLogin(signin_metrics::AccessPoint access_point) { |
248 DCHECK(!sync_startup_tracker_); | 245 DCHECK(!sync_startup_tracker_); |
249 // Advanced options are no longer being configured if the login screen is | 246 // Advanced options are no longer being configured if the login screen is |
250 // visible. If the user exits the signin wizard after this without | 247 // visible. If the user exits the signin wizard after this without |
251 // configuring sync, CloseSyncSetup() will ensure they are logged out. | 248 // configuring sync, CloseSyncSetup() will ensure they are logged out. |
252 configuring_sync_ = false; | 249 configuring_sync_ = false; |
253 DisplayGaiaLoginInNewTabOrWindow(access_point); | 250 DisplayGaiaLoginInNewTabOrWindow(access_point); |
254 } | 251 } |
255 | 252 |
256 void SyncHandler::DisplayGaiaLoginInNewTabOrWindow( | 253 void PeopleHandler::DisplayGaiaLoginInNewTabOrWindow( |
257 signin_metrics::AccessPoint access_point) { | 254 signin_metrics::AccessPoint access_point) { |
258 Browser* browser = chrome::FindBrowserWithWebContents( | 255 Browser* browser = |
259 web_ui()->GetWebContents()); | 256 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
260 bool force_new_tab = false; | 257 bool force_new_tab = false; |
261 if (!browser) { | 258 if (!browser) { |
262 // Settings is not displayed in a browser window. Open a new window. | 259 // Settings is not displayed in a browser window. Open a new window. |
263 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile_, | 260 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile_, |
264 chrome::GetActiveDesktop())); | 261 chrome::GetActiveDesktop())); |
265 force_new_tab = true; | 262 force_new_tab = true; |
266 } | 263 } |
267 | 264 |
268 // If the signin manager already has an authenticated username, this is a | 265 // If the signin manager already has an authenticated username, this is a |
269 // re-auth scenario, and we need to ensure that the user signs in with the | 266 // re-auth scenario, and we need to ensure that the user signs in with the |
270 // same email address. | 267 // same email address. |
271 GURL url; | 268 GURL url; |
272 if (SigninManagerFactory::GetForProfile( | 269 if (SigninManagerFactory::GetForProfile(browser->profile()) |
273 browser->profile())->IsAuthenticated()) { | 270 ->IsAuthenticated()) { |
dschuyler
2015/12/10 00:51:48
I think cl format is making a mistake here. Pleas
tommycli
2015/12/10 01:57:02
Done. I provided a third alternative, since I thin
| |
274 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", | 271 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", |
275 signin_metrics::HISTOGRAM_REAUTH_SHOWN, | 272 signin_metrics::HISTOGRAM_REAUTH_SHOWN, |
276 signin_metrics::HISTOGRAM_REAUTH_MAX); | 273 signin_metrics::HISTOGRAM_REAUTH_MAX); |
277 | 274 |
278 SigninErrorController* error_controller = | 275 SigninErrorController* error_controller = |
279 SigninErrorControllerFactory::GetForProfile(browser->profile()); | 276 SigninErrorControllerFactory::GetForProfile(browser->profile()); |
280 DCHECK(error_controller->HasError()); | 277 DCHECK(error_controller->HasError()); |
281 if (!force_new_tab) { | 278 if (!force_new_tab) { |
282 browser->window()->ShowAvatarBubbleFromAvatarButton( | 279 browser->window()->ShowAvatarBubbleFromAvatarButton( |
283 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, | 280 BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, |
(...skipping 13 matching lines...) Expand all Loading... | |
297 access_point, signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, | 294 access_point, signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, |
298 true); | 295 true); |
299 } | 296 } |
300 } | 297 } |
301 | 298 |
302 if (url.is_valid()) | 299 if (url.is_valid()) |
303 chrome::ShowSingletonTab(browser, url); | 300 chrome::ShowSingletonTab(browser, url); |
304 } | 301 } |
305 #endif | 302 #endif |
306 | 303 |
307 bool SyncHandler::PrepareSyncSetup() { | 304 bool PeopleHandler::PrepareSyncSetup() { |
308 // If the wizard is already visible, just focus that one. | 305 // If the wizard is already visible, just focus that one. |
309 if (FocusExistingWizardIfPresent()) { | 306 if (FocusExistingWizardIfPresent()) { |
310 if (!IsActiveLogin()) | 307 if (!IsActiveLogin()) |
311 CloseSyncSetup(); | 308 CloseSyncSetup(); |
312 return false; | 309 return false; |
313 } | 310 } |
314 | 311 |
315 // Notify services that login UI is now active. | 312 // Notify services that login UI is now active. |
316 GetLoginUIService()->SetLoginUI(this); | 313 GetLoginUIService()->SetLoginUI(this); |
317 | 314 |
318 ProfileSyncService* service = GetSyncService(); | 315 ProfileSyncService* service = GetSyncService(); |
319 if (service) | 316 if (service) |
320 service->SetSetupInProgress(true); | 317 service->SetSetupInProgress(true); |
321 | 318 |
322 return true; | 319 return true; |
323 } | 320 } |
324 | 321 |
325 void SyncHandler::DisplaySpinner() { | 322 void PeopleHandler::DisplaySpinner() { |
326 configuring_sync_ = true; | 323 configuring_sync_ = true; |
327 base::StringValue page("spinner"); | 324 base::StringValue page("spinner"); |
328 base::DictionaryValue args; | 325 base::DictionaryValue args; |
329 | 326 |
330 const int kTimeoutSec = 30; | 327 const int kTimeoutSec = 30; |
331 DCHECK(!backend_start_timer_); | 328 DCHECK(!backend_start_timer_); |
332 backend_start_timer_.reset(new base::OneShotTimer()); | 329 backend_start_timer_.reset(new base::OneShotTimer()); |
333 backend_start_timer_->Start(FROM_HERE, | 330 backend_start_timer_->Start(FROM_HERE, |
334 base::TimeDelta::FromSeconds(kTimeoutSec), | 331 base::TimeDelta::FromSeconds(kTimeoutSec), this, |
335 this, &SyncHandler::DisplayTimeout); | 332 &PeopleHandler::DisplayTimeout); |
336 | 333 |
337 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", | 334 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", |
338 page, args); | 335 page, args); |
339 } | 336 } |
340 | 337 |
341 // TODO(kochi): Handle error conditions other than timeout. | 338 // TODO(kochi): Handle error conditions other than timeout. |
342 // http://crbug.com/128692 | 339 // http://crbug.com/128692 |
343 void SyncHandler::DisplayTimeout() { | 340 void PeopleHandler::DisplayTimeout() { |
344 // Stop a timer to handle timeout in waiting for checking network connection. | 341 // Stop a timer to handle timeout in waiting for checking network connection. |
345 backend_start_timer_.reset(); | 342 backend_start_timer_.reset(); |
346 | 343 |
347 // Do not listen to sync startup events. | 344 // Do not listen to sync startup events. |
348 sync_startup_tracker_.reset(); | 345 sync_startup_tracker_.reset(); |
349 | 346 |
350 base::StringValue page("timeout"); | 347 base::StringValue page("timeout"); |
351 base::DictionaryValue args; | 348 base::DictionaryValue args; |
352 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", | 349 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", |
353 page, args); | 350 page, args); |
354 } | 351 } |
355 | 352 |
356 void SyncHandler::OnDidClosePage(const base::ListValue* args) { | 353 void PeopleHandler::OnDidClosePage(const base::ListValue* args) { |
357 CloseSyncSetup(); | 354 CloseSyncSetup(); |
358 } | 355 } |
359 | 356 |
360 void SyncHandler::SyncStartupFailed() { | 357 void PeopleHandler::SyncStartupFailed() { |
361 // Stop a timer to handle timeout in waiting for checking network connection. | 358 // Stop a timer to handle timeout in waiting for checking network connection. |
362 backend_start_timer_.reset(); | 359 backend_start_timer_.reset(); |
363 | 360 |
364 // Just close the sync overlay (the idea is that the base settings page will | 361 // Just close the sync overlay (the idea is that the base settings page will |
365 // display the current error.) | 362 // display the current error.) |
366 CloseUI(); | 363 CloseUI(); |
367 } | 364 } |
368 | 365 |
369 void SyncHandler::SyncStartupCompleted() { | 366 void PeopleHandler::SyncStartupCompleted() { |
370 ProfileSyncService* service = GetSyncService(); | 367 ProfileSyncService* service = GetSyncService(); |
371 DCHECK(service->IsBackendInitialized()); | 368 DCHECK(service->IsBackendInitialized()); |
372 | 369 |
373 // Stop a timer to handle timeout in waiting for checking network connection. | 370 // Stop a timer to handle timeout in waiting for checking network connection. |
374 backend_start_timer_.reset(); | 371 backend_start_timer_.reset(); |
375 | 372 |
376 DisplayConfigureSync(false); | 373 DisplayConfigureSync(false); |
377 } | 374 } |
378 | 375 |
379 ProfileSyncService* SyncHandler::GetSyncService() const { | 376 ProfileSyncService* PeopleHandler::GetSyncService() const { |
380 return profile_->IsSyncAllowed() | 377 return profile_->IsSyncAllowed() |
381 ? ProfileSyncServiceFactory::GetForProfile(profile_) | 378 ? ProfileSyncServiceFactory::GetForProfile(profile_) |
382 : nullptr; | 379 : nullptr; |
383 } | 380 } |
384 | 381 |
385 void SyncHandler::HandleConfigure(const base::ListValue* args) { | 382 void PeopleHandler::HandleConfigure(const base::ListValue* args) { |
386 DCHECK(!sync_startup_tracker_); | 383 DCHECK(!sync_startup_tracker_); |
387 std::string json; | 384 std::string json; |
388 if (!args->GetString(0, &json)) { | 385 if (!args->GetString(0, &json)) { |
389 NOTREACHED() << "Could not read JSON argument"; | 386 NOTREACHED() << "Could not read JSON argument"; |
390 return; | 387 return; |
391 } | 388 } |
392 if (json.empty()) { | 389 if (json.empty()) { |
393 NOTREACHED(); | 390 NOTREACHED(); |
394 return; | 391 return; |
395 } | 392 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 | 495 |
499 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CUSTOMIZE); | 496 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CUSTOMIZE); |
500 if (configuration.encrypt_all) | 497 if (configuration.encrypt_all) |
501 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); | 498 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); |
502 if (configuration.passphrase_is_gaia && !configuration.passphrase.empty()) | 499 if (configuration.passphrase_is_gaia && !configuration.passphrase.empty()) |
503 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE); | 500 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE); |
504 if (!configuration.sync_everything) | 501 if (!configuration.sync_everything) |
505 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CHOOSE); | 502 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CHOOSE); |
506 } | 503 } |
507 | 504 |
508 void SyncHandler::HandleShowSetupUI(const base::ListValue* args) { | 505 void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) { |
509 if (!GetSyncService()) { | 506 if (!GetSyncService()) { |
510 CloseUI(); | 507 CloseUI(); |
511 return; | 508 return; |
512 } | 509 } |
513 | 510 |
514 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile_); | 511 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile_); |
515 if (!signin->IsAuthenticated()) { | 512 if (!signin->IsAuthenticated()) { |
516 // For web-based signin, the signin page is not displayed in an overlay | 513 // For web-based signin, the signin page is not displayed in an overlay |
517 // on the settings page. So if we get here, it must be due to the user | 514 // on the settings page. So if we get here, it must be due to the user |
518 // cancelling signin (by reloading the sync settings page during initial | 515 // cancelling signin (by reloading the sync settings page during initial |
(...skipping 14 matching lines...) Expand all Loading... | |
533 | 530 |
534 // If a setup wizard is present on this page or another, bring it to focus. | 531 // If a setup wizard is present on this page or another, bring it to focus. |
535 // Otherwise, display a new one on this page. | 532 // Otherwise, display a new one on this page. |
536 if (!FocusExistingWizardIfPresent()) | 533 if (!FocusExistingWizardIfPresent()) |
537 OpenSyncSetup(args); | 534 OpenSyncSetup(args); |
538 } | 535 } |
539 | 536 |
540 #if defined(OS_CHROMEOS) | 537 #if defined(OS_CHROMEOS) |
541 // On ChromeOS, we need to sign out the user session to fix an auth error, so | 538 // On ChromeOS, we need to sign out the user session to fix an auth error, so |
542 // the user goes through the real signin flow to generate a new auth token. | 539 // the user goes through the real signin flow to generate a new auth token. |
543 void SyncHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { | 540 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { |
544 DVLOG(1) << "Signing out the user to fix a sync error."; | 541 DVLOG(1) << "Signing out the user to fix a sync error."; |
545 chrome::AttemptUserExit(); | 542 chrome::AttemptUserExit(); |
546 } | 543 } |
547 #endif | 544 #endif |
548 | 545 |
549 #if !defined(OS_CHROMEOS) | 546 #if !defined(OS_CHROMEOS) |
550 void SyncHandler::HandleStartSignin(const base::ListValue* args) { | 547 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { |
551 // Should only be called if the user is not already signed in. | 548 // Should only be called if the user is not already signed in. |
552 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); | 549 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |
553 OpenSyncSetup(args); | 550 OpenSyncSetup(args); |
554 } | 551 } |
555 | 552 |
556 void SyncHandler::HandleStopSyncing(const base::ListValue* args) { | 553 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { |
557 if (GetSyncService()) | 554 if (GetSyncService()) |
558 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 555 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
559 SigninManagerFactory::GetForProfile(profile_) | 556 SigninManagerFactory::GetForProfile(profile_) |
560 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); | 557 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); |
561 | 558 |
562 bool delete_profile = false; | 559 bool delete_profile = false; |
563 if (args->GetBoolean(0, &delete_profile) && delete_profile) { | 560 if (args->GetBoolean(0, &delete_profile) && delete_profile) { |
564 // Do as BrowserOptionsHandler::DeleteProfile(). | 561 // Do as BrowserOptionsHandler::DeleteProfile(). |
565 options::helper::DeleteProfileAtPath(profile_->GetPath(), web_ui()); | 562 options::helper::DeleteProfileAtPath(profile_->GetPath(), web_ui()); |
566 } | 563 } |
567 } | 564 } |
568 #endif | 565 #endif |
569 | 566 |
570 void SyncHandler::HandleCloseTimeout(const base::ListValue* args) { | 567 void PeopleHandler::HandleCloseTimeout(const base::ListValue* args) { |
571 CloseSyncSetup(); | 568 CloseSyncSetup(); |
572 } | 569 } |
573 | 570 |
574 void SyncHandler::HandleGetSyncStatus(const base::ListValue* /* args */) { | 571 void PeopleHandler::HandleGetSyncStatus(const base::ListValue* /* args */) { |
575 UpdateSyncState(); | 572 UpdateSyncState(); |
576 } | 573 } |
577 | 574 |
578 void SyncHandler::HandleManageOtherPeople(const base::ListValue* /* args */) { | 575 void PeopleHandler::HandleManageOtherPeople(const base::ListValue* /* args */) { |
579 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, | 576 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, |
580 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 577 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
581 } | 578 } |
582 | 579 |
583 void SyncHandler::CloseSyncSetup() { | 580 void PeopleHandler::CloseSyncSetup() { |
584 // Stop a timer to handle timeout in waiting for checking network connection. | 581 // Stop a timer to handle timeout in waiting for checking network connection. |
585 backend_start_timer_.reset(); | 582 backend_start_timer_.reset(); |
586 | 583 |
587 // Clear the sync startup tracker, since the setup wizard is being closed. | 584 // Clear the sync startup tracker, since the setup wizard is being closed. |
588 sync_startup_tracker_.reset(); | 585 sync_startup_tracker_.reset(); |
589 | 586 |
590 ProfileSyncService* sync_service = GetSyncService(); | 587 ProfileSyncService* sync_service = GetSyncService(); |
591 if (IsActiveLogin()) { | 588 if (IsActiveLogin()) { |
592 // Don't log a cancel event if the sync setup dialog is being | 589 // Don't log a cancel event if the sync setup dialog is being |
593 // automatically closed due to an auth error. | 590 // automatically closed due to an auth error. |
594 if (!sync_service || (!sync_service->HasSyncSetupCompleted() && | 591 if (!sync_service || (!sync_service->HasSyncSetupCompleted() && |
595 sync_service->GetAuthError().state() == GoogleServiceAuthError::NONE)) { | 592 sync_service->GetAuthError().state() == |
593 GoogleServiceAuthError::NONE)) { | |
596 if (configuring_sync_) { | 594 if (configuring_sync_) { |
597 ProfileSyncService::SyncEvent( | 595 ProfileSyncService::SyncEvent( |
598 ProfileSyncService::CANCEL_DURING_CONFIGURE); | 596 ProfileSyncService::CANCEL_DURING_CONFIGURE); |
599 | 597 |
600 // If the user clicked "Cancel" while setting up sync, disable sync | 598 // If the user clicked "Cancel" while setting up sync, disable sync |
601 // because we don't want the sync backend to remain in the | 599 // because we don't want the sync backend to remain in the |
602 // first-setup-incomplete state. | 600 // first-setup-incomplete state. |
603 // Note: In order to disable sync across restarts on Chrome OS, | 601 // Note: In order to disable sync across restarts on Chrome OS, |
604 // we must call RequestStop(CLEAR_DATA), which suppresses sync startup | 602 // we must call RequestStop(CLEAR_DATA), which suppresses sync startup |
605 // in addition to disabling it. | 603 // in addition to disabling it. |
606 if (sync_service) { | 604 if (sync_service) { |
607 DVLOG(1) << "Sync setup aborted by user action"; | 605 DVLOG(1) << "Sync setup aborted by user action"; |
608 sync_service->RequestStop(ProfileSyncService::CLEAR_DATA); | 606 sync_service->RequestStop(ProfileSyncService::CLEAR_DATA); |
609 #if !defined(OS_CHROMEOS) | 607 #if !defined(OS_CHROMEOS) |
610 // Sign out the user on desktop Chrome if they click cancel during | 608 // Sign out the user on desktop Chrome if they click cancel during |
611 // initial setup. | 609 // initial setup. |
612 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. | 610 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. |
613 if (sync_service->IsFirstSetupInProgress()) { | 611 if (sync_service->IsFirstSetupInProgress()) { |
614 SigninManagerFactory::GetForProfile(profile_) | 612 SigninManagerFactory::GetForProfile(profile_) |
615 ->SignOut(signin_metrics::ABORT_SIGNIN); | 613 ->SignOut(signin_metrics::ABORT_SIGNIN); |
616 } | 614 } |
617 #endif | 615 #endif |
618 } | 616 } |
619 } | 617 } |
620 } | 618 } |
621 | 619 |
622 GetLoginUIService()->LoginUIClosed(this); | 620 GetLoginUIService()->LoginUIClosed(this); |
623 } | 621 } |
624 | 622 |
625 // Alert the sync service anytime the sync setup dialog is closed. This can | 623 // Alert the sync service anytime the sync setup dialog is closed. This can |
626 // happen due to the user clicking the OK or Cancel button, or due to the | 624 // happen due to the user clicking the OK or Cancel button, or due to the |
627 // dialog being closed by virtue of sync being disabled in the background. | 625 // dialog being closed by virtue of sync being disabled in the background. |
628 if (sync_service) | 626 if (sync_service) |
629 sync_service->SetSetupInProgress(false); | 627 sync_service->SetSetupInProgress(false); |
630 | 628 |
631 configuring_sync_ = false; | 629 configuring_sync_ = false; |
632 } | 630 } |
633 | 631 |
634 void SyncHandler::OpenSyncSetup(const base::ListValue* args) { | 632 void PeopleHandler::OpenSyncSetup(const base::ListValue* args) { |
635 if (!PrepareSyncSetup()) | 633 if (!PrepareSyncSetup()) |
636 return; | 634 return; |
637 | 635 |
638 // There are several different UI flows that can bring the user here: | 636 // There are several different UI flows that can bring the user here: |
639 // 1) Signin promo. | 637 // 1) Signin promo. |
640 // 2) Normal signin through settings page (IsAuthenticated() is false). | 638 // 2) Normal signin through settings page (IsAuthenticated() is false). |
641 // 3) Previously working credentials have expired. | 639 // 3) Previously working credentials have expired. |
642 // 4) User is signed in, but has stopped sync via the google dashboard, and | 640 // 4) User is signed in, but has stopped sync via the google dashboard, and |
643 // signout is prohibited by policy so we need to force a re-auth. | 641 // signout is prohibited by policy so we need to force a re-auth. |
644 // 5) User clicks [Advanced Settings] button on options page while already | 642 // 5) User clicks [Advanced Settings] button on options page while already |
(...skipping 29 matching lines...) Expand all Loading... | |
674 CloseUI(); | 672 CloseUI(); |
675 return; | 673 return; |
676 } | 674 } |
677 | 675 |
678 // User is already logged in. They must have brought up the config wizard | 676 // User is already logged in. They must have brought up the config wizard |
679 // via the "Advanced..." button or through One-Click signin (cases 4-6), or | 677 // via the "Advanced..." button or through One-Click signin (cases 4-6), or |
680 // they are re-enabling sync after having disabled it (case 7). | 678 // they are re-enabling sync after having disabled it (case 7). |
681 DisplayConfigureSync(false); | 679 DisplayConfigureSync(false); |
682 } | 680 } |
683 | 681 |
684 void SyncHandler::OpenConfigureSync() { | 682 void PeopleHandler::OpenConfigureSync() { |
685 if (!PrepareSyncSetup()) | 683 if (!PrepareSyncSetup()) |
686 return; | 684 return; |
687 | 685 |
688 DisplayConfigureSync(false); | 686 DisplayConfigureSync(false); |
689 } | 687 } |
690 | 688 |
691 void SyncHandler::FocusUI() { | 689 void PeopleHandler::FocusUI() { |
692 DCHECK(IsActiveLogin()); | 690 DCHECK(IsActiveLogin()); |
693 WebContents* web_contents = web_ui()->GetWebContents(); | 691 WebContents* web_contents = web_ui()->GetWebContents(); |
694 web_contents->GetDelegate()->ActivateContents(web_contents); | 692 web_contents->GetDelegate()->ActivateContents(web_contents); |
695 } | 693 } |
696 | 694 |
697 void SyncHandler::CloseUI() { | 695 void PeopleHandler::CloseUI() { |
698 CloseSyncSetup(); | 696 CloseSyncSetup(); |
699 base::StringValue page("done"); | 697 base::StringValue page("done"); |
700 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", | 698 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", |
701 page); | 699 page); |
702 } | 700 } |
703 | 701 |
704 void SyncHandler::GoogleSigninSucceeded(const std::string& /* account_id */, | 702 void PeopleHandler::GoogleSigninSucceeded(const std::string& /* account_id */, |
705 const std::string& /* username */, | 703 const std::string& /* username */, |
706 const std::string& /* password */) { | 704 const std::string& /* password */) { |
707 UpdateSyncState(); | 705 UpdateSyncState(); |
708 } | 706 } |
709 | 707 |
710 void SyncHandler::GoogleSignedOut(const std::string& /* account_id */, | 708 void PeopleHandler::GoogleSignedOut(const std::string& /* account_id */, |
711 const std::string& /* username */) { | 709 const std::string& /* username */) { |
712 UpdateSyncState(); | 710 UpdateSyncState(); |
713 } | 711 } |
714 | 712 |
715 void SyncHandler::OnStateChanged() { | 713 void PeopleHandler::OnStateChanged() { |
716 UpdateSyncState(); | 714 UpdateSyncState(); |
717 } | 715 } |
718 | 716 |
719 scoped_ptr<base::DictionaryValue> SyncHandler::GetSyncStateDictionary() { | 717 scoped_ptr<base::DictionaryValue> PeopleHandler::GetSyncStateDictionary() { |
720 // The items which are to be written into |sync_status| are also described in | 718 // The items which are to be written into |sync_status| are also described in |
721 // chrome/browser/resources/options/browser_options.js in @typedef | 719 // chrome/browser/resources/options/browser_options.js in @typedef |
722 // for SyncStatus. Please update it whenever you add or remove any keys here. | 720 // for SyncStatus. Please update it whenever you add or remove any keys here. |
723 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 721 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
724 if (profile_->IsGuestSession()) { | 722 if (profile_->IsGuestSession()) { |
725 // Cannot display signin status when running in guest mode on chromeos | 723 // Cannot display signin status when running in guest mode on chromeos |
726 // because there is no SigninManager. | 724 // because there is no SigninManager. |
727 sync_status->SetBoolean("signinAllowed", false); | 725 sync_status->SetBoolean("signinAllowed", false); |
728 return sync_status.Pass(); | 726 return sync_status.Pass(); |
729 } | 727 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 sync_status->SetBoolean("hasError", status_has_error); | 760 sync_status->SetBoolean("hasError", status_has_error); |
763 | 761 |
764 sync_status->SetBoolean("managed", service && service->IsManaged()); | 762 sync_status->SetBoolean("managed", service && service->IsManaged()); |
765 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); | 763 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); |
766 sync_status->SetBoolean("hasUnrecoverableError", | 764 sync_status->SetBoolean("hasUnrecoverableError", |
767 service && service->HasUnrecoverableError()); | 765 service && service->HasUnrecoverableError()); |
768 | 766 |
769 return sync_status.Pass(); | 767 return sync_status.Pass(); |
770 } | 768 } |
771 | 769 |
772 bool SyncHandler::IsExistingWizardPresent() { | 770 bool PeopleHandler::IsExistingWizardPresent() { |
773 LoginUIService* service = GetLoginUIService(); | 771 LoginUIService* service = GetLoginUIService(); |
774 DCHECK(service); | 772 DCHECK(service); |
775 return service->current_login_ui() != nullptr; | 773 return service->current_login_ui() != nullptr; |
776 } | 774 } |
777 | 775 |
778 bool SyncHandler::FocusExistingWizardIfPresent() { | 776 bool PeopleHandler::FocusExistingWizardIfPresent() { |
779 if (!IsExistingWizardPresent()) | 777 if (!IsExistingWizardPresent()) |
780 return false; | 778 return false; |
781 | 779 |
782 LoginUIService* service = GetLoginUIService(); | 780 LoginUIService* service = GetLoginUIService(); |
783 DCHECK(service); | 781 DCHECK(service); |
784 service->current_login_ui()->FocusUI(); | 782 service->current_login_ui()->FocusUI(); |
785 return true; | 783 return true; |
786 } | 784 } |
787 | 785 |
788 void SyncHandler::DisplayConfigureSync(bool passphrase_failed) { | 786 void PeopleHandler::DisplayConfigureSync(bool passphrase_failed) { |
789 // Should never call this when we are not signed in. | 787 // Should never call this when we are not signed in. |
790 DCHECK(SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); | 788 DCHECK(SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |
791 ProfileSyncService* service = GetSyncService(); | 789 ProfileSyncService* service = GetSyncService(); |
792 DCHECK(service); | 790 DCHECK(service); |
793 if (!service->IsBackendInitialized()) { | 791 if (!service->IsBackendInitialized()) { |
794 service->RequestStart(); | 792 service->RequestStart(); |
795 | 793 |
796 // See if it's even possible to bring up the sync backend - if not | 794 // See if it's even possible to bring up the sync backend - if not |
797 // (unrecoverable error?), don't bother displaying a spinner that will be | 795 // (unrecoverable error?), don't bother displaying a spinner that will be |
798 // immediately closed because this leads to some ugly infinite UI loop (see | 796 // immediately closed because this leads to some ugly infinite UI loop (see |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 | 855 |
858 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE | 856 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE |
859 // we only set usePassphrase for CUSTOM_PASSPHRASE. | 857 // we only set usePassphrase for CUSTOM_PASSPHRASE. |
860 args.SetBoolean("usePassphrase", | 858 args.SetBoolean("usePassphrase", |
861 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE); | 859 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE); |
862 base::Time passphrase_time = service->GetExplicitPassphraseTime(); | 860 base::Time passphrase_time = service->GetExplicitPassphraseTime(); |
863 syncer::PassphraseType passphrase_type = service->GetPassphraseType(); | 861 syncer::PassphraseType passphrase_type = service->GetPassphraseType(); |
864 if (!passphrase_time.is_null()) { | 862 if (!passphrase_time.is_null()) { |
865 base::string16 passphrase_time_str = | 863 base::string16 passphrase_time_str = |
866 base::TimeFormatShortDate(passphrase_time); | 864 base::TimeFormatShortDate(passphrase_time); |
867 args.SetString( | 865 args.SetString("enterPassphraseBody", |
868 "enterPassphraseBody", | 866 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE, |
869 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE, | 867 passphrase_time_str)); |
870 passphrase_time_str)); | |
871 args.SetString( | 868 args.SetString( |
872 "enterGooglePassphraseBody", | 869 "enterGooglePassphraseBody", |
873 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, | 870 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, |
874 passphrase_time_str)); | 871 passphrase_time_str)); |
875 switch (passphrase_type) { | 872 switch (passphrase_type) { |
876 case syncer::FROZEN_IMPLICIT_PASSPHRASE: | 873 case syncer::FROZEN_IMPLICIT_PASSPHRASE: |
877 args.SetString( | 874 args.SetString( |
878 "fullEncryptionBody", | 875 "fullEncryptionBody", |
879 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE, | 876 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE, |
880 passphrase_time_str)); | 877 passphrase_time_str)); |
881 break; | 878 break; |
882 case syncer::CUSTOM_PASSPHRASE: | 879 case syncer::CUSTOM_PASSPHRASE: |
883 args.SetString( | 880 args.SetString( |
884 "fullEncryptionBody", | 881 "fullEncryptionBody", |
885 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE, | 882 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE, |
886 passphrase_time_str)); | 883 passphrase_time_str)); |
887 break; | 884 break; |
888 default: | 885 default: |
889 args.SetString( | 886 args.SetString("fullEncryptionBody", |
890 "fullEncryptionBody", | 887 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); |
891 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); | |
892 break; | 888 break; |
893 } | 889 } |
894 } else if (passphrase_type == syncer::CUSTOM_PASSPHRASE) { | 890 } else if (passphrase_type == syncer::CUSTOM_PASSPHRASE) { |
895 args.SetString( | 891 args.SetString("fullEncryptionBody", |
896 "fullEncryptionBody", | 892 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); |
897 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); | |
898 } else { | 893 } else { |
899 args.SetString( | 894 args.SetString("fullEncryptionBody", |
900 "fullEncryptionBody", | 895 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA)); |
901 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA)); | |
902 } | 896 } |
903 | 897 |
904 base::StringValue page("configure"); | 898 base::StringValue page("configure"); |
905 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", | 899 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.showSyncSetupPage", |
906 page, args); | 900 page, args); |
907 | 901 |
908 // Make sure the tab used for the Gaia sign in does not cover the settings | 902 // Make sure the tab used for the Gaia sign in does not cover the settings |
909 // tab. | 903 // tab. |
910 FocusUI(); | 904 FocusUI(); |
911 } | 905 } |
912 | 906 |
913 LoginUIService* SyncHandler::GetLoginUIService() const { | 907 LoginUIService* PeopleHandler::GetLoginUIService() const { |
914 return LoginUIServiceFactory::GetForProfile(profile_); | 908 return LoginUIServiceFactory::GetForProfile(profile_); |
915 } | 909 } |
916 | 910 |
917 void SyncHandler::UpdateSyncState() { | 911 void PeopleHandler::UpdateSyncState() { |
918 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", | 912 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", |
919 *GetSyncStateDictionary()); | 913 *GetSyncStateDictionary()); |
920 } | 914 } |
921 | 915 |
922 void SyncHandler::OnSigninAllowedPrefChange() { | 916 void PeopleHandler::OnSigninAllowedPrefChange() { |
923 UpdateSyncState(); | 917 UpdateSyncState(); |
924 } | 918 } |
925 | 919 |
926 } // namespace settings | 920 } // namespace settings |
OLD | NEW |