| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/renderer/plugins/chrome_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 context_menu_request_id_ = render_frame()->ShowContextMenu(this, params); | 377 context_menu_request_id_ = render_frame()->ShowContextMenu(this, params); |
| 378 g_last_active_menu = this; | 378 g_last_active_menu = this; |
| 379 } | 379 } |
| 380 | 380 |
| 381 blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() { | 381 blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() { |
| 382 std::unique_ptr<content::PluginInstanceThrottler> throttler; | 382 std::unique_ptr<content::PluginInstanceThrottler> throttler; |
| 383 // If the plugin has already been marked essential in its placeholder form, | 383 // If the plugin has already been marked essential in its placeholder form, |
| 384 // we shouldn't create a new throttler and start the process all over again. | 384 // we shouldn't create a new throttler and start the process all over again. |
| 385 if (power_saver_enabled()) { | 385 if (power_saver_enabled()) { |
| 386 throttler = content::PluginInstanceThrottler::Create(); | 386 throttler = content::PluginInstanceThrottler::Create( |
| 387 heuristic_run_before_ ? content::RenderFrame::DONT_RECORD_DECISION |
| 388 : content::RenderFrame::RECORD_DECISION); |
| 387 // PluginPreroller manages its own lifetime. | 389 // PluginPreroller manages its own lifetime. |
| 388 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), | 390 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), |
| 389 GetPluginInfo(), GetIdentifier(), title_, | 391 GetPluginInfo(), GetIdentifier(), title_, |
| 390 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), | 392 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), |
| 391 throttler.get()); | 393 throttler.get()); |
| 392 } | 394 } |
| 393 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), | 395 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), |
| 394 GetPluginParams(), std::move(throttler)); | 396 GetPluginParams(), std::move(throttler)); |
| 395 } | 397 } |
| 396 | 398 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 419 | 421 |
| 420 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 422 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 421 switches::kEnablePluginPlaceholderTesting)) { | 423 switches::kEnablePluginPlaceholderTesting)) { |
| 422 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( | 424 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
| 423 "didFinishIconRepositionForTesting", | 425 "didFinishIconRepositionForTesting", |
| 424 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); | 426 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
| 425 } | 427 } |
| 426 | 428 |
| 427 return builder; | 429 return builder; |
| 428 } | 430 } |
| OLD | NEW |