Index: components/ntp_snippets/breaking_news/content_suggestions_gcm_app_handler.h |
diff --git a/components/ntp_snippets/breaking_news/content_suggestions_gcm_app_handler.h b/components/ntp_snippets/breaking_news/content_suggestions_gcm_app_handler.h |
index 6636757c8a373580b9428a39a7a2156f18459934..05041bb6accf9bd31cb9999e0bf1e2a056ae5be9 100644 |
--- a/components/ntp_snippets/breaking_news/content_suggestions_gcm_app_handler.h |
+++ b/components/ntp_snippets/breaking_news/content_suggestions_gcm_app_handler.h |
@@ -29,6 +29,9 @@ namespace ntp_snippets { |
// be called upon received push content suggestions. |
class ContentSuggestionsGCMAppHandler : public gcm::GCMAppHandler { |
public: |
+ // TODO(mamir): Check if a better paramater datatype makes more sense. |
+ using OnNewContentCallback = base::Callback<void(const std::string& content)>; |
+ |
ContentSuggestionsGCMAppHandler( |
gcm::GCMDriver* gcm_driver, |
instance_id::InstanceIDDriver* instance_id_driver, |
@@ -40,7 +43,7 @@ class ContentSuggestionsGCMAppHandler : public gcm::GCMAppHandler { |
// Subscribe to the GCM service if necessary and start listening for pushed |
// content suggestions. Must not be called if already listening. |
- void StartListening(); |
+ void StartListening(OnNewContentCallback on_new_content_callback); |
// Remove the handler, and stop listening for incoming GCM messages. Any |
// further pushed content suggestions will be ignored. Must be called while |
@@ -76,6 +79,10 @@ class ContentSuggestionsGCMAppHandler : public gcm::GCMAppHandler { |
const std::unique_ptr<SubscriptionManager> subscription_manager_; |
base::WeakPtrFactory<ContentSuggestionsGCMAppHandler> weak_factory_; |
+ // Called after everytime a new message is received in OnMessage() to notify |
+ // the content provider. |
+ OnNewContentCallback on_new_content_callback_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsGCMAppHandler); |
}; |
} // namespace ntp_snippets |