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 <utility> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 12 #include "base/values.h" |
11 #include "chrome/common/prerender_messages.h" | 13 #include "chrome/common/prerender_messages.h" |
12 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
13 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/grit/renderer_resources.h" | 16 #include "chrome/grit/renderer_resources.h" |
15 #include "chrome/renderer/chrome_content_renderer_client.h" | 17 #include "chrome/renderer/chrome_content_renderer_client.h" |
16 #include "chrome/renderer/custom_menu_commands.h" | 18 #include "chrome/renderer/custom_menu_commands.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // we shouldn't create a new throttler and start the process all over again. | 356 // we shouldn't create a new throttler and start the process all over again. |
355 if (power_saver_enabled()) { | 357 if (power_saver_enabled()) { |
356 throttler = content::PluginInstanceThrottler::Create(); | 358 throttler = content::PluginInstanceThrottler::Create(); |
357 // PluginPreroller manages its own lifetime. | 359 // PluginPreroller manages its own lifetime. |
358 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), | 360 new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), |
359 GetPluginInfo(), GetIdentifier(), title_, | 361 GetPluginInfo(), GetIdentifier(), title_, |
360 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), | 362 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), |
361 throttler.get()); | 363 throttler.get()); |
362 } | 364 } |
363 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), | 365 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), |
364 GetPluginParams(), throttler.Pass()); | 366 GetPluginParams(), std::move(throttler)); |
365 } | 367 } |
366 | 368 |
367 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( | 369 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
368 v8::Isolate* isolate) { | 370 v8::Isolate* isolate) { |
369 gin::ObjectTemplateBuilder builder = | 371 gin::ObjectTemplateBuilder builder = |
370 gin::Wrappable<ChromePluginPlaceholder>::GetObjectTemplateBuilder(isolate) | 372 gin::Wrappable<ChromePluginPlaceholder>::GetObjectTemplateBuilder(isolate) |
371 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 373 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
372 "hide", &ChromePluginPlaceholder::HideCallback) | 374 "hide", &ChromePluginPlaceholder::HideCallback) |
373 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 375 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
374 "load", &ChromePluginPlaceholder::LoadCallback) | 376 "load", &ChromePluginPlaceholder::LoadCallback) |
375 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 377 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
376 "didFinishLoading", | 378 "didFinishLoading", |
377 &ChromePluginPlaceholder::DidFinishLoadingCallback) | 379 &ChromePluginPlaceholder::DidFinishLoadingCallback) |
378 .SetMethod("openAboutPlugins", | 380 .SetMethod("openAboutPlugins", |
379 &ChromePluginPlaceholder::OpenAboutPluginsCallback); | 381 &ChromePluginPlaceholder::OpenAboutPluginsCallback); |
380 | 382 |
381 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 383 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
382 switches::kEnablePluginPlaceholderTesting)) { | 384 switches::kEnablePluginPlaceholderTesting)) { |
383 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( | 385 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
384 "didFinishIconRepositionForTesting", | 386 "didFinishIconRepositionForTesting", |
385 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); | 387 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
386 } | 388 } |
387 | 389 |
388 return builder; | 390 return builder; |
389 } | 391 } |
OLD | NEW |