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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 | 346 |
347 void SigninManager::SignOut() { | 347 void SigninManager::SignOut() { |
348 DCHECK(IsInitialized()); | 348 DCHECK(IsInitialized()); |
349 if (authenticated_username_.empty() && !client_login_.get()) { | 349 if (authenticated_username_.empty() && !client_login_.get()) { |
350 // Just exit if we aren't signed in (or in the process of signing in). | 350 // Just exit if we aren't signed in (or in the process of signing in). |
351 // This avoids a perf regression because SignOut() is invoked on startup to | 351 // This avoids a perf regression because SignOut() is invoked on startup to |
352 // clean up any incomplete previous signin attempts. | 352 // clean up any incomplete previous signin attempts. |
353 return; | 353 return; |
354 } | 354 } |
| 355 content::NotificationService::current()->Notify( |
| 356 chrome::NOTIFICATION_GOOGLE_WILL_SIGN_OUT, |
| 357 content::Source<Profile>(profile_), |
| 358 content::NotificationService::NoDetails()); |
355 | 359 |
356 ClearTransientSigninData(); | 360 ClearTransientSigninData(); |
357 authenticated_username_.clear(); | 361 authenticated_username_.clear(); |
358 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 362 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
359 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); | 363 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); |
360 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); | 364 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); |
361 token_service->ResetCredentialsInMemory(); | 365 token_service->ResetCredentialsInMemory(); |
362 token_service->EraseTokensFromDB(); | 366 token_service->EraseTokensFromDB(); |
363 content::NotificationService::current()->Notify( | 367 content::NotificationService::current()->Notify( |
364 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 368 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 CleanupNotificationRegistration(); | 534 CleanupNotificationRegistration(); |
531 } | 535 } |
532 break; | 536 break; |
533 } | 537 } |
534 #endif | 538 #endif |
535 default: | 539 default: |
536 NOTREACHED(); | 540 NOTREACHED(); |
537 } | 541 } |
538 } | 542 } |
539 | 543 |
OLD | NEW |