| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/json/string_escape.h" | 11 #include "base/json/string_escape.h" |
| 10 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/values.h" | 16 #include "base/values.h" |
| 15 #include "content/public/child/v8_value_converter.h" | 17 #include "content/public/child/v8_value_converter.h" |
| 16 #include "content/public/renderer/render_frame.h" | 18 #include "content/public/renderer/render_frame.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 plugin()->container()->reportGeometry(); | 304 plugin()->container()->reportGeometry(); |
| 303 } | 305 } |
| 304 } | 306 } |
| 305 | 307 |
| 306 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { | 308 void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { |
| 307 // Set an attribute and post an event, so browser tests can wait for the | 309 // Set an attribute and post an event, so browser tests can wait for the |
| 308 // placeholder to be ready to receive simulated user input. | 310 // placeholder to be ready to receive simulated user input. |
| 309 blink::WebElement element = plugin()->container()->element(); | 311 blink::WebElement element = plugin()->container()->element(); |
| 310 element.setAttribute("placeholderReady", "true"); | 312 element.setAttribute("placeholderReady", "true"); |
| 311 | 313 |
| 312 scoped_ptr<content::V8ValueConverter> converter( | 314 std::unique_ptr<content::V8ValueConverter> converter( |
| 313 content::V8ValueConverter::create()); | 315 content::V8ValueConverter::create()); |
| 314 base::StringValue value("placeholderReady"); | 316 base::StringValue value("placeholderReady"); |
| 315 blink::WebSerializedScriptValue message_data = | 317 blink::WebSerializedScriptValue message_data = |
| 316 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( | 318 blink::WebSerializedScriptValue::serialize(converter->ToV8Value( |
| 317 &value, element.document().frame()->mainWorldScriptContext())); | 319 &value, element.document().frame()->mainWorldScriptContext())); |
| 318 blink::WebDOMMessageEvent msg_event(message_data); | 320 blink::WebDOMMessageEvent msg_event(message_data); |
| 319 | 321 |
| 320 plugin()->container()->enqueueMessageEvent(msg_event); | 322 plugin()->container()->enqueueMessageEvent(msg_event); |
| 321 } | 323 } |
| 322 | 324 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 337 return identifier_; | 339 return identifier_; |
| 338 } | 340 } |
| 339 | 341 |
| 340 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 342 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 341 DCHECK(allow_loading_); | 343 DCHECK(allow_loading_); |
| 342 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || | 344 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || |
| 343 is_blocked_for_prerendering_; | 345 is_blocked_for_prerendering_; |
| 344 } | 346 } |
| 345 | 347 |
| 346 } // namespace plugins | 348 } // namespace plugins |
| OLD | NEW |