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

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: buildfix push_messaging_application_id_unittest 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" 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 FakeGCMProfileService;
24 class GCMClientFactory; 25 class GCMClientFactory;
25 class GCMDriver; 26 class GCMDriver;
26 27
27 #if defined(OS_CHROMEOS) 28 #if defined(OS_CHROMEOS)
28 class GCMConnectionObserver; 29 class GCMConnectionObserver;
29 #endif 30 #endif
30 31
31 // Providing GCM service, via GCMDriver, to a profile. 32 // Providing GCM service, via GCMDriver, to a profile.
32 class GCMProfileService : public KeyedService { 33 class GCMProfileService : public KeyedService {
33 public: 34 public:
34 // Returns whether GCM is enabled for |profile|. 35 // Returns whether GCM is enabled for |profile|.
35 static bool IsGCMEnabled(Profile* profile); 36 static bool IsGCMEnabled(Profile* profile);
36 37
37 // Register profile-specific prefs for GCM.
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
39
40 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
41 explicit GCMProfileService(Profile* profile); 39 explicit GCMProfileService(Profile* profile);
42 #else 40 #else
43 GCMProfileService(Profile* profile, 41 GCMProfileService(Profile* profile,
44 scoped_ptr<GCMClientFactory> gcm_client_factory); 42 scoped_ptr<GCMClientFactory> gcm_client_factory);
45 #endif 43 #endif
46 ~GCMProfileService() override; 44 ~GCMProfileService() override;
47 45
48 // KeyedService: 46 // KeyedService:
49 void Shutdown() override; 47 void Shutdown() override;
50 48
51 // For testing purpose. 49 // For testing purpose.
52 void SetDriverForTesting(GCMDriver* driver); 50 void SetDriverForTesting(GCMDriver* driver);
51 virtual FakeGCMProfileService* AsFakeGCMProfileService();
Peter Beverloo 2015/03/03 15:54:18 I'm not a huge fan of this. Could we perhaps just
53 52
54 GCMDriver* driver() const { return driver_.get(); } 53 GCMDriver* driver() const { return driver_.get(); }
55 54
56 content::PushMessagingService* push_messaging_service() {
57 return &push_messaging_service_;
58 }
59
60 protected: 55 protected:
61 // Used for constructing fake GCMProfileService for testing purpose. 56 // Used for constructing fake GCMProfileService for testing purpose.
62 GCMProfileService(); 57 GCMProfileService();
63 58
64 private: 59 private:
65 // The profile which owns this object. 60 // The profile which owns this object.
66 Profile* profile_; 61 Profile* profile_;
67 62
68 scoped_ptr<GCMDriver> driver_; 63 scoped_ptr<GCMDriver> driver_;
69 64
70 // Implementation of content::PushMessagingService using GCMProfileService.
71 PushMessagingServiceImpl push_messaging_service_;
72
73 // Used for both account tracker and GCM.UserSignedIn UMA. 65 // Used for both account tracker and GCM.UserSignedIn UMA.
74 #if !defined(OS_ANDROID) 66 #if !defined(OS_ANDROID)
75 class IdentityObserver; 67 class IdentityObserver;
76 scoped_ptr<IdentityObserver> identity_observer_; 68 scoped_ptr<IdentityObserver> identity_observer_;
77 #endif 69 #endif
78 70
79 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); 71 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
80 }; 72 };
81 73
82 } // namespace gcm 74 } // namespace gcm
83 75
84 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 76 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698