| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 if (!plugin()) | 331 if (!plugin()) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 // Set an attribute and post an event, so browser tests can wait for the | 334 // Set an attribute and post an event, so browser tests can wait for the |
| 335 // placeholder to be ready to receive simulated user input. | 335 // placeholder to be ready to receive simulated user input. |
| 336 blink::WebElement element = plugin()->container()->element(); | 336 blink::WebElement element = plugin()->container()->element(); |
| 337 element.setAttribute("placeholderReady", "true"); | 337 element.setAttribute("placeholderReady", "true"); |
| 338 | 338 |
| 339 std::unique_ptr<content::V8ValueConverter> converter( | 339 std::unique_ptr<content::V8ValueConverter> converter( |
| 340 content::V8ValueConverter::create()); | 340 content::V8ValueConverter::create()); |
| 341 base::StringValue value("placeholderReady"); | 341 base::Value value("placeholderReady"); |
| 342 blink::WebSerializedScriptValue message_data = | 342 blink::WebSerializedScriptValue message_data = |
| 343 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( | 343 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( |
| 344 &value, element.document().frame()->mainWorldScriptContext())); | 344 &value, element.document().frame()->mainWorldScriptContext())); |
| 345 blink::WebDOMMessageEvent msg_event(message_data); | 345 blink::WebDOMMessageEvent msg_event(message_data); |
| 346 | 346 |
| 347 plugin()->container()->enqueueMessageEvent(msg_event); | 347 plugin()->container()->enqueueMessageEvent(msg_event); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void LoadablePluginPlaceholder::SetPluginInfo( | 350 void LoadablePluginPlaceholder::SetPluginInfo( |
| 351 const content::WebPluginInfo& plugin_info) { | 351 const content::WebPluginInfo& plugin_info) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 364 return identifier_; | 364 return identifier_; |
| 365 } | 365 } |
| 366 | 366 |
| 367 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 367 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 368 DCHECK(allow_loading_); | 368 DCHECK(allow_loading_); |
| 369 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || | 369 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || |
| 370 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; | 370 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace plugins | 373 } // namespace plugins |
| OLD | NEW |