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

Side by Side Diff: chrome/browser/signin/signin_manager.cc

Issue 11312124: Send a notification when the signed-in user is about to sign out. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/signin/signin_manager_fake.cc » ('j') | 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/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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_manager_fake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698