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

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: added unittest 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..d4909f8dd37d3e798e4e9c4990f6f5e563854d02
--- /dev/null
+++ b/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
@@ -0,0 +1,72 @@
+// 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.
+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.
+ UrlInfo();
+ UrlInfo(const UrlInfo& other);
+ GURL raw_url;
+ double distance;
+ base::Time scan_time;
+ GURL site_url;
+ GURL icon_url;
+ std::string title;
+ std::string description;
+ double ranking_weight;
+ ~UrlInfo();
+};
+
+// Provides content suggestions from the Physical Web Service.
+class PhysicalWebPageSuggestionsProvider : public ContentSuggestionsProvider {
+ public:
+ PhysicalWebPageSuggestionsProvider(
+ ContentSuggestionsProvider::Observer* observer,
+ CategoryFactory* category_factory);
+ ~PhysicalWebPageSuggestionsProvider() override;
+
+ // UrlManager::Listener implementation
+ 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.
+
+ // 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(Category category) override;
+ std::vector<ContentSuggestion> GetDismissedSuggestionsForDebugging(
+ Category category) override;
+ void ClearDismissedSuggestionsForDebugging(Category category) override;
+
+ private:
+ void NotifyStatusChanged(CategoryStatus new_status);
+
+ CategoryStatus category_status_;
+ 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