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

Side by Side Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 1607833004: [MD settings] fix for opening sync user login (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/webui/settings/people_handler.h" 5 #include "chrome/browser/ui/webui/settings/people_handler.h"
6 6
7 #include <string>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/i18n/time_formatting.h" 13 #include "base/i18n/time_formatting.h"
12 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 15 #include "base/json/json_writer.h"
14 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
16 #include "base/values.h" 18 #include "base/values.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // blank setup overlay on this page by showing the "done" page. This can 596 // blank setup overlay on this page by showing the "done" page. This can
595 // happen if the user navigates to chrome://settings/syncSetup in more than 597 // happen if the user navigates to chrome://settings/syncSetup in more than
596 // one tab. See crbug.com/261566. 598 // one tab. See crbug.com/261566.
597 // Note: The following block will transfer focus to the existing wizard. 599 // Note: The following block will transfer focus to the existing wizard.
598 if (IsExistingWizardPresent() && !IsActiveLogin()) 600 if (IsExistingWizardPresent() && !IsActiveLogin())
599 CloseUI(); 601 CloseUI();
600 602
601 // If a setup wizard is present on this page or another, bring it to focus. 603 // If a setup wizard is present on this page or another, bring it to focus.
602 // Otherwise, display a new one on this page. 604 // Otherwise, display a new one on this page.
603 if (!FocusExistingWizardIfPresent()) 605 if (!FocusExistingWizardIfPresent())
604 OpenSyncSetup(args); 606 OpenSyncSetup(nullptr);
605 } 607 }
606 608
607 #if defined(OS_CHROMEOS) 609 #if defined(OS_CHROMEOS)
608 // On ChromeOS, we need to sign out the user session to fix an auth error, so 610 // On ChromeOS, we need to sign out the user session to fix an auth error, so
609 // the user goes through the real signin flow to generate a new auth token. 611 // the user goes through the real signin flow to generate a new auth token.
610 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { 612 void PeopleHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) {
611 DVLOG(1) << "Signing out the user to fix a sync error."; 613 DVLOG(1) << "Signing out the user to fix a sync error.";
612 chrome::AttemptUserExit(); 614 chrome::AttemptUserExit();
613 } 615 }
614 #endif 616 #endif
615 617
616 #if !defined(OS_CHROMEOS) 618 #if !defined(OS_CHROMEOS)
617 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { 619 void PeopleHandler::HandleStartSignin(const base::ListValue* args) {
618 // Should only be called if the user is not already signed in. 620 // Should only be called if the user is not already signed in.
619 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); 621 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated());
620 OpenSyncSetup(args); 622 OpenSyncSetup(nullptr);
621 } 623 }
622 624
623 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { 625 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) {
624 if (GetSyncService()) 626 if (GetSyncService())
625 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); 627 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
626 SigninManagerFactory::GetForProfile(profile_) 628 SigninManagerFactory::GetForProfile(profile_)
627 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); 629 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS);
628 630
629 bool delete_profile = false; 631 bool delete_profile = false;
630 if (args->GetBoolean(0, &delete_profile) && delete_profile) { 632 if (args->GetBoolean(0, &delete_profile) && delete_profile) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 void PeopleHandler::UpdateSyncState() { 994 void PeopleHandler::UpdateSyncState() {
993 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", 995 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus",
994 *GetSyncStateDictionary()); 996 *GetSyncStateDictionary());
995 } 997 }
996 998
997 void PeopleHandler::OnSigninAllowedPrefChange() { 999 void PeopleHandler::OnSigninAllowedPrefChange() {
998 UpdateSyncState(); 1000 UpdateSyncState();
999 } 1001 }
1000 1002
1001 } // namespace settings 1003 } // namespace settings
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698