OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 void AuthSyncObserver::Shutdown() { | 39 void AuthSyncObserver::Shutdown() { |
40 ProfileSyncService* sync_service = | 40 ProfileSyncService* sync_service = |
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()->IsLoggedInAsRegularUser() || | 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 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile_); |
52 GoogleServiceAuthError::State state = | 52 GoogleServiceAuthError::State state = |
53 sync_service->GetAuthError().state(); | 53 sync_service->GetAuthError().state(); |
54 if (state != GoogleServiceAuthError::NONE && | 54 if (state != GoogleServiceAuthError::NONE && |
55 state != GoogleServiceAuthError::CONNECTION_FAILED && | 55 state != GoogleServiceAuthError::CONNECTION_FAILED && |
56 state != GoogleServiceAuthError::SERVICE_UNAVAILABLE && | 56 state != GoogleServiceAuthError::SERVICE_UNAVAILABLE && |
57 state != GoogleServiceAuthError::REQUEST_CANCELED) { | 57 state != GoogleServiceAuthError::REQUEST_CANCELED) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 void AuthSyncObserver::OnSupervisedTokenLoaded(const std::string& token) { | 96 void AuthSyncObserver::OnSupervisedTokenLoaded(const std::string& token) { |
97 ChromeUserManager::Get()->GetSupervisedUserManager()->ConfigureSyncWithToken( | 97 ChromeUserManager::Get()->GetSupervisedUserManager()->ConfigureSyncWithToken( |
98 profile_, token); | 98 profile_, token); |
99 } | 99 } |
100 | 100 |
101 } // namespace chromeos | 101 } // namespace chromeos |
OLD | NEW |