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

Unified Diff: components/physical_web/webui/physical_web_base_message_handler.h

Issue 2741823002: Update Physical Web WebUI to show new results automatically (Closed)
Patch Set: remove renderID Created 3 years, 9 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/physical_web/webui/physical_web_base_message_handler.h
diff --git a/components/physical_web/webui/physical_web_base_message_handler.h b/components/physical_web/webui/physical_web_base_message_handler.h
index 190cf294b11f142fbfe0243aebc3881a11d2cd07..d974ac2c8012eeb239ca6cce3b6fb3f3ddb1d226 100644
--- a/components/physical_web/webui/physical_web_base_message_handler.h
+++ b/components/physical_web/webui/physical_web_base_message_handler.h
@@ -5,9 +5,13 @@
#ifndef COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER_H_
#define COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER_H_
+#include <unordered_map>
+
#include "base/callback.h"
#include "base/macros.h"
#include "base/values.h"
+#include "components/physical_web/data_source/physical_web_data_source.h"
+#include "components/physical_web/data_source/physical_web_listener.h"
namespace physical_web {
@@ -22,11 +26,16 @@ typedef base::Callback<void(const base::ListValue*)> MessageCallback;
// The base handler for Javascript messages for the chrome://physical-web page.
// This does not implement WebUIMessageHandler or register its methods.
-class PhysicalWebBaseMessageHandler {
+class PhysicalWebBaseMessageHandler : physical_web::PhysicalWebListener {
public:
PhysicalWebBaseMessageHandler();
virtual ~PhysicalWebBaseMessageHandler();
+ // PhysicalWebListener
+ void OnFound(const GURL& url) override;
+ void OnLost(const GURL& url) override;
+ void OnDistanceChanged(const GURL& url, double distance_estimate) override;
+
// Handles the RequestNearbyURLs message, returning URLs that are currently
// being broadcasted by Physical Web transports.
void HandleRequestNearbyURLs(const base::ListValue* args);
@@ -50,6 +59,10 @@ class PhysicalWebBaseMessageHandler {
virtual physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() = 0;
private:
+ physical_web::PhysicalWebDataSource* data_source_;
+ std::vector<std::string> ordered_group_ids_;
+ std::unordered_map<std::string, physical_web::Metadata> metadata_map_;
+
DISALLOW_COPY_AND_ASSIGN(PhysicalWebBaseMessageHandler);
};

Powered by Google App Engine
This is Rietveld 408576698