OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/plugin_placeholder.h" | 5 #include "components/plugins/renderer/plugin_placeholder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void PluginPlaceholder::WillDestroyPlugin() { delete this; } | 155 void PluginPlaceholder::WillDestroyPlugin() { delete this; } |
156 | 156 |
157 void PluginPlaceholder::SetMessage(const base::string16& message) { | 157 void PluginPlaceholder::SetMessage(const base::string16& message) { |
158 message_ = message; | 158 message_ = message; |
159 if (finished_loading_) | 159 if (finished_loading_) |
160 UpdateMessage(); | 160 UpdateMessage(); |
161 } | 161 } |
162 | 162 |
163 void PluginPlaceholder::UpdateMessage() { | 163 void PluginPlaceholder::UpdateMessage() { |
164 std::string script = | 164 std::string script = |
165 "window.setMessage(" + base::GetDoubleQuotedJson(message_) + ")"; | 165 "window.setMessage(" + base::GetQuotedJSONString(message_) + ")"; |
166 plugin_->web_view()->mainFrame()->executeScript( | 166 plugin_->web_view()->mainFrame()->executeScript( |
167 WebScriptSource(ASCIIToUTF16(script))); | 167 WebScriptSource(ASCIIToUTF16(script))); |
168 } | 168 } |
169 | 169 |
170 void PluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) { | 170 void PluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) { |
171 // Does nothing by default. Will be overridden if a specific browser wants | 171 // Does nothing by default. Will be overridden if a specific browser wants |
172 // a context menu. | 172 // a context menu. |
173 return; | 173 return; |
174 } | 174 } |
175 | 175 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 identifier_ = identifier; | 239 identifier_ = identifier; |
240 } | 240 } |
241 | 241 |
242 blink::WebFrame* PluginPlaceholder::GetFrame() { return frame_; } | 242 blink::WebFrame* PluginPlaceholder::GetFrame() { return frame_; } |
243 | 243 |
244 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { | 244 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { |
245 return plugin_params_; | 245 return plugin_params_; |
246 } | 246 } |
247 | 247 |
248 } // namespace plugins | 248 } // namespace plugins |
OLD | NEW |