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

Unified Diff: components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h

Issue 2228553003: a provider of Physical Web pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
diff --git a/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h b/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9e28c5edca9957ed7321c63063b7af2938c7a55
--- /dev/null
+++ b/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
@@ -0,0 +1,71 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS_PROVIDER_H_
+#define COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS_PROVIDER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback_forward.h"
+#include "components/ntp_snippets/category.h"
+#include "components/ntp_snippets/category_factory.h"
+#include "components/ntp_snippets/category_status.h"
+#include "components/ntp_snippets/content_suggestion.h"
+#include "components/ntp_snippets/content_suggestions_provider.h"
+
+namespace gfx {
+class Image;
+}
+
+namespace ntp_snippets {
+
+// TODO(vitaliii): remove when Physical Web C++ interface is provided.
+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.
+ public:
+ GURL raw_url;
+ double distance;
+ base::Time scan_time;
+ GURL site_url;
+ GURL icon_url;
+ std::string title;
+ std::string description;
+ double ranking_weight;
+};
+
+// Provides content suggestions from the Physical Web Service.
+class PhysicalWebPageSuggestionsProvider
+ : public ContentSuggestionsProvider {
+ public:
+ PhysicalWebPageSuggestionsProvider(
+ ContentSuggestionsProvider::Observer* observer,
+ CategoryFactory* category_factory);
+ ~PhysicalWebPageSuggestionsProvider() override;
+
+ private:
+ // ContentSuggestionsProvider implementation.
+ std::vector<Category> GetProvidedCategories() override;
+ CategoryStatus GetCategoryStatus(Category category) override;
+ void DismissSuggestion(const std::string& suggestion_id) override;
+ void FetchSuggestionImage(const std::string& suggestion_id,
+ const ImageFetchedCallback& callback) override;
+ void ClearCachedSuggestionsForDebugging() override;
+ void ClearDismissedSuggestionsForDebugging() override;
+
+ // 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
+ 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.
+
+ // 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.
+ void NotifyStatusChanged(CategoryStatus new_status);
+
+ CategoryStatus category_status_;
+
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.
+ const Category provided_category_;
+
+ DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider);
+};
+
+} // namespace ntp_snippets
+
+#endif // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698