OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/dom_ui/dom_ui.h" | 5 #include "chrome/browser/dom_ui/dom_ui.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return tab_contents()->render_view_host(); | 145 return tab_contents()->render_view_host(); |
146 } | 146 } |
147 | 147 |
148 // DOMUI, protected: ---------------------------------------------------------- | 148 // DOMUI, protected: ---------------------------------------------------------- |
149 | 149 |
150 void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { | 150 void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { |
151 handlers_.push_back(handler); | 151 handlers_.push_back(handler); |
152 } | 152 } |
153 | 153 |
154 void DOMUI::ExecuteJavascript(const std::wstring& javascript) { | 154 void DOMUI::ExecuteJavascript(const std::wstring& javascript) { |
155 GetRenderViewHost()->ExecuteJavascriptInWebFrame(std::wstring(), javascript); | 155 GetRenderViewHost()->ExecuteJavascriptInWebFrame(string16(), |
| 156 WideToUTF16Hack(javascript)); |
156 } | 157 } |
157 | 158 |
158 /////////////////////////////////////////////////////////////////////////////// | 159 /////////////////////////////////////////////////////////////////////////////// |
159 // DOMMessageHandler | 160 // DOMMessageHandler |
160 | 161 |
161 DOMMessageHandler* DOMMessageHandler::Attach(DOMUI* dom_ui) { | 162 DOMMessageHandler* DOMMessageHandler::Attach(DOMUI* dom_ui) { |
162 dom_ui_ = dom_ui; | 163 dom_ui_ = dom_ui; |
163 RegisterMessages(); | 164 RegisterMessages(); |
164 return this; | 165 return this; |
165 } | 166 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 203 } |
203 | 204 |
204 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?). | 205 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?). |
205 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) { | 206 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) { |
206 string16 string16_value; | 207 string16 string16_value; |
207 if (value->GetString(0, &string16_value)) | 208 if (value->GetString(0, &string16_value)) |
208 return UTF16ToWideHack(string16_value); | 209 return UTF16ToWideHack(string16_value); |
209 NOTREACHED(); | 210 NOTREACHED(); |
210 return std::wstring(); | 211 return std::wstring(); |
211 } | 212 } |
OLD | NEW |