diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 17:27:28 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 17:27:28 +0000 |
commit | 43b7eaca6e8b1c46fc0f9d29be7c38014874defc (patch) | |
tree | d532110d25e970e067ecb66d2f33d195f45eaf16 | |
parent | 4f4b2ac3eee9515b079b524606de07bd04a346c7 (diff) | |
download | chromium_src-43b7eaca6e8b1c46fc0f9d29be7c38014874defc.zip chromium_src-43b7eaca6e8b1c46fc0f9d29be7c38014874defc.tar.gz chromium_src-43b7eaca6e8b1c46fc0f9d29be7c38014874defc.tar.bz2 |
Remove plugin installation code on ChromeOS and Aura.
BUG=62079
TEST=compiles
Review URL: http://codereview.chromium.org/9113011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117443 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/plugin_observer.cc | 24 | ||||
-rw-r--r-- | chrome/browser/plugin_observer.h | 18 | ||||
-rw-r--r-- | chrome/chrome.gyp | 6 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 17 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 5 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 5 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 2 | ||||
-rw-r--r-- | chrome/renderer/plugins/missing_plugin.cc | 22 | ||||
-rw-r--r-- | chrome/renderer/plugins/missing_plugin.h | 8 |
9 files changed, 90 insertions, 17 deletions
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 365e054..338c851 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -12,14 +12,10 @@ #include "chrome/browser/google/google_util.h" #include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/plugin_finder.h" -#include "chrome/browser/plugin_installer.h" -#include "chrome/browser/plugin_installer_infobar_delegate.h" -#include "chrome/browser/plugin_installer_observer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" @@ -34,6 +30,13 @@ #include "webkit/plugins/npapi/plugin_group.h" #include "webkit/plugins/webplugininfo.h" +#if defined(ENABLE_PLUGIN_INSTALLATION) +#include "chrome/browser/plugin_installer.h" +#include "chrome/browser/plugin_installer_infobar_delegate.h" +#include "chrome/browser/plugin_installer_observer.h" +#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" +#endif // defined(ENABLE_PLUGIN_INSTALLATION) + using content::OpenURLParams; using content::Referrer; using content::UserMetricsAction; @@ -295,6 +298,7 @@ bool OutdatedPluginInfoBarDelegate::LinkClicked( return PluginInfoBarDelegate::LinkClicked(disposition); } +#if defined(ENABLE_PLUGIN_INSTALLATION) class ConfirmInstallDialogDelegate : public TabModalConfirmDialogDelegate, public PluginInstallerObserver { public: @@ -348,11 +352,13 @@ void ConfirmInstallDialogDelegate::OnCanceled() { void ConfirmInstallDialogDelegate::DidStartDownload() { Cancel(); } +#endif // defined(ENABLE_PLUGIN_INSTALLATION) } // namespace // PluginObserver ------------------------------------------------------------- +#if defined(ENABLE_PLUGIN_INSTALLATION) class PluginObserver::MissingPluginHost : public PluginInstallerObserver { public: MissingPluginHost(PluginObserver* observer, @@ -389,6 +395,7 @@ class PluginObserver::MissingPluginHost : public PluginInstallerObserver { int routing_id_; }; +#endif // defined(ENABLE_PLUGIN_INSTALLATION) PluginObserver::PluginObserver(TabContentsWrapper* tab_contents) : content::WebContentsObserver(tab_contents->web_contents()), @@ -403,8 +410,10 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, OnBlockedOutdatedPlugin) +#if defined(ENABLE_PLUGIN_INSTALLATION) IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, OnFindMissingPlugin) +#endif IPC_MESSAGE_UNHANDLED(return false) IPC_END_MESSAGE_MAP() @@ -422,6 +431,7 @@ void PluginObserver::OnBlockedOutdatedPlugin(const string16& name, new OutdatedPluginInfoBarDelegate(infobar_helper, name, update_url)); } +#if defined(ENABLE_PLUGIN_INSTALLATION) void PluginObserver::OnFindMissingPlugin(int placeholder_id, const std::string& mime_type) { PluginFinder* plugin_finder = PluginFinder::GetInstance(); @@ -431,7 +441,7 @@ void PluginObserver::OnFindMissingPlugin(int placeholder_id, base::Bind(&PluginObserver::FoundMissingPlugin, weak_ptr_factory_.GetWeakPtr(), placeholder_id, mime_type), base::Bind(&PluginObserver::DidNotFindMissingPlugin, - weak_ptr_factory_.GetWeakPtr(), placeholder_id, mime_type)); + weak_ptr_factory_.GetWeakPtr(), placeholder_id)); } void PluginObserver::FoundMissingPlugin(int placeholder_id, @@ -450,8 +460,7 @@ void PluginObserver::FoundMissingPlugin(int placeholder_id, infobar_helper->AddInfoBar(delegate); } -void PluginObserver::DidNotFindMissingPlugin(int placeholder_id, - const std::string& mime_type) { +void PluginObserver::DidNotFindMissingPlugin(int placeholder_id) { Send(new ChromeViewMsg_DidNotFindMissingPlugin(placeholder_id)); } @@ -468,3 +477,4 @@ void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { tab_contents_); } } +#endif // defined(ENABLE_PLUGIN_INSTALLATION) diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h index 76399e2..9deaedd 100644 --- a/chrome/browser/plugin_observer.h +++ b/chrome/browser/plugin_observer.h @@ -6,15 +6,22 @@ #define CHROME_BROWSER_PLUGIN_OBSERVER_H_ #pragma once -#include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/web_contents_observer.h" +#if defined(ENABLE_PLUGIN_INSTALLATION) +#include "base/memory/scoped_vector.h" +#endif + class GURL; class InfoBarDelegate; class PluginInstaller; class TabContentsWrapper; +#if defined(ENABLE_PLUGIN_INSTALLATION) +class PluginInstaller; +#endif + class PluginObserver : public content::WebContentsObserver { public: explicit PluginObserver(TabContentsWrapper* tab_contents); @@ -24,23 +31,28 @@ class PluginObserver : public content::WebContentsObserver { virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; private: +#if defined(ENABLE_PLUGIN_INSTALLATION) class MissingPluginHost; +#endif void OnBlockedOutdatedPlugin(const string16& name, const GURL& update_url); +#if defined(ENABLE_PLUGIN_INSTALLATION) void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); void FoundMissingPlugin(int placeholder_id, const std::string& mime_type, PluginInstaller* installer); - void DidNotFindMissingPlugin(int placeholder_id, - const std::string& mime_type); + void DidNotFindMissingPlugin(int placeholder_id); void InstallMissingPlugin(PluginInstaller* installer); +#endif base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; TabContentsWrapper* tab_contents_; +#if defined(ENABLE_PLUGIN_INSTALLATION) ScopedVector<MissingPluginHost> missing_plugins_; +#endif DISALLOW_COPY_AND_ASSIGN(PluginObserver); }; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 59db3d397c..c63749d 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -42,6 +42,7 @@ 'repack_locales_cmd': ['python', 'tools/build/repack_locales.py'], # TODO: remove this helper when we have loops in GYP 'apply_locales_cmd': ['python', '<(DEPTH)/build/apply_locales.py'], + 'enable_plugin_installation': 1, 'conditions': [ ['OS=="win"', { 'nacl_defines': [ @@ -96,6 +97,11 @@ }], # branding ], # conditions }], # OS=="mac" + ['use_aura==1 or chromeos==1', { + 'variables': { + 'enable_plugin_installation': 0, + } + }], # TODO(mcgrathr): This duplicates native_client/build/common.gypi; # we should figure out a way to unify the settings. ['target_arch=="ia32"', { diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 38f77cd..47b0215 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -4216,6 +4216,11 @@ ['include', '^browser/safe_browsing/safe_browsing_tab_observer.h'], ], }], + ['enable_plugin_installation', { + 'defines': [ + 'ENABLE_PLUGIN_INSTALLATION', + ], + }], ['chromeos==0', { 'sources/': [ ['exclude', '^browser/chromeos'], @@ -5332,6 +5337,18 @@ ['exclude', '^browser/chromeos/notifications/'], ], }], + ['enable_plugin_installation==0', { + 'sources!': [ + 'browser/plugin_finder.cc', + 'browser/plugin_finder.h', + 'browser/plugin_installer.cc', + 'browser/plugin_installer.h', + 'browser/plugin_installer_infobar_delegate.cc', + 'browser/plugin_installer_infobar_delegate.h', + 'browser/plugin_installer_observer.cc', + 'browser/plugin_installer_observer.h', + ], + }], [ 'use_openssl==1', { 'sources!': [ 'browser/importer/nss_decryptor.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index a4bfcfa..d00b630 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -303,6 +303,11 @@ '../remoting/remoting.gyp:remoting_client_plugin', ], }], + ['enable_plugin_installation', { + 'defines': [ + 'ENABLE_PLUGIN_INSTALLATION', + ], + }], ], 'export_dependent_settings': [ '../base/base.gyp:base', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 79d6392..62c73d4 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2385,6 +2385,11 @@ 'test/data/resource.rc', ], }], + ['enable_plugin_installation', { + 'sources!': [ + 'browser/plugin_finder_unittest.cc', + ], + }], ['toolkit_views==1', { 'dependencies': [ '../ui/views/views.gyp:views', diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 3c5410d..5bf4518 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -423,6 +423,7 @@ IPC_SYNC_MESSAGE_CONTROL4_3(ChromeViewHostMsg_GetPluginInfo, webkit::WebPluginInfo /* plugin */, std::string /* actual_mime_type */) +#if defined(ENABLE_PLUGIN_INSTALLATION) // Tells the browser to search for a plug-in that can handle the given MIME // type. The result will be sent asynchronously to the routing ID // |placeholder_id|. @@ -445,6 +446,7 @@ IPC_MESSAGE_ROUTED0(ChromeViewMsg_StartedDownloadingPlugin) // Notifies a missing plug-in placeholder that we have finished downloading // the plug-in. IPC_MESSAGE_ROUTED0(ChromeViewMsg_FinishedDownloadingPlugin) +#endif // defined(ENABLE_PLUGIN_INSTALLATION) // Specifies the URL as the first parameter (a wstring) and thumbnail as // binary data as the second parameter. diff --git a/chrome/renderer/plugins/missing_plugin.cc b/chrome/renderer/plugins/missing_plugin.cc index 2484944..714d849 100644 --- a/chrome/renderer/plugins/missing_plugin.cc +++ b/chrome/renderer/plugins/missing_plugin.cc @@ -73,16 +73,22 @@ MissingPlugin::MissingPlugin(RenderView* render_view, WebFrame* frame, const WebPluginParams& params, const std::string& html_data) - : PluginPlaceholder(render_view, frame, params, html_data), - placeholder_routing_id_(RenderThread::Get()->GenerateRoutingID()) { + : PluginPlaceholder(render_view, frame, params, html_data) { RenderThread::Get()->AddObserver(this); +#if defined(ENABLE_PLUGIN_INSTALLATION) + placeholder_routing_id_ = RenderThread::Get()->GenerateRoutingID(); RenderThread::Get()->AddRoute(placeholder_routing_id_, this); RenderThread::Get()->Send(new ChromeViewHostMsg_FindMissingPlugin( routing_id(), placeholder_routing_id_, params.mimeType.utf8())); +#else + OnDidNotFindMissingPlugin(); +#endif } MissingPlugin::~MissingPlugin() { +#if defined(ENABLE_PLUGIN_INSTALLATION) RenderThread::Get()->RemoveRoute(placeholder_routing_id_); +#endif RenderThread::Get()->RemoveObserver(this); } @@ -129,6 +135,7 @@ void MissingPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) { g_last_active_menu = this; } +#if defined(ENABLE_PLUGIN_INSTALLATION) bool MissingPlugin::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(MissingPlugin, message) @@ -145,15 +152,17 @@ bool MissingPlugin::OnMessageReceived(const IPC::Message& message) { return handled; } - -void MissingPlugin::OnFoundMissingPlugin(const string16& plugin_name) { - SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_FOUND, plugin_name)); -} +#endif // defined(ENABLE_PLUGIN_INSTALLATION) void MissingPlugin::OnDidNotFindMissingPlugin() { SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_FOUND)); } +#if defined(ENABLE_PLUGIN_INSTALLATION) +void MissingPlugin::OnFoundMissingPlugin(const string16& plugin_name) { + SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_FOUND, plugin_name)); +} + void MissingPlugin::OnStartedDownloadingPlugin() { SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_DOWNLOADING)); } @@ -161,6 +170,7 @@ void MissingPlugin::OnStartedDownloadingPlugin() { void MissingPlugin::OnFinishedDownloadingPlugin() { SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_INSTALLING)); } +#endif // defined(ENABLE_PLUGIN_INSTALLATION) void MissingPlugin::PluginListChanged() { ChromeViewHostMsg_GetPluginInfo_Status status; diff --git a/chrome/renderer/plugins/missing_plugin.h b/chrome/renderer/plugins/missing_plugin.h index 93ee8be..2d7c1f5 100644 --- a/chrome/renderer/plugins/missing_plugin.h +++ b/chrome/renderer/plugins/missing_plugin.h @@ -29,8 +29,10 @@ class MissingPlugin : public PluginPlaceholder, virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; virtual void DidFinishLoading() OVERRIDE; +#if defined(ENABLE_PLUGIN_INSTALLATION) // IPC::Channel::Listener methods: virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; +#endif // content::RenderViewObserver methods: virtual void ContextMenuAction(unsigned id) OVERRIDE; @@ -47,17 +49,21 @@ class MissingPlugin : public PluginPlaceholder, void HideCallback(const CppArgumentList& args, CppVariant* result); - void OnFoundMissingPlugin(const string16& plugin_name); void OnDidNotFindMissingPlugin(); +#if defined(ENABLE_PLUGIN_INSTALLATION) + void OnFoundMissingPlugin(const string16& plugin_name); void OnStartedDownloadingPlugin(); void OnFinishedDownloadingPlugin(); +#endif void SetMessage(const string16& message); void UpdateMessage(); +#if defined(ENABLE_PLUGIN_INSTALLATION) // |routing_id()| is the routing ID of our associated RenderView, but we have // a separate routing ID for messages specific to this placeholder. int32 placeholder_routing_id_; +#endif string16 message_; |