| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 LoadPlugin(); | 256 LoadPlugin(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void LoadablePluginPlaceholder::OnLoadBlockedPlugins( | 260 void LoadablePluginPlaceholder::OnLoadBlockedPlugins( |
| 261 const std::string& identifier) { | 261 const std::string& identifier) { |
| 262 if (!identifier.empty() && identifier != identifier_) | 262 if (!identifier.empty() && identifier != identifier_) |
| 263 return; | 263 return; |
| 264 | 264 |
| 265 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_UI")); | 265 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_UI")); |
| 266 MarkPluginEssential(PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); | 266 MarkPluginEssential( |
| 267 PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_OMNIBOX_ICON); |
| 267 LoadPlugin(); | 268 LoadPlugin(); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void LoadablePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { | 271 void LoadablePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { |
| 271 // Prerendering can only be enabled prior to a RenderView's first navigation, | 272 // Prerendering can only be enabled prior to a RenderView's first navigation, |
| 272 // so no BlockedPlugin should see the notification that enables prerendering. | 273 // so no BlockedPlugin should see the notification that enables prerendering. |
| 273 DCHECK(!is_prerendering); | 274 DCHECK(!is_prerendering); |
| 274 if (is_blocked_for_prerendering_) { | 275 if (is_blocked_for_prerendering_) { |
| 275 is_blocked_for_prerendering_ = false; | 276 is_blocked_for_prerendering_ = false; |
| 276 if (!LoadingBlocked()) | 277 if (!LoadingBlocked()) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return identifier_; | 360 return identifier_; |
| 360 } | 361 } |
| 361 | 362 |
| 362 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 363 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
| 363 DCHECK(allow_loading_); | 364 DCHECK(allow_loading_); |
| 364 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || | 365 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || |
| 365 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; | 366 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; |
| 366 } | 367 } |
| 367 | 368 |
| 368 } // namespace plugins | 369 } // namespace plugins |
| OLD | NEW |