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

Unified Diff: chrome/browser/services/gcm/gcm_profile_service.h

Issue 330733002: Move IdentityProvider usage from GCMDriverDesktop to GCMProfileService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/services/gcm/gcm_profile_service.h
diff --git a/chrome/browser/services/gcm/gcm_profile_service.h b/chrome/browser/services/gcm/gcm_profile_service.h
index df05dbb3a7cbca0f8c14a8196b76c66689ca5def..caf1c8282e624cb93425630c6e5ea55997d96d70 100644
--- a/chrome/browser/services/gcm/gcm_profile_service.h
+++ b/chrome/browser/services/gcm/gcm_profile_service.h
@@ -16,6 +16,10 @@
#include "components/gcm_driver/gcm_driver.h"
#include "components/keyed_service/core/keyed_service.h"
+#if !defined(OS_ANDROID)
+#include "google_apis/gaia/identity_provider.h"
+#endif
+
class Profile;
namespace user_prefs {
@@ -28,7 +32,12 @@ class GCMClientFactory;
class GCMDriver;
// Providing GCM service, via GCMDriver, to a profile.
+#if defined(OS_ANDROID)
class GCMProfileService : public KeyedService {
+#else
+class GCMProfileService : public KeyedService,
Nicolas Zea 2014/06/13 19:49:31 Agree with Filip, I think it would be cleaner to n
jianli 2014/06/13 21:58:04 Per discussion, I added inner class IdentityObserv
+ public IdentityProvider::Observer {
+#endif
public:
// Returns whether GCM is enabled for |profile|.
static bool IsGCMEnabled(Profile* profile);
@@ -54,6 +63,16 @@ class GCMProfileService : public KeyedService {
// KeyedService:
virtual void Shutdown() OVERRIDE;
+#if !defined(OS_ANDROID)
+ // IdentityProvider::Observer:
+ virtual void OnActiveAccountLogin() OVERRIDE;
+ virtual void OnActiveAccountLogout() OVERRIDE;
+#endif
+
+ // Returns the user name if the profile is signed in or an empty string
+ // otherwise.
+ std::string SignedInUserName() const;
+
// For testing purpose.
void SetDriverForTesting(GCMDriver* driver);
@@ -76,6 +95,14 @@ class GCMProfileService : public KeyedService {
// Implementation of content::PushMessagingService using GCMProfileService.
PushMessagingServiceImpl push_messaging_service_;
+#if !defined(OS_ANDROID)
+ scoped_ptr<IdentityProvider> identity_provider_;
+
+ // The account ID that this service is responsible for. Empty when the service
+ // is not running.
+ std::string account_id_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
};

Powered by Google App Engine
This is Rietveld 408576698