Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service.h

Issue 955673004: Move gcm-independent parts of push messaging out of gcm namespace and directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test++ Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/services/gcm/push_messaging_service_impl.h"
14 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
15 14
16 class Profile; 15 class Profile;
17 16
18 namespace user_prefs { 17 namespace user_prefs {
19 class PrefRegistrySyncable; 18 class PrefRegistrySyncable;
20 } 19 }
21 20
22 namespace gcm { 21 namespace gcm {
23 22
24 class GCMClientFactory; 23 class GCMClientFactory;
25 class GCMDriver; 24 class GCMDriver;
26 25
27 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
28 class GCMConnectionObserver; 27 class GCMConnectionObserver;
29 #endif 28 #endif
30 29
31 // Providing GCM service, via GCMDriver, to a profile. 30 // Providing GCM service, via GCMDriver, to a profile.
32 class GCMProfileService : public KeyedService { 31 class GCMProfileService : public KeyedService {
33 public: 32 public:
34 // Returns whether GCM is enabled for |profile|. 33 // Returns whether GCM is enabled for |profile|.
35 static bool IsGCMEnabled(Profile* profile); 34 static bool IsGCMEnabled(Profile* profile);
36 35
37 // Register profile-specific prefs for GCM.
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39
40 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
41 explicit GCMProfileService(Profile* profile); 37 explicit GCMProfileService(Profile* profile);
42 #else 38 #else
43 GCMProfileService(Profile* profile, 39 GCMProfileService(Profile* profile,
44 scoped_ptr<GCMClientFactory> gcm_client_factory); 40 scoped_ptr<GCMClientFactory> gcm_client_factory);
45 #endif 41 #endif
46 ~GCMProfileService() override; 42 ~GCMProfileService() override;
47 43
48 // KeyedService: 44 // KeyedService:
49 void Shutdown() override; 45 void Shutdown() override;
50 46
51 // For testing purpose. 47 // For testing purpose.
52 void SetDriverForTesting(GCMDriver* driver); 48 void SetDriverForTesting(GCMDriver* driver);
53 49
54 GCMDriver* driver() const { return driver_.get(); } 50 GCMDriver* driver() const { return driver_.get(); }
55 51
56 content::PushMessagingService* push_messaging_service() {
57 return &push_messaging_service_;
58 }
59
60 protected: 52 protected:
61 // Used for constructing fake GCMProfileService for testing purpose. 53 // Used for constructing fake GCMProfileService for testing purpose.
62 GCMProfileService(); 54 GCMProfileService();
63 55
64 private: 56 private:
65 // The profile which owns this object. 57 // The profile which owns this object.
66 Profile* profile_; 58 Profile* profile_;
67 59
68 scoped_ptr<GCMDriver> driver_; 60 scoped_ptr<GCMDriver> driver_;
69 61
70 // Implementation of content::PushMessagingService using GCMProfileService.
71 PushMessagingServiceImpl push_messaging_service_;
72
73 // Used for both account tracker and GCM.UserSignedIn UMA. 62 // Used for both account tracker and GCM.UserSignedIn UMA.
74 #if !defined(OS_ANDROID) 63 #if !defined(OS_ANDROID)
75 class IdentityObserver; 64 class IdentityObserver;
76 scoped_ptr<IdentityObserver> identity_observer_; 65 scoped_ptr<IdentityObserver> identity_observer_;
77 #endif 66 #endif
78 67
79 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); 68 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
80 }; 69 };
81 70
82 } // namespace gcm 71 } // namespace gcm
83 72
84 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 73 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698