| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Prevent processing subsequent calls to MarkPluginEssential. | 242 // Prevent processing subsequent calls to MarkPluginEssential. |
| 243 power_saver_enabled_ = false; | 243 power_saver_enabled_ = false; |
| 244 } | 244 } |
| 245 #endif | 245 #endif |
| 246 | 246 |
| 247 PluginPlaceholder::PluginDestroyed(); | 247 PluginPlaceholder::PluginDestroyed(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 v8::Local<v8::Object> LoadablePluginPlaceholder::GetV8ScriptableObject( |
| 251 v8::Isolate* isolate) const { |
| 252 #if defined(ENABLE_PLUGINS) |
| 253 // Pass through JavaScript access to the underlying throttled plugin. |
| 254 if (premade_throttler_ && premade_throttler_->GetWebPlugin()) { |
| 255 return premade_throttler_->GetWebPlugin()->v8ScriptableObject(isolate); |
| 256 } |
| 257 #endif |
| 258 return v8::Local<v8::Object>(); |
| 259 } |
| 260 |
| 250 void LoadablePluginPlaceholder::WasShown() { | 261 void LoadablePluginPlaceholder::WasShown() { |
| 251 if (is_blocked_for_background_tab_) { | 262 if (is_blocked_for_background_tab_) { |
| 252 is_blocked_for_background_tab_ = false; | 263 is_blocked_for_background_tab_ = false; |
| 253 if (!LoadingBlocked()) | 264 if (!LoadingBlocked()) |
| 254 LoadPlugin(); | 265 LoadPlugin(); |
| 255 } | 266 } |
| 256 } | 267 } |
| 257 | 268 |
| 258 void LoadablePluginPlaceholder::OnLoadBlockedPlugins( | 269 void LoadablePluginPlaceholder::OnLoadBlockedPlugins( |
| 259 const std::string& identifier) { | 270 const std::string& identifier) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 return identifier_; | 350 return identifier_; |
| 340 } | 351 } |
| 341 | 352 |
| 342 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 353 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 343 DCHECK(allow_loading_); | 354 DCHECK(allow_loading_); |
| 344 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || | 355 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || |
| 345 is_blocked_for_prerendering_; | 356 is_blocked_for_prerendering_; |
| 346 } | 357 } |
| 347 | 358 |
| 348 } // namespace plugins | 359 } // namespace plugins |
| OLD | NEW |