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 CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | |
6 #define CHROME_BROWSER_SERVICES_GCM_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 // Returns whether GCM is enabled. | |
49 static bool IsGCMEnabled(PrefService* prefs); | |
50 | |
51 #if defined(OS_ANDROID) | |
Nicolas Zea
2015/10/29 17:27:12
I wonder if it would be better to have a separate
| |
52 explicit GCMProfileService( | |
53 base::FilePath path, | |
Nicolas Zea
2015/10/29 17:27:12
nit: pass by const ref? (in the non-android versio
Jitu( very slow this week)
2015/10/30 04:31:31
Done.
| |
54 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | |
55 #else | |
56 GCMProfileService( | |
57 PrefService* prefs, | |
58 base::FilePath path, | |
59 net::URLRequestContextGetter* request_context, | |
60 version_info::Channel channel, | |
61 scoped_ptr<ProfileIdentityProvider> identity_provider, | |
62 scoped_ptr<GCMClientFactory> gcm_client_factory, | |
63 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | |
64 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | |
65 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | |
66 #endif | |
67 ~GCMProfileService() override; | |
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 // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | |
OLD | NEW |