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

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

Issue 184273011: Merge 253787 "[GCM] Make sure GCM checkout logic is invoked when..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « chrome/browser/services/gcm/gcm_client_mock.cc ('k') | chrome/browser/services/gcm/gcm_profile_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_profile_service.h
===================================================================
--- chrome/browser/services/gcm/gcm_profile_service.h (revision 255183)
+++ chrome/browser/services/gcm/gcm_profile_service.h (working copy)
@@ -47,14 +47,24 @@
typedef base::Callback<void(const std::string& message_id,
GCMClient::Result result)> SendCallback;
+ enum GCMEnabledState {
+ // GCM is always enabled. GCMClient will always load and connect with GCM.
+ ALWAYS_ENABLED,
+ // GCM is only enabled for apps. GCMClient will start to load and connect
+ // with GCM only when GCM API is used.
+ ENABLED_FOR_APPS,
+ // GCM is always disabled. GCMClient will never load and connect with GCM.
+ ALWAYS_DISABLED
+ };
+
// For testing purpose.
class TestingDelegate {
public:
virtual GCMEventRouter* GetEventRouter() const = 0;
};
- // Returns true if the GCM support is enabled.
- static bool IsGCMEnabled(Profile* profile);
+ // Returns the GCM enabled state.
+ static GCMEnabledState GetGCMEnabledState(Profile* profile);
// Register profile-specific prefs for GCM.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -88,15 +98,12 @@
SendCallback callback);
// For testing purpose.
+ GCMClient* GetGCMClientForTesting() const;
+
void set_testing_delegate(TestingDelegate* testing_delegate) {
testing_delegate_ = testing_delegate;
}
- protected:
- // Flag that could be set by the testing code to enable GCM. Otherwise,
- // tests from official build will fail.
- static bool enable_gcm_for_testing_;
-
private:
friend class GCMProfileServiceTestConsumer;
@@ -117,9 +124,9 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // Checks in with GCM by creating and initializing GCMClient when the profile
- // has been signed in.
- void CheckIn(const std::string& username);
+ // Ensures that the GCMClient is loaded and the GCM check-in is done when
+ // the profile was signed in.
+ void EnsureLoaded();
// Checks out of GCM when the profile has been signed out. This will erase
// all the cached and persisted data.
@@ -155,7 +162,6 @@
void MessageSendError(const std::string& app_id,
const std::string& message_id,
GCMClient::Result result);
- void FinishInitializationOnUI(bool ready);
void GCMClientReady();
// Returns the event router to fire the event for the given app.
@@ -181,9 +187,6 @@
// The profile which owns this object.
Profile* profile_;
- // Used to creat the GCMClient instance.
- scoped_ptr<GCMClientFactory> gcm_client_factory_;
-
// Flag to indicate if GCMClient is ready.
bool gcm_client_ready_;
« no previous file with comments | « chrome/browser/services/gcm/gcm_client_mock.cc ('k') | chrome/browser/services/gcm/gcm_profile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698