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

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

Issue 196783002: Export a private webstore API to call into the new inline sign-in flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add API tests Created 6 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 | Annotate | Revision Log
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/services/gcm/default_gcm_app_handler.h" 17 #include "chrome/browser/services/gcm/default_gcm_app_handler.h"
18 #include "chrome/browser/signin/signin_manager_base.h" 18 #include "chrome/browser/signin/signin_manager_base.h"
19 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "google_apis/gcm/gcm_client.h" 23 #include "google_apis/gcm/gcm_client.h"
23 24
24 class Profile; 25 class Profile;
25 26
26 namespace base { 27 namespace base {
27 class Value; 28 class Value;
28 } 29 }
29 30
30 namespace user_prefs { 31 namespace user_prefs {
31 class PrefRegistrySyncable; 32 class PrefRegistrySyncable;
32 } 33 }
33 34
34 namespace gcm { 35 namespace gcm {
35 36
36 class GCMAppHandler; 37 class GCMAppHandler;
37 class GCMClientFactory; 38 class GCMClientFactory;
38 class GCMProfileServiceTestConsumer; 39 class GCMProfileServiceTestConsumer;
39 40
40 // Acts as a bridge between GCM API and GCMClient layer. It is profile based. 41 // Acts as a bridge between GCM API and GCMClient layer. It is profile based.
41 class GCMProfileService : public KeyedService, 42 class GCMProfileService : public KeyedService,
42 public content::NotificationObserver, 43 public content::NotificationObserver,
43 public SigninManagerBase::Observer { 44 public SigninManagerBase::Observer,
45 public SigninManagerFactory::Observer {
44 public: 46 public:
45 typedef base::Callback<void(const std::string& registration_id, 47 typedef base::Callback<void(const std::string& registration_id,
46 GCMClient::Result result)> RegisterCallback; 48 GCMClient::Result result)> RegisterCallback;
47 typedef base::Callback<void(const std::string& message_id, 49 typedef base::Callback<void(const std::string& message_id,
48 GCMClient::Result result)> SendCallback; 50 GCMClient::Result result)> SendCallback;
49 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; 51 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback;
50 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)> 52 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)>
51 RequestGCMStatisticsCallback; 53 RequestGCMStatisticsCallback;
52 54
53 // Any change made to this enum should have corresponding change in the 55 // Any change made to this enum should have corresponding change in the
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Overridden from content::NotificationObserver: 142 // Overridden from content::NotificationObserver:
141 virtual void Observe(int type, 143 virtual void Observe(int type,
142 const content::NotificationSource& source, 144 const content::NotificationSource& source,
143 const content::NotificationDetails& details) OVERRIDE; 145 const content::NotificationDetails& details) OVERRIDE;
144 146
145 // Overridden from SigninManagerBase::Observer: 147 // Overridden from SigninManagerBase::Observer:
146 virtual void GoogleSigninSucceeded(const std::string& username, 148 virtual void GoogleSigninSucceeded(const std::string& username,
147 const std::string& password) OVERRIDE; 149 const std::string& password) OVERRIDE;
148 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; 150 virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
149 151
152 // Overridden from SigninManagerFactory::Observer:
153 virtual void SigninManagerCreated(SigninManagerBase* manager) OVERRIDE;
154 virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE;
155
150 // Ensures that the GCMClient is loaded and the GCM check-in is done when 156 // Ensures that the GCMClient is loaded and the GCM check-in is done when
151 // the profile was signed in. 157 // the profile was signed in.
152 void EnsureLoaded(); 158 void EnsureLoaded();
153 159
154 // Remove cached data when GCM service is stopped. 160 // Remove cached data when GCM service is stopped.
155 void RemoveCachedData(); 161 void RemoveCachedData();
156 162
157 // Checks out of GCM when the profile has been signed out. This will erase 163 // Checks out of GCM when the profile has been signed out. This will erase
158 // all the cached and persisted data. 164 // all the cached and persisted data.
159 void CheckOut(); 165 void CheckOut();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 239
234 // Used to pass a weak pointer to the IO worker. 240 // Used to pass a weak pointer to the IO worker.
235 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; 241 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_;
236 242
237 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); 243 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
238 }; 244 };
239 245
240 } // namespace gcm 246 } // namespace gcm
241 247
242 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ 248 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698