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

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: moving all of push_messaging out Created 5 years, 10 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" 13 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
14 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 namespace user_prefs { 18 namespace user_prefs {
19 class PrefRegistrySyncable; 19 class PrefRegistrySyncable;
20 } 20 }
21 21
22 namespace gcm { 22 namespace gcm {
23 23
24 class GCMClientFactory; 24 class GCMClientFactory;
25 class GCMDriver; 25 class GCMDriver;
26 26
27 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
28 class GCMConnectionObserver; 28 class GCMConnectionObserver;
29 #endif 29 #endif
30 30
31 // Providing GCM service, via GCMDriver, to a profile. 31 // Providing GCM service, via GCMDriver, to a profile.
32 class GCMProfileService : public KeyedService { 32 class GCMProfileService : public KeyedService {
33 public: 33 public:
34 // Returns whether GCM is enabled for |profile|. 34 // Returns whether GCM is enabled for |profile|.
35 static bool IsGCMEnabled(Profile* profile); 35 static bool IsGCMEnabled(Profile* profile);
36 36
37 // Register profile-specific prefs for GCM.
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39
40 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
41 explicit GCMProfileService(Profile* profile); 38 explicit GCMProfileService(Profile* profile);
42 #else 39 #else
43 GCMProfileService(Profile* profile, 40 GCMProfileService(Profile* profile,
44 scoped_ptr<GCMClientFactory> gcm_client_factory); 41 scoped_ptr<GCMClientFactory> gcm_client_factory);
45 #endif 42 #endif
46 ~GCMProfileService() override; 43 ~GCMProfileService() override;
47 44
48 // KeyedService: 45 // KeyedService:
49 void Shutdown() override; 46 void Shutdown() override;
50 47
51 // For testing purpose. 48 // For testing purpose.
52 void SetDriverForTesting(GCMDriver* driver); 49 void SetDriverForTesting(GCMDriver* driver);
53 50
54 GCMDriver* driver() const { return driver_.get(); } 51 GCMDriver* driver() const { return driver_.get(); }
55 52
56 content::PushMessagingService* push_messaging_service() {
57 return &push_messaging_service_;
58 }
59
60 protected: 53 protected:
61 // Used for constructing fake GCMProfileService for testing purpose. 54 // Used for constructing fake GCMProfileService for testing purpose.
62 GCMProfileService(); 55 GCMProfileService();
63 56
64 private: 57 private:
65 // The profile which owns this object. 58 // The profile which owns this object.
66 Profile* profile_; 59 Profile* profile_;
67 60
68 scoped_ptr<GCMDriver> driver_; 61 scoped_ptr<GCMDriver> driver_;
69 62
70 // Implementation of content::PushMessagingService using GCMProfileService.
71 PushMessagingServiceImpl push_messaging_service_;
72
73 // Used for both account tracker and GCM.UserSignedIn UMA. 63 // Used for both account tracker and GCM.UserSignedIn UMA.
74 #if !defined(OS_ANDROID) 64 #if !defined(OS_ANDROID)
75 class IdentityObserver; 65 class IdentityObserver;
76 scoped_ptr<IdentityObserver> identity_observer_; 66 scoped_ptr<IdentityObserver> identity_observer_;
77 #endif 67 #endif
78 68
79 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); 69 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
80 }; 70 };
81 71
82 } // namespace gcm 72 } // namespace gcm
83 73
84 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 74 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698