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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 16870004: [sync] Force gaia re-auth on CrOs during sign in after changing password (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_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"
(...skipping 29 matching lines...) Expand all
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
41 #include "content/public/browser/web_contents_delegate.h" 41 #include "content/public/browser/web_contents_delegate.h"
42 #include "google_apis/gaia/gaia_auth_util.h" 42 #include "google_apis/gaia/gaia_auth_util.h"
43 #include "google_apis/gaia/gaia_constants.h" 43 #include "google_apis/gaia/gaia_constants.h"
44 #include "grit/chromium_strings.h" 44 #include "grit/chromium_strings.h"
45 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
46 #include "grit/locale_settings.h" 46 #include "grit/locale_settings.h"
47 #include "ui/base/l10n/l10n_util.h" 47 #include "ui/base/l10n/l10n_util.h"
48 48
49 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
50 #include "chrome/browser/chromeos/login/user.h"
51 #include "chrome/browser/chromeos/login/user_manager.h"
50 #include "chrome/browser/signin/signin_manager_base.h" 52 #include "chrome/browser/signin/signin_manager_base.h"
51 #else 53 #else
52 #include "chrome/browser/signin/signin_manager.h" 54 #include "chrome/browser/signin/signin_manager.h"
53 #endif 55 #endif
54 56
55 using content::WebContents; 57 using content::WebContents;
56 using l10n_util::GetStringFUTF16; 58 using l10n_util::GetStringFUTF16;
57 using l10n_util::GetStringUTF16; 59 using l10n_util::GetStringUTF16;
58 60
59 namespace { 61 namespace {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // signin) or by directly navigating to settings/syncSetup 861 // signin) or by directly navigating to settings/syncSetup
860 // (http://crbug.com/229836). So just exit. 862 // (http://crbug.com/229836). So just exit.
861 DLOG(WARNING) << "Cannot display sync setup UI when not signed in"; 863 DLOG(WARNING) << "Cannot display sync setup UI when not signed in";
862 CloseOverlay(); 864 CloseOverlay();
863 return; 865 return;
864 } 866 }
865 OpenSyncSetup(); 867 OpenSyncSetup();
866 } 868 }
867 869
868 #if defined(OS_CHROMEOS) 870 #if defined(OS_CHROMEOS)
869 // On ChromeOS, we need to sign out the user session to fix an auth error, so 871 // On ChromeOS, we invalidate the existing OAuth2 token and sign out the user
870 // the user goes through the real signin flow to generate a new auth token. 872 // session to fix an auth error, so the user goes through the real signin flow
873 // to generate a new auth token.
871 void SyncSetupHandler::HandleDoSignOutOnAuthError(const ListValue* args) { 874 void SyncSetupHandler::HandleDoSignOutOnAuthError(const ListValue* args) {
872 DLOG(INFO) << "Signing out the user to fix a sync error."; 875 DLOG(INFO) << "Signing out the user to fix a sync error.";
876 chromeos::UserManager::Get()->SaveUserOAuthStatus(
877 chromeos::UserManager::Get()->GetLoggedInUser()->email(),
878 chromeos::User::OAUTH2_TOKEN_STATUS_INVALID);
873 chrome::AttemptUserExit(); 879 chrome::AttemptUserExit();
874 } 880 }
875 #endif 881 #endif
876 882
877 #if !defined(OS_CHROMEOS) 883 #if !defined(OS_CHROMEOS)
878 void SyncSetupHandler::HandleStartSignin(const ListValue* args) { 884 void SyncSetupHandler::HandleStartSignin(const ListValue* args) {
879 // Should only be called if the user is not already signed in. 885 // Should only be called if the user is not already signed in.
880 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())-> 886 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())->
881 GetAuthenticatedUsername().empty()); 887 GetAuthenticatedUsername().empty());
882 OpenSyncSetup(); 888 OpenSyncSetup();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 return LoginUIServiceFactory::GetForProfile(GetProfile()); 1099 return LoginUIServiceFactory::GetForProfile(GetProfile());
1094 } 1100 }
1095 1101
1096 void SyncSetupHandler::CloseOverlay() { 1102 void SyncSetupHandler::CloseOverlay() {
1097 // Stop a timer to handle timeout in waiting for sync setup. 1103 // Stop a timer to handle timeout in waiting for sync setup.
1098 backend_start_timer_.reset(); 1104 backend_start_timer_.reset();
1099 1105
1100 CloseSyncSetup(); 1106 CloseSyncSetup();
1101 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); 1107 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay");
1102 } 1108 }
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