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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service.cc

Issue 535393002: Clear GCMProfileService::account_id_ when signing out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_profile_service_unittest.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/services/gcm/gcm_profile_service.h" 5 #include "chrome/browser/services/gcm/gcm_profile_service.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 gcm_account_tracker_.reset(new GCMAccountTracker( 104 gcm_account_tracker_.reset(new GCMAccountTracker(
105 gaia_account_tracker.Pass(), 105 gaia_account_tracker.Pass(),
106 base::Bind(&GCMProfileService::IdentityObserver::AccountsUpdated, 106 base::Bind(&GCMProfileService::IdentityObserver::AccountsUpdated,
107 weak_ptr_factory_.GetWeakPtr()))); 107 weak_ptr_factory_.GetWeakPtr())));
108 } 108 }
109 109
110 gcm_account_tracker_->Start(); 110 gcm_account_tracker_->Start();
111 } 111 }
112 112
113 void GCMProfileService::IdentityObserver::OnActiveAccountLogout() { 113 void GCMProfileService::IdentityObserver::OnActiveAccountLogout() {
114 account_id_.clear();
115
114 // Check is necessary to not crash browser_tests. 116 // Check is necessary to not crash browser_tests.
115 if (gcm_account_tracker_) 117 if (gcm_account_tracker_)
116 gcm_account_tracker_->Stop(); 118 gcm_account_tracker_->Stop();
117 // TODO(fgorski): If we purge here, what should happen when we get 119 // TODO(fgorski): If we purge here, what should happen when we get
118 // OnActiveAccountLogin() right after that? 120 // OnActiveAccountLogin() right after that?
119 driver_->Purge(); 121 driver_->Purge();
120 } 122 }
121 123
122 std::string GCMProfileService::IdentityObserver::SignedInUserName() const { 124 std::string GCMProfileService::IdentityObserver::SignedInUserName() const {
123 return driver_->IsStarted() ? account_id_ : std::string(); 125 return driver_->IsStarted() ? account_id_ : std::string();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return identity_observer_ ? identity_observer_->SignedInUserName() 216 return identity_observer_ ? identity_observer_->SignedInUserName()
215 : std::string(); 217 : std::string();
216 #endif // defined(OS_ANDROID) 218 #endif // defined(OS_ANDROID)
217 } 219 }
218 220
219 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 221 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
220 driver_.reset(driver); 222 driver_.reset(driver);
221 } 223 }
222 224
223 } // namespace gcm 225 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_profile_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698