 Chromium Code Reviews
 Chromium Code Reviews Issue 2925053003:
  [NTP::Push] Adding BreakingNewsSuggestionsProvider  (Closed)
    
  
    Issue 2925053003:
  [NTP::Push] Adding BreakingNewsSuggestionsProvider  (Closed) 
  | 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..9211c3b7335a69af383669c02ec44da32e00e983 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 base::Value& 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 | 
| 
jkrcal
2017/06/09 11:32:59
nit: Called everytime after ...?
(has been lgtm'd
 
sfiera
2017/06/09 11:42:57
Well, I'd separate it as "every time" but I would
 
mamir
2017/06/09 14:41:01
Done.
 | 
| + // the content provider. | 
| + OnNewContentCallback on_new_content_callback_; | 
| + | 
| DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsGCMAppHandler); | 
| }; | 
| } // namespace ntp_snippets |