Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // This is only needed if an embedder overrides handling of a WebUIMessage and | 88 // This is only needed if an embedder overrides handling of a WebUIMessage and |
| 89 // then later wants to undo that, or to route it to a different WebUI object. | 89 // then later wants to undo that, or to route it to a different WebUI object. |
| 90 virtual void ProcessWebUIMessage(const GURL& source_url, | 90 virtual void ProcessWebUIMessage(const GURL& source_url, |
| 91 const std::string& message, | 91 const std::string& message, |
| 92 const base::ListValue& args) = 0; | 92 const base::ListValue& args) = 0; |
| 93 | 93 |
| 94 // Returns true if this WebUI can currently call JavaScript. | 94 // Returns true if this WebUI can currently call JavaScript. |
| 95 virtual bool CanCallJavascript() = 0; | 95 virtual bool CanCallJavascript() = 0; |
| 96 | 96 |
| 97 // Calling these functions directly is discouraged. It's generally preferred | 97 // Calling these functions directly is discouraged. It's generally preferred |
| 98 // to call WebUIMessageHandler::CallJavascriptFunction, as that has | 98 // to call WebUIMessageHandler::CallJavascriptFunctionUnsafe, as that has |
|
Charlie Reis
2016/05/23 20:26:00
This should still be CallJavascriptFunction.
tommycli
2016/06/03 17:52:44
Done.
| |
| 99 // lifecycle controls to prevent calling JavaScript before the page is ready. | 99 // lifecycle controls to prevent calling JavaScript before the page is ready. |
| 100 // | 100 // |
| 101 // Call a Javascript function by sending its name and arguments down to | 101 // Call a Javascript function by sending its name and arguments down to |
| 102 // the renderer. This is asynchronous; there's no way to get the result | 102 // the renderer. This is asynchronous; there's no way to get the result |
| 103 // of the call, and should be thought of more like sending a message to | 103 // of the call, and should be thought of more like sending a message to |
| 104 // the page. | 104 // the page. |
| 105 // | 105 // |
| 106 // All function names in WebUI must consist of only ASCII characters. | 106 // All function names in WebUI must consist of only ASCII characters. |
| 107 // There are variants for calls with more arguments. | 107 // There are variants for calls with more arguments. |
| 108 virtual void CallJavascriptFunction(const std::string& function_name) = 0; | 108 virtual void CallJavascriptFunctionUnsafe( |
| 109 virtual void CallJavascriptFunction(const std::string& function_name, | 109 const std::string& function_name) = 0; |
| 110 const base::Value& arg) = 0; | 110 virtual void CallJavascriptFunctionUnsafe(const std::string& function_name, |
| 111 virtual void CallJavascriptFunction(const std::string& function_name, | 111 const base::Value& arg) = 0; |
| 112 const base::Value& arg1, | 112 virtual void CallJavascriptFunctionUnsafe(const std::string& function_name, |
| 113 const base::Value& arg2) = 0; | 113 const base::Value& arg1, |
| 114 virtual void CallJavascriptFunction(const std::string& function_name, | 114 const base::Value& arg2) = 0; |
| 115 const base::Value& arg1, | 115 virtual void CallJavascriptFunctionUnsafe(const std::string& function_name, |
| 116 const base::Value& arg2, | 116 const base::Value& arg1, |
| 117 const base::Value& arg3) = 0; | 117 const base::Value& arg2, |
| 118 virtual void CallJavascriptFunction(const std::string& function_name, | 118 const base::Value& arg3) = 0; |
| 119 const base::Value& arg1, | 119 virtual void CallJavascriptFunctionUnsafe(const std::string& function_name, |
| 120 const base::Value& arg2, | 120 const base::Value& arg1, |
| 121 const base::Value& arg3, | 121 const base::Value& arg2, |
| 122 const base::Value& arg4) = 0; | 122 const base::Value& arg3, |
| 123 virtual void CallJavascriptFunction( | 123 const base::Value& arg4) = 0; |
| 124 virtual void CallJavascriptFunctionUnsafe( | |
| 124 const std::string& function_name, | 125 const std::string& function_name, |
| 125 const std::vector<const base::Value*>& args) = 0; | 126 const std::vector<const base::Value*>& args) = 0; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace content | 129 } // namespace content |
| 129 | 130 |
| 130 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 131 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| OLD | NEW |