OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_PROFILE_SERVICE_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_GCM_PROFILE_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "components/signin/core/browser/profile_identity_provider.h" |
| 18 #include "components/version_info/version_info.h" |
| 19 |
| 20 class PrefService; |
| 21 class ProfileOAuth2TokenService; |
| 22 class SigninManagerBase; |
| 23 |
| 24 namespace base { |
| 25 class SequencedTaskRunner; |
| 26 } |
| 27 |
| 28 namespace net { |
| 29 class URLRequestContextGetter; |
| 30 } |
| 31 |
| 32 namespace user_prefs { |
| 33 class PrefRegistrySyncable; |
| 34 } |
| 35 |
| 36 namespace gcm { |
| 37 |
| 38 class GCMClientFactory; |
| 39 class GCMDriver; |
| 40 |
| 41 #if defined(OS_CHROMEOS) |
| 42 class GCMConnectionObserver; |
| 43 #endif |
| 44 |
| 45 // Providing GCM service, via GCMDriver. |
| 46 class GCMProfileService : public KeyedService { |
| 47 public: |
| 48 #if defined(OS_ANDROID) |
| 49 GCMProfileService( |
| 50 base::FilePath path, |
| 51 scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
| 52 #else |
| 53 GCMProfileService( |
| 54 PrefService* prefs, |
| 55 base::FilePath path, |
| 56 net::URLRequestContextGetter* request_context, |
| 57 version_info::Channel channel, |
| 58 scoped_ptr<ProfileIdentityProvider> identity_provider, |
| 59 scoped_ptr<GCMClientFactory> gcm_client_factory, |
| 60 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| 61 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
| 62 scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
| 63 #endif |
| 64 ~GCMProfileService() override; |
| 65 |
| 66 // Returns whether GCM is enabled. |
| 67 static bool IsGCMEnabled(PrefService* prefs); |
| 68 |
| 69 // KeyedService: |
| 70 void Shutdown() override; |
| 71 |
| 72 // For testing purpose. |
| 73 void SetDriverForTesting(const base::Closure& login_callback, |
| 74 GCMDriver* driver); |
| 75 |
| 76 GCMDriver* driver() const { return driver_.get(); } |
| 77 |
| 78 protected: |
| 79 // Used for constructing fake GCMProfileService for testing purpose. |
| 80 GCMProfileService(); |
| 81 |
| 82 private: |
| 83 net::URLRequestContextGetter* request_context_; |
| 84 scoped_ptr<ProfileIdentityProvider> profile_identity_provider_; |
| 85 |
| 86 scoped_ptr<GCMDriver> driver_; |
| 87 |
| 88 // Used for both account tracker and GCM.UserSignedIn UMA. |
| 89 #if !defined(OS_ANDROID) |
| 90 class IdentityObserver; |
| 91 scoped_ptr<IdentityObserver> identity_observer_; |
| 92 #endif |
| 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
| 95 }; |
| 96 |
| 97 } // namespace gcm |
| 98 |
| 99 #endif // COMPONENTS_GCM_DRIVER_GCM_PROFILE_SERVICE_H_ |
| 100 |
OLD | NEW |