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 #include "content/public/browser/web_ui_message_handler.h" | 5 #include "content/public/browser/web_ui_message_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if (value->GetString(0, &string16_value)) | 66 if (value->GetString(0, &string16_value)) |
67 return string16_value; | 67 return string16_value; |
68 NOTREACHED(); | 68 NOTREACHED(); |
69 return base::string16(); | 69 return base::string16(); |
70 } | 70 } |
71 | 71 |
72 void WebUIMessageHandler::RenderViewReused() { | 72 void WebUIMessageHandler::RenderViewReused() { |
73 DisallowJavascript(); | 73 DisallowJavascript(); |
74 } | 74 } |
75 | 75 |
| 76 void WebUIMessageHandler::ResolveJavascriptCallback( |
| 77 const base::Value& callback_id, |
| 78 const base::Value& response) { |
| 79 // cr.webUIResponse is a global JS function exposed from cr.js. |
| 80 CallJavascriptFunction("cr.webUIResponse", callback_id, |
| 81 base::FundamentalValue(true), response); |
| 82 } |
| 83 |
| 84 void WebUIMessageHandler::RejectJavascriptCallback( |
| 85 const base::Value& callback_id, |
| 86 const base::Value& response) { |
| 87 // cr.webUIResponse is a global JS function exposed from cr.js. |
| 88 CallJavascriptFunction("cr.webUIResponse", callback_id, |
| 89 base::FundamentalValue(false), response); |
| 90 } |
| 91 |
76 } // namespace content | 92 } // namespace content |
OLD | NEW |