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

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

Issue 617003005: Keep the GCM data intact when the user signs out of the profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 <vector> 7 #include <vector>
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 gcm_account_tracker_->Start(); 114 gcm_account_tracker_->Start();
115 } 115 }
116 116
117 void GCMProfileService::IdentityObserver::OnActiveAccountLogout() { 117 void GCMProfileService::IdentityObserver::OnActiveAccountLogout() {
118 account_id_.clear(); 118 account_id_.clear();
119 119
120 // Check is necessary to not crash browser_tests. 120 // Check is necessary to not crash browser_tests.
121 if (gcm_account_tracker_) 121 if (gcm_account_tracker_)
122 gcm_account_tracker_->Stop(); 122 gcm_account_tracker_->Stop();
123 // TODO(fgorski): If we purge here, what should happen when we get 123 // When sign-in enforcement is not dropped, OnSignedOut will also clear all
124 // OnActiveAccountLogin() right after that? 124 // the GCM data and a new GCM ID will be retrieved after the user signs in
125 driver_->Purge(); 125 // again. Otherwise, the user sign-out will not affect the existing GCM
126 // data.
127 driver_->OnSignedOut();
126 } 128 }
127 129
128 std::string GCMProfileService::IdentityObserver::SignedInUserName() const { 130 std::string GCMProfileService::IdentityObserver::SignedInUserName() const {
129 return driver_->IsStarted() ? account_id_ : std::string(); 131 return driver_->IsStarted() ? account_id_ : std::string();
130 } 132 }
131 133
132 void GCMProfileService::IdentityObserver::AccountsUpdated( 134 void GCMProfileService::IdentityObserver::AccountsUpdated(
133 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) { 135 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) {
134 driver_->SetAccountTokens(account_tokens); 136 driver_->SetAccountTokens(account_tokens);
135 } 137 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 return identity_observer_ ? identity_observer_->SignedInUserName() 230 return identity_observer_ ? identity_observer_->SignedInUserName()
229 : std::string(); 231 : std::string();
230 #endif // defined(OS_ANDROID) 232 #endif // defined(OS_ANDROID)
231 } 233 }
232 234
233 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 235 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
234 driver_.reset(driver); 236 driver_.reset(driver);
235 } 237 }
236 238
237 } // namespace gcm 239 } // 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