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

Side by Side Diff: components/gcm_driver/gcm_profile_service.h

Issue 1425783002: Componentizing GcmProfileService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years, 1 month 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
(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/version_info/version_info.h"
18
19 class PrefService;
20 class ProfileOAuth2TokenService;
21 class SigninManagerBase;
22
23 namespace base {
24 class SequencedTaskRunner;
25 }
26
27 namespace net {
28 class URLRequestContextGetter;
29 }
30
31 namespace user_prefs {
32 class PrefRegistrySyncable;
33 }
34
35 namespace gcm {
36
37 class GCMClientFactory;
38 class GCMDriver;
39
40 #if defined(OS_CHROMEOS)
41 class GCMConnectionObserver;
42 #endif
43
44 // Providing GCM service, via GCMDriver.
45 class GCMProfileService : public KeyedService {
46 public:
47 // Returns whether GCM is enabled.
48 static bool IsGCMEnabled(PrefService* prefs);
49
50 #if defined(OS_ANDROID)
51 explicit GCMProfileService(
52 base::FilePath path,
53 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
54 #else
55 GCMProfileService(
56 PrefService* prefs,
57 base::FilePath path,
58 net::URLRequestContextGetter* request_context,
59 version_info::Channel channel,
60 SigninManagerBase* signin_manager,
61 ProfileOAuth2TokenService* profile_o_auth_2_token_service,
62 const base::Closure& login_callback,
63 scoped_ptr<GCMClientFactory> gcm_client_factory,
64 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
65 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
66 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
67 #endif
68 ~GCMProfileService() override;
69
70 // KeyedService:
71 void Shutdown() override;
72
73 // For testing purpose.
74 void SetDriverForTesting(const base::Closure& login_callback,
75 GCMDriver* driver);
76
77 GCMDriver* driver() const { return driver_.get(); }
78
79 protected:
80 // Used for constructing fake GCMProfileService for testing purpose.
81 GCMProfileService();
82
83 private:
84 SigninManagerBase* signin_manager_;
85 ProfileOAuth2TokenService* profile_o_auth_2_token_service_;
86 net::URLRequestContextGetter* request_context_;
87
88 scoped_ptr<GCMDriver> driver_;
89
90 // Used for both account tracker and GCM.UserSignedIn UMA.
91 #if !defined(OS_ANDROID)
92 class IdentityObserver;
93 scoped_ptr<IdentityObserver> identity_observer_;
94 #endif
95
96 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
97 };
98
99 } // namespace gcm
100
101 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698