| 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 69f346f007455b7a0704493c45df930cb45557d1..d68c65dc3c399c035e09140357eb064f4ac5ee15 100644
|
| --- a/chrome/browser/services/gcm/gcm_profile_service.h
|
| +++ b/chrome/browser/services/gcm/gcm_profile_service.h
|
| @@ -10,6 +10,8 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/macros.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +// TODO(jianli): include needed for obsolete methods that are going to be
|
| +// removed soon.
|
| #include "chrome/browser/services/gcm/gcm_driver.h"
|
| #include "components/keyed_service/core/keyed_service.h"
|
|
|
| @@ -21,8 +23,11 @@ class PrefRegistrySyncable;
|
|
|
| namespace gcm {
|
|
|
| -// A specialization of GCMDriver that is tied to a Profile.
|
| -class GCMProfileService : public GCMDriver, public KeyedService {
|
| +class GCMClientFactory;
|
| +class GCMDriver;
|
| +
|
| +// Providing GCM service, via GCMDriver, to a profile.
|
| +class GCMProfileService : public KeyedService {
|
| public:
|
| // Any change made to this enum should have corresponding change in the
|
| // GetGCMEnabledStateString(...) function.
|
| @@ -45,26 +50,35 @@ class GCMProfileService : public GCMDriver, public KeyedService {
|
| // Register profile-specific prefs for GCM.
|
| static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
|
|
| - explicit GCMProfileService(Profile* profile);
|
| + GCMProfileService(Profile* profile,
|
| + scoped_ptr<GCMClientFactory> gcm_client_factory);
|
| virtual ~GCMProfileService();
|
|
|
| + // TODO(jianli): obsolete methods that are going to be removed soon.
|
| + void AddAppHandler(const std::string& app_id, GCMAppHandler* handler);
|
| + void RemoveAppHandler(const std::string& app_id);
|
| + void Register(const std::string& app_id,
|
| + const std::vector<std::string>& sender_ids,
|
| + const GCMDriver::RegisterCallback& callback);
|
| +
|
| // KeyedService:
|
| virtual void Shutdown() OVERRIDE;
|
|
|
| - // Returns the user name if the profile is signed in.
|
| - std::string SignedInUserName() const;
|
| + // For testing purpose.
|
| + void SetDriverForTesting(GCMDriver* driver);
|
| +
|
| + GCMDriver* driver() const { return driver_.get(); }
|
|
|
| protected:
|
| - // Overridden from GCMDriver:
|
| - virtual bool ShouldStartAutomatically() const OVERRIDE;
|
| - virtual base::FilePath GetStorePath() const OVERRIDE;
|
| - virtual scoped_refptr<net::URLRequestContextGetter>
|
| - GetURLRequestContextGetter() const OVERRIDE;
|
| + // Used for constructing fake GCMProfileService for testing purpose.
|
| + GCMProfileService();
|
|
|
| private:
|
| // The profile which owns this object.
|
| Profile* profile_;
|
|
|
| + scoped_ptr<GCMDriver> driver_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
|
| };
|
|
|
|
|