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_MESSAGE_HANDLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // to deregister or disabled observers that push JavaScript calls to the page. | 77 // to deregister or disabled observers that push JavaScript calls to the page. |
78 virtual void OnJavascriptDisallowed() {} | 78 virtual void OnJavascriptDisallowed() {} |
79 | 79 |
80 // Helper method for responding to Javascript requests initiated with | 80 // Helper method for responding to Javascript requests initiated with |
81 // cr.sendWithPromise() (defined in cr.js) for the case where the returned | 81 // cr.sendWithPromise() (defined in cr.js) for the case where the returned |
82 // promise should be resolved (request succeeded). | 82 // promise should be resolved (request succeeded). |
83 void ResolveJavascriptCallback(const base::Value& callback_id, | 83 void ResolveJavascriptCallback(const base::Value& callback_id, |
84 const base::Value& response); | 84 const base::Value& response); |
85 | 85 |
86 // Helper method for responding to Javascript requests initiated with | 86 // Helper method for responding to Javascript requests initiated with |
| 87 // cr.sendWithPromise() (defined in cr.js) for the case where the returned |
| 88 // promise should be resolved (request succeeded). |
| 89 void ResolveJavascriptCallback(const std::string& callback_id, |
| 90 const base::Value& response); |
| 91 |
| 92 // Helper method for responding to Javascript requests initiated with |
87 // cr.sendWithPromise() (defined in cr.js), for the case where the returned | 93 // cr.sendWithPromise() (defined in cr.js), for the case where the returned |
88 // promise should be rejected (request failed). | 94 // promise should be rejected (request failed). |
89 void RejectJavascriptCallback(const base::Value& callback_id, | 95 void RejectJavascriptCallback(const base::Value& callback_id, |
90 const base::Value& response); | 96 const base::Value& response); |
91 | 97 |
92 // Call a Javascript function by sending its name and arguments down to | 98 // Call a Javascript function by sending its name and arguments down to |
93 // the renderer. This is asynchronous; there's no way to get the result | 99 // the renderer. This is asynchronous; there's no way to get the result |
94 // of the call, and should be thought of more like sending a message to | 100 // of the call, and should be thought of more like sending a message to |
95 // the page. | 101 // the page. |
96 // All function names in WebUI must consist of only ASCII characters. | 102 // All function names in WebUI must consist of only ASCII characters. |
(...skipping 28 matching lines...) Expand all Loading... |
125 | 131 |
126 // True if the page is for JavaScript calls from this handler. | 132 // True if the page is for JavaScript calls from this handler. |
127 bool javascript_allowed_; | 133 bool javascript_allowed_; |
128 | 134 |
129 WebUI* web_ui_; | 135 WebUI* web_ui_; |
130 }; | 136 }; |
131 | 137 |
132 } // namespace content | 138 } // namespace content |
133 | 139 |
134 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ | 140 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
OLD | NEW |