OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS _PROVIDER_H_ | |
6 #define COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS _PROVIDER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback_forward.h" | |
12 #include "components/ntp_snippets/category.h" | |
13 #include "components/ntp_snippets/category_factory.h" | |
14 #include "components/ntp_snippets/category_status.h" | |
15 #include "components/ntp_snippets/content_suggestion.h" | |
16 #include "components/ntp_snippets/content_suggestions_provider.h" | |
17 | |
18 namespace gfx { | |
19 class Image; | |
20 } | |
21 | |
22 namespace ntp_snippets { | |
23 | |
24 // TODO(vitaliii): remove when Physical Web C++ interface is provided. | |
25 struct UrlInfo { | |
Marc Treib
2016/08/10 16:22:03
Does this need to be public? I think you could mak
vitaliii
2016/08/11 12:15:25
Since there is no Physical Web C++ interface yet,
Marc Treib
2016/08/11 12:53:09
Alright, fair enough.
Still, even if this is just
vitaliii
2016/08/11 14:29:58
Done.
| |
26 UrlInfo(); | |
27 UrlInfo(const UrlInfo& other); | |
28 GURL raw_url; | |
29 double distance; | |
30 base::Time scan_time; | |
31 GURL site_url; | |
32 GURL icon_url; | |
33 std::string title; | |
34 std::string description; | |
35 double ranking_weight; | |
36 ~UrlInfo(); | |
37 }; | |
38 | |
39 // Provides content suggestions from the Physical Web Service. | |
40 class PhysicalWebPageSuggestionsProvider : public ContentSuggestionsProvider { | |
41 public: | |
42 PhysicalWebPageSuggestionsProvider( | |
43 ContentSuggestionsProvider::Observer* observer, | |
44 CategoryFactory* category_factory); | |
45 ~PhysicalWebPageSuggestionsProvider() override; | |
46 | |
47 // UrlManager::Listener implementation | |
48 void OnDisplayableUrlsChanged(const std::vector<UrlInfo>& urls); | |
Marc Treib
2016/08/10 16:22:03
This can probably be private? Also it's not an imp
vitaliii
2016/08/11 12:15:24
This function will be used by Physical Web team to
Marc Treib
2016/08/11 12:53:09
If there was an observer that we'd implement, then
vitaliii
2016/08/11 14:29:58
Acknowledged.
| |
49 | |
50 // ContentSuggestionsProvider implementation. | |
51 std::vector<Category> GetProvidedCategories() override; | |
52 CategoryStatus GetCategoryStatus(Category category) override; | |
53 void DismissSuggestion(const std::string& suggestion_id) override; | |
54 void FetchSuggestionImage(const std::string& suggestion_id, | |
55 const ImageFetchedCallback& callback) override; | |
56 void ClearCachedSuggestionsForDebugging(Category category) override; | |
57 std::vector<ContentSuggestion> GetDismissedSuggestionsForDebugging( | |
58 Category category) override; | |
59 void ClearDismissedSuggestionsForDebugging(Category category) override; | |
60 | |
61 private: | |
62 void NotifyStatusChanged(CategoryStatus new_status); | |
63 | |
64 CategoryStatus category_status_; | |
65 const Category provided_category_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider); | |
68 }; | |
69 | |
70 } // namespace ntp_snippets | |
71 | |
72 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_ | |
OLD | NEW |