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

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 review comments and UT error 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.h"
droger 2015/10/28 08:30:57 base/callback_forward.h may be enough
Jitu( very slow this week) 2015/10/28 13:35:14 Done.
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "components/keyed_service/core/keyed_service.h"
16 #include "components/version_info/version_info.h"
17
18 class PrefService;
19 class ProfileOAuth2TokenService;
20 class SigninManagerBase;
21
22 namespace base {
23 class SequencedTaskRunner;
24 }
25
26 namespace net {
27 class URLRequestContextGetter;
28 }
29
30 namespace user_prefs {
31 class PrefRegistrySyncable;
32 }
33
34 namespace gcm {
35
36 class GCMClientFactory;
37 class GCMDriver;
38
39 #if defined(OS_CHROMEOS)
40 class GCMConnectionObserver;
41 #endif
42
43 // Providing GCM service, via GCMDriver.
44 class GCMProfileService : public KeyedService {
45 public:
46 // Returns whether GCM is enabled.
47 static bool IsGCMEnabled(PrefService* prefs);
48
49 #if defined(OS_ANDROID)
50 explicit GCMProfileService(
51 base::FilePath path,
52 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
53 #else
54 GCMProfileService(
55 PrefService* prefs,
56 base::FilePath path,
57 net::URLRequestContextGetter* request_context,
58 version_info::Channel channel,
59 SigninManagerBase* signin_manager,
60 ProfileOAuth2TokenService* profile_o_auth_2_token_service,
61 const base::Closure& login_callback,
62 scoped_ptr<GCMClientFactory> gcm_client_factory,
63 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
64 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
65 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
66 #endif
67 ~GCMProfileService() override;
68
69 // KeyedService:
70 void Shutdown() override;
71
72 // For testing purpose.
73 void SetDriverForTesting(const base::Closure& login_callback,
74 GCMDriver* driver);
75
76 GCMDriver* driver() const { return driver_.get(); }
77
78 protected:
79 // Used for constructing fake GCMProfileService for testing purpose.
80 GCMProfileService();
81
82 private:
83 SigninManagerBase* signin_manager_;
84 ProfileOAuth2TokenService* profile_o_auth_2_token_service_;
85 net::URLRequestContextGetter* request_context_;
86
87 scoped_ptr<GCMDriver> driver_;
88
89 // Used for both account tracker and GCM.UserSignedIn UMA.
90 #if !defined(OS_ANDROID)
91 class IdentityObserver;
92 scoped_ptr<IdentityObserver> identity_observer_;
93 #endif
94
95 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
96 };
97
98 } // namespace gcm
99
100 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698