| 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 a516d710c221b435ef35a4b3d2460d3a87abcc92..6509049fe7c7b7384e2655f209fc4c785fca2875 100644
|
| --- a/chrome/browser/services/gcm/gcm_profile_service.h
|
| +++ b/chrome/browser/services/gcm/gcm_profile_service.h
|
| @@ -6,6 +6,7 @@
|
| #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
|
|
|
| #include <map>
|
| +#include <string>
|
|
|
| #include "base/basictypes.h"
|
| #include "base/callback.h"
|
| @@ -46,7 +47,11 @@ class GCMProfileService : public BrowserContextKeyedService,
|
| GCMClient::Result result)> RegisterCallback;
|
| typedef base::Callback<void(const std::string& message_id,
|
| GCMClient::Result result)> SendCallback;
|
| + typedef base::Callback<void(const GCMClient::GCMStatistics& stats)>
|
| + RequestGCMStatisticsCallback;
|
|
|
| + // Any change made to this enum should have corresponding change in the
|
| + // GetGCMEnabledStateString(...) function.
|
| enum GCMEnabledState {
|
| // GCM is always enabled. GCMClient will always load and connect with GCM.
|
| ALWAYS_ENABLED,
|
| @@ -66,6 +71,9 @@ class GCMProfileService : public BrowserContextKeyedService,
|
| // Returns the GCM enabled state.
|
| static GCMEnabledState GetGCMEnabledState(Profile* profile);
|
|
|
| + // Returns text representation of a GCMEnabledState enum entry.
|
| + static std::string GetGCMEnabledStateString(GCMEnabledState state);
|
| +
|
| // Register profile-specific prefs for GCM.
|
| static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
|
|
| @@ -104,6 +112,19 @@ class GCMProfileService : public BrowserContextKeyedService,
|
| testing_delegate_ = testing_delegate;
|
| }
|
|
|
| + // Returns true if the profile is signed in.
|
| + bool IsSignedIn() const;
|
| +
|
| + // Returns true if the gcm client instance has been created.
|
| + bool IsGCMClientCreated() const;
|
| +
|
| + // Returns true if the gcm client is ready.
|
| + bool IsGCMClientReady() const;
|
| +
|
| + // Get GCM client internal states and statistics. If it has not been created
|
| + // then stats won't be modified.
|
| + void RequestGCMStatistics(RequestGCMStatisticsCallback callback);
|
| +
|
| private:
|
| friend class GCMProfileServiceTestConsumer;
|
|
|
| @@ -179,6 +200,7 @@ class GCMProfileService : public BrowserContextKeyedService,
|
| scoped_ptr<base::Value> value);
|
| bool ParsePersistedRegistrationInfo(scoped_ptr<base::Value> value,
|
| RegistrationInfo* registration_info);
|
| + void RequestGCMStatisticsFinished(GCMClient::GCMStatistics stats);
|
|
|
| // Returns the key used to identify the registration info saved into the
|
| // app's state store. Used for testing purpose.
|
| @@ -206,6 +228,9 @@ class GCMProfileService : public BrowserContextKeyedService,
|
| // Callback map (from <app_id, message_id> to callback) for Send.
|
| std::map<std::pair<std::string, std::string>, SendCallback> send_callbacks_;
|
|
|
| + // Callback for RequestGCMStatistics.
|
| + RequestGCMStatisticsCallback request_gcm_statistics_callback_;
|
| +
|
| // Map from app_id to registration info (sender ids & registration ID).
|
| typedef std::map<std::string, RegistrationInfo> RegistrationInfoMap;
|
| RegistrationInfoMap registration_info_map_;
|
|
|