| 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/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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 int y = roundf(unobscured_rect_.y() / zoom_factor); | 202 int y = roundf(unobscured_rect_.y() / zoom_factor); |
| 203 std::string script = base::StringPrintf( | 203 std::string script = base::StringPrintf( |
| 204 "window.resizePoster('%dpx', '%dpx', '%dpx', '%dpx')", x, y, width, | 204 "window.resizePoster('%dpx', '%dpx', '%dpx', '%dpx')", x, y, width, |
| 205 height); | 205 height); |
| 206 plugin()->web_view()->mainFrame()->executeScript( | 206 plugin()->web_view()->mainFrame()->executeScript( |
| 207 blink::WebScriptSource(base::UTF8ToUTF16(script))); | 207 blink::WebScriptSource(base::UTF8ToUTF16(script))); |
| 208 | 208 |
| 209 // On a size update check if we now qualify as a essential plugin. | 209 // On a size update check if we now qualify as a essential plugin. |
| 210 url::Origin content_origin = url::Origin(GetPluginParams().url); | 210 url::Origin content_origin = url::Origin(GetPluginParams().url); |
| 211 auto status = render_frame()->GetPeripheralContentStatus( | 211 auto status = render_frame()->GetPeripheralContentStatus( |
| 212 render_frame()->GetWebFrame()->top()->securityOrigin(), content_origin, | 212 render_frame()->GetWebFrame()->top()->getSecurityOrigin(), |
| 213 gfx::Size(width, height)); | 213 content_origin, gfx::Size(width, height)); |
| 214 if (status != content::RenderFrame::CONTENT_STATUS_PERIPHERAL) { | 214 if (status != content::RenderFrame::CONTENT_STATUS_PERIPHERAL) { |
| 215 MarkPluginEssential( | 215 MarkPluginEssential( |
| 216 heuristic_run_before_ | 216 heuristic_run_before_ |
| 217 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE | 217 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE |
| 218 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); | 218 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); |
| 219 | 219 |
| 220 if (!heuristic_run_before_ && | 220 if (!heuristic_run_before_ && |
| 221 status == | 221 status == |
| 222 content::RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) { | 222 content::RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) { |
| 223 render_frame()->WhitelistContentOrigin(content_origin); | 223 render_frame()->WhitelistContentOrigin(content_origin); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return identifier_; | 337 return identifier_; |
| 338 } | 338 } |
| 339 | 339 |
| 340 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 340 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 341 DCHECK(allow_loading_); | 341 DCHECK(allow_loading_); |
| 342 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || | 342 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || |
| 343 is_blocked_for_prerendering_; | 343 is_blocked_for_prerendering_; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace plugins | 346 } // namespace plugins |
| OLD | NEW |