OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/loadable_plugin_placeholder.h" | 5 #include "components/plugins/renderer/loadable_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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 switches::kEnablePluginPlaceholderTesting)) { | 279 switches::kEnablePluginPlaceholderTesting)) { |
280 blink::WebElement element = plugin()->container()->element(); | 280 blink::WebElement element = plugin()->container()->element(); |
281 element.setAttribute("placeholderLoaded", "true"); | 281 element.setAttribute("placeholderLoaded", "true"); |
282 | 282 |
283 scoped_ptr<content::V8ValueConverter> converter( | 283 scoped_ptr<content::V8ValueConverter> converter( |
284 content::V8ValueConverter::create()); | 284 content::V8ValueConverter::create()); |
285 base::StringValue value("placeholderLoaded"); | 285 base::StringValue value("placeholderLoaded"); |
286 blink::WebSerializedScriptValue message_data = | 286 blink::WebSerializedScriptValue message_data = |
287 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( | 287 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( |
288 &value, element.document().frame()->mainWorldScriptContext())); | 288 &value, element.document().frame()->mainWorldScriptContext())); |
289 | 289 blink::WebDOMMessageEvent msg_event(message_data); |
290 blink::WebDOMEvent event = element.document().createEvent("MessageEvent"); | |
291 blink::WebDOMMessageEvent msg_event = event.to<blink::WebDOMMessageEvent>(); | |
292 msg_event.initMessageEvent("message", // type | |
293 false, // canBubble | |
294 false, // cancelable | |
295 message_data, // data | |
296 "", // origin [*] | |
297 NULL, // source [*] | |
298 element.document(), // target document | |
299 ""); // lastEventId | |
300 element.dispatchEvent(msg_event); | 290 element.dispatchEvent(msg_event); |
301 } | 291 } |
302 } | 292 } |
303 | 293 |
304 void LoadablePluginPlaceholder::SetPluginInfo( | 294 void LoadablePluginPlaceholder::SetPluginInfo( |
305 const content::WebPluginInfo& plugin_info) { | 295 const content::WebPluginInfo& plugin_info) { |
306 plugin_info_ = plugin_info; | 296 plugin_info_ = plugin_info; |
307 } | 297 } |
308 | 298 |
309 const content::WebPluginInfo& LoadablePluginPlaceholder::GetPluginInfo() const { | 299 const content::WebPluginInfo& LoadablePluginPlaceholder::GetPluginInfo() const { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 roundf(unobscured_rect_.width() / zoom_factor), | 343 roundf(unobscured_rect_.width() / zoom_factor), |
354 roundf(unobscured_rect_.height() / zoom_factor))) { | 344 roundf(unobscured_rect_.height() / zoom_factor))) { |
355 MarkPluginEssential( | 345 MarkPluginEssential( |
356 PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE); | 346 PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE); |
357 } | 347 } |
358 | 348 |
359 in_size_recheck_ = false; | 349 in_size_recheck_ = false; |
360 } | 350 } |
361 | 351 |
362 } // namespace plugins | 352 } // namespace plugins |
OLD | NEW |