| 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 <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 26 matching lines...) Expand all Loading... |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace gcm { | 39 namespace gcm { |
| 40 | 40 |
| 41 #if !defined(OS_ANDROID) | 41 #if !defined(OS_ANDROID) |
| 42 // Identity observer only has actual work to do when the user is actually signed | 42 // Identity observer only has actual work to do when the user is actually signed |
| 43 // in. It ensures that account tracker is taking | 43 // in. It ensures that account tracker is taking |
| 44 class GCMProfileService::IdentityObserver : public IdentityProvider::Observer { | 44 class GCMProfileService::IdentityObserver : public IdentityProvider::Observer { |
| 45 public: | 45 public: |
| 46 IdentityObserver(Profile* profile, GCMDriver* driver); | 46 IdentityObserver(Profile* profile, GCMDriver* driver); |
| 47 virtual ~IdentityObserver(); | 47 ~IdentityObserver() override; |
| 48 | 48 |
| 49 // IdentityProvider::Observer: | 49 // IdentityProvider::Observer: |
| 50 virtual void OnActiveAccountLogin() override; | 50 void OnActiveAccountLogin() override; |
| 51 virtual void OnActiveAccountLogout() override; | 51 void OnActiveAccountLogout() override; |
| 52 | 52 |
| 53 std::string SignedInUserName() const; | 53 std::string SignedInUserName() const; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 void StartAccountTracker(); | 56 void StartAccountTracker(); |
| 57 | 57 |
| 58 Profile* profile_; | 58 Profile* profile_; |
| 59 GCMDriver* driver_; | 59 GCMDriver* driver_; |
| 60 scoped_ptr<IdentityProvider> identity_provider_; | 60 scoped_ptr<IdentityProvider> identity_provider_; |
| 61 scoped_ptr<GCMAccountTracker> gcm_account_tracker_; | 61 scoped_ptr<GCMAccountTracker> gcm_account_tracker_; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { | 226 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { |
| 227 driver_.reset(driver); | 227 driver_.reset(driver); |
| 228 #if !defined(OS_ANDROID) | 228 #if !defined(OS_ANDROID) |
| 229 if (identity_observer_) | 229 if (identity_observer_) |
| 230 identity_observer_.reset(new IdentityObserver(profile_, driver)); | 230 identity_observer_.reset(new IdentityObserver(profile_, driver)); |
| 231 #endif // !defined(OS_ANDROID) | 231 #endif // !defined(OS_ANDROID) |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace gcm | 234 } // namespace gcm |
| OLD | NEW |