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 class UrlInfo { | |
tschumann
2016/08/09 15:24:59
nit: if all members are public and the class doesn
vitaliii
2016/08/10 14:18:41
Done.
| |
26 public: | |
27 GURL raw_url; | |
28 double distance; | |
29 base::Time scan_time; | |
30 GURL site_url; | |
31 GURL icon_url; | |
32 std::string title; | |
33 std::string description; | |
34 double ranking_weight; | |
35 }; | |
36 | |
37 // Provides content suggestions from the Physical Web Service. | |
38 class PhysicalWebPageSuggestionsProvider | |
39 : public ContentSuggestionsProvider { | |
40 public: | |
41 PhysicalWebPageSuggestionsProvider( | |
42 ContentSuggestionsProvider::Observer* observer, | |
43 CategoryFactory* category_factory); | |
44 ~PhysicalWebPageSuggestionsProvider() override; | |
45 | |
46 private: | |
47 // ContentSuggestionsProvider implementation. | |
48 std::vector<Category> GetProvidedCategories() override; | |
49 CategoryStatus GetCategoryStatus(Category category) override; | |
50 void DismissSuggestion(const std::string& suggestion_id) override; | |
51 void FetchSuggestionImage(const std::string& suggestion_id, | |
52 const ImageFetchedCallback& callback) override; | |
53 void ClearCachedSuggestionsForDebugging() override; | |
54 void ClearDismissedSuggestionsForDebugging() override; | |
55 | |
56 // UrlManager::Listener implementation | |
Marc Treib
2016/08/09 12:45:17
No, it isn't :)
vitaliii
2016/08/10 14:18:41
Do you mean that PhysicalWebPageSuggestionsProvide
| |
57 void onDisplayableUrlsChanged(const std::vector<UrlInfo>& urls); | |
Marc Treib
2016/08/09 12:45:17
OnDisplayableUrlsChanged (capitalize)
vitaliii
2016/08/10 14:18:41
Done.
| |
58 | |
59 // Updates the |category_status_| and notifies the |observer_|, if necessary. | |
tschumann
2016/08/09 15:24:59
private methods are implementation details and onl
vitaliii
2016/08/10 14:18:42
Done.
| |
60 void NotifyStatusChanged(CategoryStatus new_status); | |
61 | |
62 CategoryStatus category_status_; | |
63 | |
tschumann
2016/08/09 15:24:59
you can drop the blank line between the two variab
vitaliii
2016/08/10 14:18:42
Done.
| |
64 const Category provided_category_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider); | |
67 }; | |
68 | |
69 } // namespace ntp_snippets | |
70 | |
71 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_ | |
OLD | NEW |