| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { | 337 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { |
| 338 if (!plugin()) | 338 if (!plugin()) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 // Set an attribute and post an event, so browser tests can wait for the | 341 // Set an attribute and post an event, so browser tests can wait for the |
| 342 // placeholder to be ready to receive simulated user input. | 342 // placeholder to be ready to receive simulated user input. |
| 343 blink::WebElement element = plugin()->Container()->GetElement(); | 343 blink::WebElement element = plugin()->Container()->GetElement(); |
| 344 element.SetAttribute("placeholderReady", "true"); | 344 element.SetAttribute("placeholderReady", "true"); |
| 345 | 345 |
| 346 std::unique_ptr<content::V8ValueConverter> converter( | |
| 347 content::V8ValueConverter::create()); | |
| 348 base::Value value("placeholderReady"); | 346 base::Value value("placeholderReady"); |
| 349 blink::WebSerializedScriptValue message_data = | 347 blink::WebSerializedScriptValue message_data = |
| 350 blink::WebSerializedScriptValue::Serialize( | 348 blink::WebSerializedScriptValue::Serialize( |
| 351 blink::MainThreadIsolate(), | 349 blink::MainThreadIsolate(), |
| 352 converter->ToV8Value( | 350 content::V8ValueConverter::Create()->ToV8Value( |
| 353 &value, | 351 &value, |
| 354 element.GetDocument().GetFrame()->MainWorldScriptContext())); | 352 element.GetDocument().GetFrame()->MainWorldScriptContext())); |
| 355 blink::WebDOMMessageEvent msg_event(message_data); | 353 blink::WebDOMMessageEvent msg_event(message_data); |
| 356 | 354 |
| 357 plugin()->Container()->EnqueueMessageEvent(msg_event); | 355 plugin()->Container()->EnqueueMessageEvent(msg_event); |
| 358 } | 356 } |
| 359 | 357 |
| 360 void LoadablePluginPlaceholder::SetPluginInfo( | 358 void LoadablePluginPlaceholder::SetPluginInfo( |
| 361 const content::WebPluginInfo& plugin_info) { | 359 const content::WebPluginInfo& plugin_info) { |
| 362 plugin_info_ = plugin_info; | 360 plugin_info_ = plugin_info; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 374 return identifier_; | 372 return identifier_; |
| 375 } | 373 } |
| 376 | 374 |
| 377 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 375 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 378 DCHECK(allow_loading_); | 376 DCHECK(allow_loading_); |
| 379 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || | 377 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || |
| 380 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; | 378 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; |
| 381 } | 379 } |
| 382 | 380 |
| 383 } // namespace plugins | 381 } // namespace plugins |
| OLD | NEW |