| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ |
| 6 #define IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ | 6 #define IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 const std::vector<const base::Value*>& arg_list); | 34 const std::vector<const base::Value*>& arg_list); |
| 35 | 35 |
| 36 virtual ~WebUIIOS() {} | 36 virtual ~WebUIIOS() {} |
| 37 | 37 |
| 38 virtual web::WebState* GetWebState() const = 0; | 38 virtual web::WebState* GetWebState() const = 0; |
| 39 | 39 |
| 40 virtual WebUIIOSController* GetController() const = 0; | 40 virtual WebUIIOSController* GetController() const = 0; |
| 41 virtual void SetController(WebUIIOSController* controller) = 0; | 41 virtual void SetController(WebUIIOSController* controller) = 0; |
| 42 | 42 |
| 43 // Takes ownership of |handler|, which will be destroyed when the WebUIIOS is. | 43 // Takes ownership of |handler|, which will be destroyed when the WebUIIOS is. |
| 44 virtual void AddMessageHandler(WebUIIOSMessageHandler* handler) = 0; | 44 virtual void AddMessageHandler( |
| 45 std::unique_ptr<WebUIIOSMessageHandler> handler) = 0; |
| 45 | 46 |
| 46 // Used by WebUIIOSMessageHandlers. If the given message is already | 47 // Used by WebUIIOSMessageHandlers. If the given message is already |
| 47 // registered, the call has no effect unless |register_callback_overwrites_| | 48 // registered, the call has no effect unless |register_callback_overwrites_| |
| 48 // is set to true. | 49 // is set to true. |
| 49 typedef base::Callback<void(const base::ListValue*)> MessageCallback; | 50 typedef base::Callback<void(const base::ListValue*)> MessageCallback; |
| 50 virtual void RegisterMessageCallback(const std::string& message, | 51 virtual void RegisterMessageCallback(const std::string& message, |
| 51 const MessageCallback& callback) = 0; | 52 const MessageCallback& callback) = 0; |
| 52 | 53 |
| 53 // This is only needed if an embedder overrides handling of a WebUIIOSMessage | 54 // This is only needed if an embedder overrides handling of a WebUIIOSMessage |
| 54 // and then later wants to undo that, or to route it to a different WebUIIOS | 55 // and then later wants to undo that, or to route it to a different WebUIIOS |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 const base::Value& arg3, | 78 const base::Value& arg3, |
| 78 const base::Value& arg4) = 0; | 79 const base::Value& arg4) = 0; |
| 79 virtual void CallJavascriptFunction( | 80 virtual void CallJavascriptFunction( |
| 80 const std::string& function_name, | 81 const std::string& function_name, |
| 81 const std::vector<const base::Value*>& args) = 0; | 82 const std::vector<const base::Value*>& args) = 0; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace web | 85 } // namespace web |
| 85 | 86 |
| 86 #endif // IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ | 87 #endif // IOS_WEB_PUBLIC_WEBUI_WEB_UI_IOS_H_ |
| OLD | NEW |