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

Side by Side Diff: chrome/browser/chromeos/login/signin/auth_sync_observer.cc

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/signin/auth_sync_observer.h" 5 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h"
6 6
7 #include "base/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "base/metrics/user_metrics_action.h" 8 #include "base/metrics/user_metrics_action.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
(...skipping 30 matching lines...) Expand all
41 ProfileSyncServiceFactory::GetForProfile(profile_); 41 ProfileSyncServiceFactory::GetForProfile(profile_);
42 if (sync_service) 42 if (sync_service)
43 sync_service->RemoveObserver(this); 43 sync_service->RemoveObserver(this);
44 } 44 }
45 45
46 void AuthSyncObserver::OnStateChanged() { 46 void AuthSyncObserver::OnStateChanged() {
47 DCHECK(user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount() || 47 DCHECK(user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount() ||
48 user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()); 48 user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser());
49 ProfileSyncService* sync_service = 49 ProfileSyncService* sync_service =
50 ProfileSyncServiceFactory::GetForProfile(profile_); 50 ProfileSyncServiceFactory::GetForProfile(profile_);
51 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile_); 51 const user_manager::User* user =
52 ProfileHelper::Get()->GetUserByProfile(profile_);
52 GoogleServiceAuthError::State state = 53 GoogleServiceAuthError::State state =
53 sync_service->GetAuthError().state(); 54 sync_service->GetAuthError().state();
54 if (state != GoogleServiceAuthError::NONE && 55 if (state != GoogleServiceAuthError::NONE &&
55 state != GoogleServiceAuthError::CONNECTION_FAILED && 56 state != GoogleServiceAuthError::CONNECTION_FAILED &&
56 state != GoogleServiceAuthError::SERVICE_UNAVAILABLE && 57 state != GoogleServiceAuthError::SERVICE_UNAVAILABLE &&
57 state != GoogleServiceAuthError::REQUEST_CANCELED) { 58 state != GoogleServiceAuthError::REQUEST_CANCELED) {
58 // Invalidate OAuth2 refresh token to force Gaia sign-in flow. This is 59 // Invalidate OAuth2 refresh token to force Gaia sign-in flow. This is
59 // needed because sign-out/sign-in solution is suggested to the user. 60 // needed because sign-out/sign-in solution is suggested to the user.
60 // TODO(nkostylev): Remove after crosbug.com/25978 is implemented. 61 // TODO(nkostylev): Remove after crosbug.com/25978 is implemented.
61 LOG(WARNING) << "Invalidate OAuth token because of a sync error: " 62 LOG(WARNING) << "Invalidate OAuth token because of a sync error: "
(...skipping 30 matching lines...) Expand all
92 } 93 }
93 } 94 }
94 } 95 }
95 96
96 void AuthSyncObserver::OnSupervisedTokenLoaded(const std::string& token) { 97 void AuthSyncObserver::OnSupervisedTokenLoaded(const std::string& token) {
97 ChromeUserManager::Get()->GetSupervisedUserManager()->ConfigureSyncWithToken( 98 ChromeUserManager::Get()->GetSupervisedUserManager()->ConfigureSyncWithToken(
98 profile_, token); 99 profile_, token);
99 } 100 }
100 101
101 } // namespace chromeos 102 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698