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

Unified Diff: chrome/renderer/plugins/chrome_plugin_placeholder.h

Issue 23606022: Move renderer plugin code into a new component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move renderer plugin code into a new component - reply to comments and add namespace Created 7 years, 3 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/chrome_plugin_placeholder.h
diff --git a/chrome/renderer/plugins/plugin_placeholder.h b/chrome/renderer/plugins/chrome_plugin_placeholder.h
similarity index 35%
copy from chrome/renderer/plugins/plugin_placeholder.h
copy to chrome/renderer/plugins/chrome_plugin_placeholder.h
index 7ec95bae6b1786330404ae10af3c32a93196e731..fefab1bfd7c9693f25a177d6f0f6df9eb96cc377 100644
--- a/chrome/renderer/plugins/plugin_placeholder.h
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.h
@@ -1,43 +1,21 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
-#define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
+#ifndef CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
+#define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_
-#include "chrome/renderer/plugins/webview_plugin.h"
-#include "content/public/common/webplugininfo.h"
-#include "content/public/renderer/context_menu_client.h"
-#include "content/public/renderer/render_process_observer.h"
-#include "content/public/renderer/render_view_observer.h"
-#include "third_party/WebKit/public/web/WebPluginParams.h"
-#include "webkit/renderer/cpp_bound_class.h"
+#include "components/plugins/renderer/plugin_placeholder.h"
struct ChromeViewHostMsg_GetPluginInfo_Status;
-namespace content {
-struct WebPluginInfo;
-}
-
-// Placeholders can be used if a plug-in is missing or not available
-// (blocked or disabled).
-class PluginPlaceholder : public content::RenderViewObserver,
- public content::RenderProcessObserver,
- public webkit_glue::CppBoundClass,
- public WebViewPlugin::Delegate,
- public content::ContextMenuClient {
+class ChromePluginPlaceholder : public plugins::PluginPlaceholder,
+ public content::RenderProcessObserver,
+ public content::ContextMenuClient {
public:
- // Creates a new WebViewPlugin with a MissingPlugin as a delegate.
- static PluginPlaceholder* CreateMissingPlugin(
- content::RenderView* render_view,
- WebKit::WebFrame* frame,
- const WebKit::WebPluginParams& params);
+ static const char kPluginPlaceholderDataURL[];
- static PluginPlaceholder* CreateErrorPlugin(
- content::RenderView* render_view,
- const base::FilePath& plugin_path);
-
- static PluginPlaceholder* CreateBlockedPlugin(
+ static ChromePluginPlaceholder* CreateBlockedPlugin(
content::RenderView* render_view,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params,
@@ -47,25 +25,15 @@ class PluginPlaceholder : public content::RenderViewObserver,
int resource_id,
const string16& message);
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN)
- // Placeholder for old style embedded youtube video on mobile device. For old
- // style embedded youtube video, it has a url in the form of
- // http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with a
- // simple html page and clicking the play image redirects the user to the
- // mobile youtube app.
- static PluginPlaceholder* CreateMobileYoutubePlugin(
- content::RenderView* render_view,
- WebKit::WebFrame* frame,
- const WebKit::WebPluginParams& params);
-#endif
-
- WebViewPlugin* plugin() { return plugin_; }
-
- void set_blocked_for_prerendering(bool blocked_for_prerendering) {
- is_blocked_for_prerendering_ = blocked_for_prerendering;
- }
+ // Creates a new WebViewPlugin with a MissingPlugin as a delegate.
+ static ChromePluginPlaceholder* CreateMissingPlugin(
+ content::RenderView* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params);
- void set_allow_loading(bool allow_loading) { allow_loading_ = allow_loading; }
+ static ChromePluginPlaceholder* CreateErrorPlugin(
+ content::RenderView* render_view,
+ const base::FilePath& plugin_path);
void SetStatus(const ChromeViewHostMsg_GetPluginInfo_Status& status);
@@ -73,30 +41,23 @@ class PluginPlaceholder : public content::RenderViewObserver,
int32 CreateRoutingId();
#endif
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN)
- // Whether this is a youtube url.
- static bool IsYouTubeURL(const GURL& url, const std::string& mime_type);
-#endif
-
private:
- // |render_view| and |frame| are weak pointers. If either one is going away,
- // our |plugin_| will be destroyed as well and will notify us.
- PluginPlaceholder(content::RenderView* render_view,
- WebKit::WebFrame* frame,
- const WebKit::WebPluginParams& params,
- const std::string& html_data,
- const string16& title);
-
- virtual ~PluginPlaceholder();
-
- // WebViewPlugin::Delegate methods:
+ ChromePluginPlaceholder(content::RenderView* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params,
+ const std::string& html_data,
+ const string16& title);
+ virtual ~ChromePluginPlaceholder();
+
+ // WebViewPlugin::Delegate (via PluginPlaceholder) method
virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE;
- virtual void WillDestroyPlugin() OVERRIDE;
- virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE;
- // content::RenderViewObserver methods:
+ // content::RenderViewObserver (via PluginPlaceholder) override:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // WebViewPlugin::Delegate (via PluginPlaceholder) methods:
+ virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE;
+
// content::RenderProcessObserver methods:
virtual void PluginListChanged() OVERRIDE;
@@ -104,35 +65,11 @@ class PluginPlaceholder : public content::RenderViewObserver,
virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE;
virtual void OnMenuClosed(int request_id) OVERRIDE;
- // Replace this placeholder with a different plugin (which could be
- // a placeholder again).
- void ReplacePlugin(WebKit::WebPlugin* new_plugin);
-
- // Hide this placeholder.
- void HidePlugin();
-
- // Load the blocked plugin.
- void LoadPlugin();
-
- // Javascript callbacks:
- // Load the blocked plugin by calling LoadPlugin().
- // Takes no arguments, and returns nothing.
- void LoadCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-
- // Hide the blocked plugin by calling HidePlugin().
- // Takes no arguments, and returns nothing.
- void HideCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-
- // Opens chrome://plugins in a new tab.
- // Takes no arguments, and returns nothing.
+ // Javascript callback opens chrome://plugins in a new tab.
+ // Arguments are required by the caller, but not used.
void OpenAboutPluginsCallback(const webkit_glue::CppArgumentList& args,
webkit_glue::CppVariant* result);
- void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-
void OnLoadBlockedPlugins(const std::string& identifier);
void OnSetIsPrerendering(bool is_prerendering);
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -144,35 +81,11 @@ class PluginPlaceholder : public content::RenderViewObserver,
void OnCancelledDownloadingPlugin();
#endif
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN)
- // Check whether the url is valid.
- static bool IsValidYouTubeVideo(const std::string& path);
-
- // Opens a youtube app in the current tab.
- void OpenYoutubeUrlCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-#endif
-
- void SetMessage(const string16& message);
- void UpdateMessage();
-
- WebKit::WebFrame* frame_;
- WebKit::WebPluginParams plugin_params_;
- WebViewPlugin* plugin_;
-
- content::WebPluginInfo plugin_info_;
-
- string16 title_;
- string16 message_;
-
// We use a scoped_ptr so we can forward-declare the struct; it's defined in
// an IPC message file which can't be easily included in other header files.
scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_;
- // True iff the plugin was blocked because the page was being prerendered.
- // Plugin will automatically be loaded when the page is displayed.
- bool is_blocked_for_prerendering_;
- bool allow_loading_;
+ string16 title_;
#if defined(ENABLE_PLUGIN_INSTALLATION)
// |routing_id()| is the routing ID of our associated RenderView, but we have
@@ -180,14 +93,11 @@ class PluginPlaceholder : public content::RenderViewObserver,
int32 placeholder_routing_id_;
#endif
- bool hidden_;
bool has_host_;
- bool finished_loading_;
- string16 plugin_name_;
- std::string identifier_;
int context_menu_request_id_; // Nonzero when request pending.
+ string16 plugin_name_;
- DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
+ DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder);
};
-#endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
+#endif // CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_

Powered by Google App Engine
This is Rietveld 408576698