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

Side by Side Diff: components/ntp_snippets/breaking_news/breaking_news_suggestions_provider.h

Issue 2925053003: [NTP::Push] Adding BreakingNewsSuggestionsProvider (Closed)
Patch Set: sfiera@ comments. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_BREAKING_NEWS_SUGGESTIONS_PROVIDER _H_
6 #define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_BREAKING_NEWS_SUGGESTIONS_PROVIDER _H_
7
8 #include "components/ntp_snippets/category.h"
9 #include "components/ntp_snippets/content_suggestions_provider.h"
10 #include "components/prefs/pref_registry_simple.h"
11
12 namespace ntp_snippets {
13 class ContentSuggestionsGCMAppHandler;
14 }
15
16 namespace ntp_snippets {
17
18 // Receives breaking news suggestions via GCM push messages, stores them and
19 // provides them as content suggestions.
20 class BreakingNewsSuggestionsProvider : public ContentSuggestionsProvider {
21 public:
22 BreakingNewsSuggestionsProvider(
23 ContentSuggestionsProvider::Observer* observer,
24 std::unique_ptr<ContentSuggestionsGCMAppHandler> gcm_app_handler);
25 virtual ~BreakingNewsSuggestionsProvider();
26
27 // Starts the underlying GCM handler and registers the callback when GCM
28 // receives a message.
29 void Start();
30
31 // Callback called from the GCM handler when new content has been pushed from
32 // the server.
33 void OnNewContentSuggestion(const std::string& content);
sfiera 2017/06/08 13:37:15 Could be private? Could take a base::Value (JSON,
mamir 2017/06/08 15:20:06 Done.
34
35 private:
36 // ContentSuggestionsProvider implementation.
37 CategoryStatus GetCategoryStatus(Category category) override;
38 CategoryInfo GetCategoryInfo(Category category) override;
39 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
40 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
41 const ImageFetchedCallback& callback) override;
42 void Fetch(const Category& category,
43 const std::set<std::string>& known_suggestion_ids,
44 const FetchDoneCallback& callback) override;
45 void ClearHistory(
46 base::Time begin,
47 base::Time end,
48 const base::Callback<bool(const GURL& url)>& filter) override;
49 void ClearCachedSuggestions(Category category) override;
50 void GetDismissedSuggestionsForDebugging(
51 Category category,
52 const DismissedSuggestionsCallback& callback) override;
53 void ClearDismissedSuggestionsForDebugging(Category category) override;
54
55 std::unique_ptr<ContentSuggestionsGCMAppHandler> gcm_app_handler_;
56 const Category provided_category_;
57 CategoryStatus category_status_;
58 };
sfiera 2017/06/08 13:37:15 Oh, should probably have a DISALLOW_COPY_AND_ASSIG
mamir 2017/06/08 15:20:06 Done.
59
60 } // namespace ntp_snippets
61
62 #endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_BREAKING_NEWS_SUGGESTIONS_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698