| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 v8::Local<v8::Object> LoadablePluginPlaceholder::GetV8ScriptableObject( | 172 v8::Local<v8::Object> LoadablePluginPlaceholder::GetV8ScriptableObject( |
| 173 v8::Isolate* isolate) const { | 173 v8::Isolate* isolate) const { |
| 174 // Pass through JavaScript access to the underlying throttled plugin. | 174 // Pass through JavaScript access to the underlying throttled plugin. |
| 175 if (premade_throttler_ && premade_throttler_->GetWebPlugin()) { | 175 if (premade_throttler_ && premade_throttler_->GetWebPlugin()) { |
| 176 return premade_throttler_->GetWebPlugin()->v8ScriptableObject(isolate); | 176 return premade_throttler_->GetWebPlugin()->v8ScriptableObject(isolate); |
| 177 } | 177 } |
| 178 return v8::Local<v8::Object>(); | 178 return v8::Local<v8::Object>(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool LoadablePluginPlaceholder::IsErrorPlaceholder() { |
| 182 return !allow_loading_; |
| 183 } |
| 184 |
| 181 void LoadablePluginPlaceholder::OnUnobscuredRectUpdate( | 185 void LoadablePluginPlaceholder::OnUnobscuredRectUpdate( |
| 182 const gfx::Rect& unobscured_rect) { | 186 const gfx::Rect& unobscured_rect) { |
| 183 DCHECK(content::RenderThread::Get()); | 187 DCHECK(content::RenderThread::Get()); |
| 184 | 188 |
| 185 if (!plugin() || !finished_loading_) | 189 if (!plugin() || !finished_loading_) |
| 186 return; | 190 return; |
| 187 | 191 |
| 188 if (!is_blocked_for_tinyness_ && !is_blocked_for_power_saver_poster_) | 192 if (!is_blocked_for_tinyness_ && !is_blocked_for_power_saver_poster_) |
| 189 return; | 193 return; |
| 190 | 194 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return identifier_; | 370 return identifier_; |
| 367 } | 371 } |
| 368 | 372 |
| 369 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 373 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 370 DCHECK(allow_loading_); | 374 DCHECK(allow_loading_); |
| 371 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || | 375 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || |
| 372 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; | 376 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; |
| 373 } | 377 } |
| 374 | 378 |
| 375 } // namespace plugins | 379 } // namespace plugins |
| OLD | NEW |