| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER |
| 6 #define COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/values.h" |
| 11 |
| 12 namespace physical_web { |
| 13 |
| 14 class PhysicalWebDataSource; |
| 15 |
| 16 } // namespace physical_web |
| 17 |
| 18 namespace physical_web_ui { |
| 19 |
| 20 // This is the equivalent of content::WebUI::MessageCallback. |
| 21 typedef base::Callback<void(const base::ListValue*)> MessageCallback; |
| 22 |
| 23 // The base handler for Javascript messages for the chrome://physical-web page. |
| 24 // (Does not implement WebUIMessageHandler or register its methods) |
| 25 class PhysicalWebBaseMessageHandler { |
| 26 public: |
| 27 PhysicalWebBaseMessageHandler(); |
| 28 ~PhysicalWebBaseMessageHandler(); |
| 29 |
| 30 void HandleRequestNearbyURLs(const base::ListValue* args); |
| 31 void HandlePhysicalWebItemClicked(const base::ListValue* args); |
| 32 |
| 33 protected: |
| 34 void RegisterMessagesImpl(); |
| 35 virtual void RegisterMessageCallback( |
| 36 const std::string& message, |
| 37 const MessageCallback& callback) = 0; |
| 38 virtual void CallJavaScriptFunction(const std::string& function, |
| 39 const base::Value& arg) = 0; |
| 40 virtual physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() = 0; |
| 41 |
| 42 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(PhysicalWebBaseMessageHandler); |
| 44 }; |
| 45 |
| 46 } // namespace physical_web_ui |
| 47 |
| 48 #endif // COMPONENTS_PHYSICAL_WEB_WEBUI_PHYSICAL_WEB_BASE_MESSAGE_HANDLER |
| OLD | NEW |