Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS _PROVIDER_H_ | 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_ | 6 #define COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS _PROVIDER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | |
|
vitaliii
2016/12/12 06:56:38
Please leave this.
There are other places where th
cco3
2016/12/12 19:00:31
Done.
| |
| 10 #include <vector> | 9 #include <vector> |
| 11 | 10 |
| 12 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 13 #include "base/values.h" | 12 #include "base/values.h" |
| 14 #include "components/ntp_snippets/category.h" | 13 #include "components/ntp_snippets/category.h" |
| 15 #include "components/ntp_snippets/category_factory.h" | 14 #include "components/ntp_snippets/category_factory.h" |
| 16 #include "components/ntp_snippets/category_status.h" | 15 #include "components/ntp_snippets/category_status.h" |
| 17 #include "components/ntp_snippets/content_suggestion.h" | 16 #include "components/ntp_snippets/content_suggestion.h" |
| 18 #include "components/ntp_snippets/content_suggestions_provider.h" | 17 #include "components/ntp_snippets/content_suggestions_provider.h" |
| 19 #include "components/physical_web/data_source/physical_web_data_source.h" | 18 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 20 #include "components/physical_web/data_source/physical_web_listener.h" | 19 #include "components/physical_web/data_source/physical_web_listener.h" |
| 20 #include "url/gurl.h" | |
|
Marc Treib
2016/12/12 10:20:25
optional: Could just forward-declare
class GURL;
cco3
2016/12/12 19:00:31
Done.
| |
| 21 | 21 |
| 22 namespace ntp_snippets { | 22 namespace ntp_snippets { |
| 23 | 23 |
| 24 // Provides content suggestions from the Physical Web Service. | 24 // Provides content suggestions from the Physical Web Service. |
| 25 class PhysicalWebPageSuggestionsProvider | 25 class PhysicalWebPageSuggestionsProvider |
| 26 : public ContentSuggestionsProvider, | 26 : public ContentSuggestionsProvider, |
| 27 public physical_web::PhysicalWebListener { | 27 public physical_web::PhysicalWebListener { |
| 28 public: | 28 public: |
| 29 PhysicalWebPageSuggestionsProvider( | 29 PhysicalWebPageSuggestionsProvider( |
| 30 ContentSuggestionsProvider::Observer* observer, | 30 ContentSuggestionsProvider::Observer* observer, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 // are obtained from Physical Web data source. | 65 // are obtained from Physical Web data source. |
| 66 std::vector<ContentSuggestion> GetMostRecentPhysicalWebPagesWithFilter( | 66 std::vector<ContentSuggestion> GetMostRecentPhysicalWebPagesWithFilter( |
| 67 int max_count, | 67 int max_count, |
| 68 const std::set<std::string>& excluded_ids); | 68 const std::set<std::string>& excluded_ids); |
| 69 | 69 |
| 70 // Converts an Physical Web page to a ContentSuggestion. | 70 // Converts an Physical Web page to a ContentSuggestion. |
| 71 ContentSuggestion ConvertPhysicalWebPage( | 71 ContentSuggestion ConvertPhysicalWebPage( |
| 72 const base::DictionaryValue& page) const; | 72 const base::DictionaryValue& page) const; |
| 73 | 73 |
| 74 // PhysicalWebListener implementation. | 74 // PhysicalWebListener implementation. |
| 75 void OnFound(const std::string& url) override; | 75 void OnFound(const GURL& url) override; |
| 76 void OnLost(const std::string& url) override; | 76 void OnLost(const GURL& url) override; |
| 77 void OnDistanceChanged(const std::string& url, | 77 void OnDistanceChanged(const GURL& url, double distance_estimate) override; |
| 78 double distance_estimate) override; | |
| 79 | 78 |
| 80 CategoryStatus category_status_; | 79 CategoryStatus category_status_; |
| 81 const Category provided_category_; | 80 const Category provided_category_; |
| 82 physical_web::PhysicalWebDataSource* physical_web_data_source_; | 81 physical_web::PhysicalWebDataSource* physical_web_data_source_; |
| 83 | 82 |
| 84 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider); | 83 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider); |
| 85 }; | 84 }; |
| 86 | 85 |
| 87 } // namespace ntp_snippets | 86 } // namespace ntp_snippets |
| 88 | 87 |
| 89 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_ | 88 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_ |
| OLD | NEW |