| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/json_reader.h" | 8 #include "base/json_reader.h" |
| 9 #include "base/json_writer.h" | 9 #include "base/json_writer.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // DOMUI, private: ------------------------------------------------------------ | 103 // DOMUI, private: ------------------------------------------------------------ |
| 104 | 104 |
| 105 void DOMUI::ExecuteJavascript(const std::wstring& javascript) { | 105 void DOMUI::ExecuteJavascript(const std::wstring& javascript) { |
| 106 tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame( | 106 tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame( |
| 107 std::wstring(), javascript); | 107 std::wstring(), javascript); |
| 108 } | 108 } |
| 109 | 109 |
| 110 /////////////////////////////////////////////////////////////////////////////// | 110 /////////////////////////////////////////////////////////////////////////////// |
| 111 // DOMMessageHandler | 111 // DOMMessageHandler |
| 112 | 112 |
| 113 DOMMessageHandler::DOMMessageHandler(DOMUI *dom_ui) : dom_ui_(dom_ui) { | 113 DOMMessageHandler* DOMMessageHandler::Attach(DOMUI* dom_ui) { |
| 114 dom_ui_ = dom_ui; |
| 115 RegisterMessages(); |
| 116 return this; |
| 114 } | 117 } |
| 115 | 118 |
| 116 // DOMMessageHandler, protected: ---------------------------------------------- | 119 // DOMMessageHandler, protected: ---------------------------------------------- |
| 117 | 120 |
| 118 void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary, | 121 void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary, |
| 119 std::wstring title, | 122 std::wstring title, |
| 120 const GURL& gurl) { | 123 const GURL& gurl) { |
| 121 std::wstring wstring_url = UTF8ToWide(gurl.spec()); | 124 std::wstring wstring_url = UTF8ToWide(gurl.spec()); |
| 122 dictionary->SetString(L"url", wstring_url); | 125 dictionary->SetString(L"url", wstring_url); |
| 123 | 126 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 list_member->GetType() == Value::TYPE_STRING) { | 177 list_member->GetType() == Value::TYPE_STRING) { |
| 175 const StringValue* string_value = | 178 const StringValue* string_value = |
| 176 static_cast<const StringValue*>(list_member); | 179 static_cast<const StringValue*>(list_member); |
| 177 std::wstring wstring_value; | 180 std::wstring wstring_value; |
| 178 string_value->GetAsString(&wstring_value); | 181 string_value->GetAsString(&wstring_value); |
| 179 return wstring_value; | 182 return wstring_value; |
| 180 } | 183 } |
| 181 } | 184 } |
| 182 return std::wstring(); | 185 return std::wstring(); |
| 183 } | 186 } |
| OLD | NEW |