Index: chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc |
diff --git a/chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc b/chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..56e71ce38cb19acd25354c8a74eafcf07f383ef8 |
--- /dev/null |
+++ b/chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc |
@@ -0,0 +1,49 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/renderer/plugins/shadow_dom_plugin_placeholder.h" |
+ |
+#include "base/command_line.h" |
+#include "chrome/common/chrome_switches.h" |
+#include "chrome/grit/generated_resources.h" |
+#include "third_party/WebKit/public/web/WebPluginPlaceholder.h" |
+#include "ui/base/l10n/l10n_util.h" |
+ |
+bool ShadowDOMPluginPlaceholderEnabled() { |
+ return CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnablePluginPlaceholderShadowDom); |
+} |
+ |
+namespace { |
Bernhard Bauer
2014/10/29 09:53:05
Can you move the anonymous namespace methods to th
jbroman
2014/10/29 17:14:43
Done.
|
+ |
+class PluginPlaceholderBase : public blink::WebPluginPlaceholder { |
+ public: |
+ virtual bool IsMissingPluginPlaceholder() const { return false; } |
+}; |
+ |
+class MissingPluginPlaceholder : public PluginPlaceholderBase { |
+ public: |
+ // blink::WebPluginPlaceholder overrides |
+ blink::WebString message() const override { |
+ // TODO(jbroman): IDS_PLUGIN_SEARCHING if ENABLE_PLUGIN_INSTALLATION |
+ return l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_SUPPORTED); |
+ } |
+ |
+ // PluginPlaceholderBase overrides |
+ bool IsMissingPluginPlaceholder() const override { return true; } |
+}; |
+ |
+} // namespace |
+ |
+scoped_ptr<blink::WebPluginPlaceholder> |
+CreateShadowDOMPlaceholderForMissingPlugin() { |
+ return make_scoped_ptr(new MissingPluginPlaceholder); |
+} |
+ |
+bool IsShadowDOMPlaceholderForMissingPlugin( |
+ blink::WebPluginPlaceholder* placeholder) { |
+ return placeholder && |
+ static_cast<PluginPlaceholderBase*>(placeholder) |
+ ->IsMissingPluginPlaceholder(); |
+} |