OLD | NEW |
---|---|
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/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 DCHECK(IsInitialized()); | 354 DCHECK(IsInitialized()); |
355 if (authenticated_username_.empty() && !client_login_.get()) { | 355 if (authenticated_username_.empty() && !client_login_.get()) { |
356 // Just exit if we aren't signed in (or in the process of signing in). | 356 // Just exit if we aren't signed in (or in the process of signing in). |
357 // This avoids a perf regression because SignOut() is invoked on startup to | 357 // This avoids a perf regression because SignOut() is invoked on startup to |
358 // clean up any incomplete previous signin attempts. | 358 // clean up any incomplete previous signin attempts. |
359 return; | 359 return; |
360 } | 360 } |
361 | 361 |
362 GoogleServiceSignoutDetails details(authenticated_username_); | 362 GoogleServiceSignoutDetails details(authenticated_username_); |
363 | 363 |
364 content::NotificationService::current()->Notify( | |
365 chrome::NOTIFICATION_GOOGLE_WILL_SIGN_OUT, | |
366 content::Source<Profile>(profile_), | |
367 content::Details<const GoogleServiceSignoutDetails>(&details)); | |
Andrew T Wilson (Slow)
2012/11/08 13:43:54
I'm not a huge fan of having this extra notificati
| |
364 ClearTransientSigninData(); | 368 ClearTransientSigninData(); |
365 authenticated_username_.clear(); | 369 authenticated_username_.clear(); |
366 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 370 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
367 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); | 371 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); |
368 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); | 372 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); |
369 token_service->ResetCredentialsInMemory(); | 373 token_service->ResetCredentialsInMemory(); |
370 token_service->EraseTokensFromDB(); | 374 token_service->EraseTokensFromDB(); |
371 content::NotificationService::current()->Notify( | 375 content::NotificationService::current()->Notify( |
372 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 376 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
373 content::Source<Profile>(profile_), | 377 content::Source<Profile>(profile_), |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 void SigninManager::OnPreferenceChanged(PrefServiceBase* service, | 544 void SigninManager::OnPreferenceChanged(PrefServiceBase* service, |
541 const std::string& pref_name) { | 545 const std::string& pref_name) { |
542 DCHECK_EQ(std::string(prefs::kGoogleServicesUsernamePattern), pref_name); | 546 DCHECK_EQ(std::string(prefs::kGoogleServicesUsernamePattern), pref_name); |
543 if (!authenticated_username_.empty() && | 547 if (!authenticated_username_.empty() && |
544 !IsAllowedUsername(authenticated_username_)) { | 548 !IsAllowedUsername(authenticated_username_)) { |
545 // Signed in user is invalid according to the current policy so sign | 549 // Signed in user is invalid according to the current policy so sign |
546 // the user out. | 550 // the user out. |
547 SignOut(); | 551 SignOut(); |
548 } | 552 } |
549 } | 553 } |
OLD | NEW |