Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2465)

Unified Diff: chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc

Issue 649873006: Enable shadow DOM-based "missing plugin" placeholder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed deleting this in the previous patch set Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ee694a8bfa55f10e0e8713b69872850928f453dd
--- /dev/null
+++ b/chrome/renderer/plugins/shadow_dom_plugin_placeholder.cc
@@ -0,0 +1,54 @@
+// 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/common/render_messages.h"
+#include "chrome/grit/generated_resources.h"
+#include "chrome/renderer/plugins/plugin_uma.h"
+#include "third_party/WebKit/public/web/WebPluginParams.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace {
+
+class MissingPluginPlaceholder : public blink::WebPluginPlaceholder {
+ 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);
+ }
+};
+
+} // namespace
+
+bool ShadowDOMPluginPlaceholderEnabled() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnablePluginPlaceholderShadowDom);
+}
+
+scoped_ptr<blink::WebPluginPlaceholder>
+CreateShadowDOMPlaceholderForPluginInfo(
+ const ChromeViewHostMsg_GetPluginInfo_Output& output,
+ const blink::WebPluginParams& orig_params)
+{
Bernhard Bauer 2014/10/29 17:45:54 Nit: Opening brace goes on the previous line.
jbroman 2014/10/29 18:14:40 Whoops. Thought I'd run clang-format before upload
+ using Status = ChromeViewHostMsg_GetPluginInfo_Status;
+ Status::Value status = output.status.value;
+ if (status == Status::kNotFound) {
+ // TODO(jbroman): Handle YouTube specially here, as in
+ // ChromeContentRendererClient::CreatePlugin.
+ PluginUMAReporter::GetInstance()->ReportPluginMissing(
+ orig_params.mimeType.utf8(), orig_params.url);
+ return CreateShadowDOMPlaceholderForMissingPlugin();
+ }
+
+ return nullptr;
+}
+
+scoped_ptr<blink::WebPluginPlaceholder>
+CreateShadowDOMPlaceholderForMissingPlugin() {
+ return make_scoped_ptr(new MissingPluginPlaceholder);
+}

Powered by Google App Engine
This is Rietveld 408576698