Chromium Code Reviews| Index: components/gcm_driver/gcm_driver.h |
| diff --git a/components/gcm_driver/gcm_driver.h b/components/gcm_driver/gcm_driver.h |
| index e2fe882532c28d68fd2494c96387cebb949af421..921c4123dc3f0bcb4f7c0902c2ce673bb60caf0e 100644 |
| --- a/components/gcm_driver/gcm_driver.h |
| +++ b/components/gcm_driver/gcm_driver.h |
| @@ -6,6 +6,7 @@ |
| #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
| #include <map> |
| +#include <set> |
| #include <string> |
| #include <vector> |
| @@ -23,6 +24,7 @@ class GCMAppHandler; |
| class GCMDriver { |
| public: |
| typedef std::map<std::string, GCMAppHandler*> GCMAppHandlerMap; |
| + typedef std::set<GCMWildcardAppHandler*> GCMWildcardAppHandlerSet; |
| typedef base::Callback<void(const std::string& registration_id, |
| GCMClient::Result result)> RegisterCallback; |
| typedef base::Callback<void(const std::string& message_id, |
| @@ -62,17 +64,23 @@ class GCMDriver { |
| const SendCallback& callback); |
| const GCMAppHandlerMap& app_handlers() const { return app_handlers_; } |
| + const GCMWildcardAppHandlerSet& wildcard_app_handlers() const { |
| + return wildcard_app_handlers_; |
| + } |
| // This method must be called before destroying the GCMDriver. Once it has |
| // been called, no other GCMDriver methods may be used. |
| virtual void Shutdown(); |
| - // Adds a handler for a given app. |
| + // Add/remove the handler for a given app. |
| virtual void AddAppHandler(const std::string& app_id, GCMAppHandler* handler); |
| - |
| - // Remove the handler for a given app. |
| virtual void RemoveAppHandler(const std::string& app_id); |
| + // Add/remove a wildcard app handler. These will be asked if they match when |
| + // there is no matching non-wildcard handler for a given app. |
| + virtual void AddWildcardAppHandler(GCMWildcardAppHandler* handler); |
|
jianli
2014/06/13 22:51:47
Having 2 versions of adding app handlers seems to
|
| + virtual void RemoveWildcardAppHandler(GCMWildcardAppHandler* handler); |
| + |
| // Enables/disables GCM service. |
| virtual void Enable() = 0; |
| virtual void Disable() = 0; |
| @@ -154,6 +162,9 @@ class GCMDriver { |
| // The handler is not owned. |
| GCMAppHandlerMap app_handlers_; |
| + // Wildcard app handlers set. These are not owned either. |
| + GCMWildcardAppHandlerSet wildcard_app_handlers_; |
| + |
| // The default handler when no app handler can be found in the map. |
| DefaultGCMAppHandler default_app_handler_; |