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/compiler_specific.h" | |
11 #include "base/macros.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/keyed_service/core/keyed_service.h" | |
14 | |
15 class Profile; | |
16 | |
17 namespace user_prefs { | |
18 class PrefRegistrySyncable; | |
19 } | |
20 | |
21 namespace gcm { | |
22 | |
23 class GCMClientFactory; | |
24 class GCMDriver; | |
25 | |
26 #if defined(OS_CHROMEOS) | |
27 class GCMConnectionObserver; | |
28 #endif | |
29 | |
30 // Providing GCM service, via GCMDriver, to a profile. | |
31 class GCMProfileService : public KeyedService { | |
32 public: | |
33 // Returns whether GCM is enabled for |profile|. | |
34 static bool IsGCMEnabled(Profile* profile); | |
35 | |
36 #if defined(OS_ANDROID) | |
37 explicit GCMProfileService(Profile* profile); | |
38 #else | |
39 GCMProfileService(Profile* profile, | |
40 scoped_ptr<GCMClientFactory> gcm_client_factory); | |
41 #endif | |
42 ~GCMProfileService() override; | |
43 | |
44 // KeyedService: | |
45 void Shutdown() override; | |
46 | |
47 // For testing purpose. | |
48 void SetDriverForTesting(GCMDriver* driver); | |
49 | |
50 GCMDriver* driver() const { return driver_.get(); } | |
51 | |
52 protected: | |
53 // Used for constructing fake GCMProfileService for testing purpose. | |
54 GCMProfileService(); | |
55 | |
56 private: | |
57 // The profile which owns this object. | |
58 Profile* profile_; | |
59 | |
60 scoped_ptr<GCMDriver> driver_; | |
61 | |
62 // Used for both account tracker and GCM.UserSignedIn UMA. | |
63 #if !defined(OS_ANDROID) | |
64 class IdentityObserver; | |
65 scoped_ptr<IdentityObserver> identity_observer_; | |
66 #endif | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | |
69 }; | |
70 | |
71 } // namespace gcm | |
72 | |
73 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | |
OLD | NEW |