Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); | 114 account_id_.clear(); |
| 115 | 115 |
| 116 // Check is necessary to not crash browser_tests. | 116 // Check is necessary to not crash browser_tests. |
| 117 if (gcm_account_tracker_) | 117 if (gcm_account_tracker_) |
| 118 gcm_account_tracker_->Stop(); | 118 gcm_account_tracker_->Stop(); |
| 119 // TODO(fgorski): If we purge here, what should happen when we get | 119 // OnSignedOut will also clear all the GCM data. If the user signs in again, |
| 120 // OnActiveAccountLogin() right after that? | 120 // a new GCM ID will be retrieved. |
| 121 driver_->Purge(); | 121 driver_->OnSignedOut(); |
|
fgorski
2014/09/12 20:15:53
If we are not changing Device Id in this case, ple
jianli
2014/09/12 22:13:10
Updated the comment.
| |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::string GCMProfileService::IdentityObserver::SignedInUserName() const { | 124 std::string GCMProfileService::IdentityObserver::SignedInUserName() const { |
| 125 return driver_->IsStarted() ? account_id_ : std::string(); | 125 return driver_->IsStarted() ? account_id_ : std::string(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void GCMProfileService::IdentityObserver::AccountsUpdated( | 128 void GCMProfileService::IdentityObserver::AccountsUpdated( |
| 129 const std::map<std::string, std::string>& account_tokens) { | 129 const std::map<std::string, std::string>& account_tokens) { |
| 130 driver_->SetAccountsForCheckin(account_tokens); | 130 driver_->SetAccountsForCheckin(account_tokens); |
| 131 } | 131 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 return identity_observer_ ? identity_observer_->SignedInUserName() | 216 return identity_observer_ ? identity_observer_->SignedInUserName() |
| 217 : std::string(); | 217 : std::string(); |
| 218 #endif // defined(OS_ANDROID) | 218 #endif // defined(OS_ANDROID) |
| 219 } | 219 } |
| 220 | 220 |
| 221 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { | 221 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { |
| 222 driver_.reset(driver); | 222 driver_.reset(driver); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace gcm | 225 } // namespace gcm |
| OLD | NEW |