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

Side by Side Diff: components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h

Issue 2553643003: [NTP::PhysicalWeb] Implement Fetch for "More" button. (Closed)
Patch Set: Created 4 years 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
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> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 private: 54 private:
55 friend class PhysicalWebPageSuggestionsProviderTest; 55 friend class PhysicalWebPageSuggestionsProviderTest;
56 56
57 // Updates the |category_status_| and notifies the |observer_|, if necessary. 57 // Updates the |category_status_| and notifies the |observer_|, if necessary.
58 void NotifyStatusChanged(CategoryStatus new_status); 58 void NotifyStatusChanged(CategoryStatus new_status);
59 59
60 // Manually requests all physical web pages and updates the suggestions. 60 // Manually requests all physical web pages and updates the suggestions.
61 void FetchPhysicalWebPages(); 61 void FetchPhysicalWebPages();
62 62
63 // Returns at most |max_quantity| ContentSuggestions with IDs not in
64 // |excluded_ids| and sorted by distance (the closest first). The raw pages
65 // are obtained from Physical Web data source.
66 std::vector<ContentSuggestion> GetMostRecentPhysicalWebPagesWithFilter(
67 int max_quantity,
Marc Treib 2016/12/05 15:55:19 max_count?
vitaliii 2016/12/06 07:30:21 Done.
68 const std::set<std::string>& excluded_ids);
69
63 // Converts an Physical Web page to a ContentSuggestion. 70 // Converts an Physical Web page to a ContentSuggestion.
64 ContentSuggestion ConvertPhysicalWebPage( 71 ContentSuggestion ConvertPhysicalWebPage(
65 const base::DictionaryValue& page) const; 72 const base::DictionaryValue& page) const;
66 73
67 // PhysicalWebListener implementation. 74 // PhysicalWebListener implementation.
68 void OnFound(const std::string& url) override; 75 void OnFound(const std::string& url) override;
69 void OnLost(const std::string& url) override; 76 void OnLost(const std::string& url) override;
70 void OnDistanceChanged(const std::string& url, 77 void OnDistanceChanged(const std::string& url,
71 double distance_estimate) override; 78 double distance_estimate) override;
72 79
73 CategoryStatus category_status_; 80 CategoryStatus category_status_;
74 const Category provided_category_; 81 const Category provided_category_;
75 physical_web::PhysicalWebDataSource* physical_web_data_source_; 82 physical_web::PhysicalWebDataSource* physical_web_data_source_;
76 83
77 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider); 84 DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider);
78 }; 85 };
79 86
80 } // namespace ntp_snippets 87 } // namespace ntp_snippets
81 88
82 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_ 89 #endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTI ONS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698