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 "base/command_line.h" |
7 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "chrome/common/prerender_messages.h" | 11 #include "chrome/common/prerender_messages.h" |
11 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
13 #include "chrome/grit/renderer_resources.h" | 14 #include "chrome/grit/renderer_resources.h" |
14 #include "chrome/renderer/chrome_content_renderer_client.h" | 15 #include "chrome/renderer/chrome_content_renderer_client.h" |
15 #include "chrome/renderer/custom_menu_commands.h" | 16 #include "chrome/renderer/custom_menu_commands.h" |
16 #include "chrome/renderer/plugins/plugin_preroller.h" | 17 #include "chrome/renderer/plugins/plugin_preroller.h" |
17 #include "chrome/renderer/plugins/plugin_uma.h" | 18 #include "chrome/renderer/plugins/plugin_uma.h" |
18 #include "components/content_settings/content/common/content_settings_messages.h
" | 19 #include "components/content_settings/content/common/content_settings_messages.h
" |
| 20 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/context_menu_params.h" | 21 #include "content/public/common/context_menu_params.h" |
20 #include "content/public/renderer/render_frame.h" | 22 #include "content/public/renderer/render_frame.h" |
21 #include "content/public/renderer/render_thread.h" | 23 #include "content/public/renderer/render_thread.h" |
22 #include "gin/object_template_builder.h" | 24 #include "gin/object_template_builder.h" |
23 #include "third_party/WebKit/public/web/WebDocument.h" | 25 #include "third_party/WebKit/public/web/WebDocument.h" |
24 #include "third_party/WebKit/public/web/WebInputEvent.h" | 26 #include "third_party/WebKit/public/web/WebInputEvent.h" |
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 27 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
26 #include "third_party/WebKit/public/web/WebScriptSource.h" | 28 #include "third_party/WebKit/public/web/WebScriptSource.h" |
27 #include "third_party/WebKit/public/web/WebView.h" | 29 #include "third_party/WebKit/public/web/WebView.h" |
28 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 GetPluginInfo(), GetIdentifier(), title_, | 353 GetPluginInfo(), GetIdentifier(), title_, |
352 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), | 354 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), |
353 throttler.get()); | 355 throttler.get()); |
354 } | 356 } |
355 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), | 357 return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), |
356 GetPluginParams(), throttler.Pass()); | 358 GetPluginParams(), throttler.Pass()); |
357 } | 359 } |
358 | 360 |
359 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( | 361 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
360 v8::Isolate* isolate) { | 362 v8::Isolate* isolate) { |
361 return gin::Wrappable<ChromePluginPlaceholder>::GetObjectTemplateBuilder( | 363 gin::ObjectTemplateBuilder builder = |
362 isolate) | 364 gin::Wrappable<ChromePluginPlaceholder>::GetObjectTemplateBuilder(isolate) |
363 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 365 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
364 "hide", &ChromePluginPlaceholder::HideCallback) | 366 "hide", &ChromePluginPlaceholder::HideCallback) |
365 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 367 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
366 "load", &ChromePluginPlaceholder::LoadCallback) | 368 "load", &ChromePluginPlaceholder::LoadCallback) |
367 .SetMethod<void (ChromePluginPlaceholder::*)()>( | 369 .SetMethod<void (ChromePluginPlaceholder::*)()>( |
368 "didFinishLoading", | 370 "didFinishLoading", |
369 &ChromePluginPlaceholder::DidFinishLoadingCallback) | 371 &ChromePluginPlaceholder::DidFinishLoadingCallback) |
370 .SetMethod("openAboutPlugins", | 372 .SetMethod("openAboutPlugins", |
371 &ChromePluginPlaceholder::OpenAboutPluginsCallback); | 373 &ChromePluginPlaceholder::OpenAboutPluginsCallback); |
| 374 |
| 375 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 376 switches::kEnablePluginPlaceholderTesting)) { |
| 377 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
| 378 "didFinishIconRepositionForTesting", |
| 379 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
| 380 } |
| 381 |
| 382 return builder; |
372 } | 383 } |
OLD | NEW |