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

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

Issue 286213003: Make GCMProfileService own GCMDriver, instead of deriving from it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 7 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 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);
};
« no previous file with comments | « chrome/browser/services/gcm/gcm_driver_unittest.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