diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-21 04:29:20 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-21 04:29:20 +0000 |
commit | d7bd3e5a343acc7a5a51dd51d44f19e3abbfd41a (patch) | |
tree | 58b9de096179d94ab1fa05470340709e76cfdf49 /content | |
parent | ec7293192cc51edb8a89f084a165d384f5f82ab9 (diff) | |
download | chromium_src-d7bd3e5a343acc7a5a51dd51d44f19e3abbfd41a.zip chromium_src-d7bd3e5a343acc7a5a51dd51d44f19e3abbfd41a.tar.gz chromium_src-d7bd3e5a343acc7a5a51dd51d44f19e3abbfd41a.tar.bz2 |
Move webplugininfo.h to content/public.
BUG=237249
TBR=scottmg
Review URL: https://codereview.chromium.org/19894003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
54 files changed, 440 insertions, 243 deletions
diff --git a/content/browser/loader/buffered_resource_handler.cc b/content/browser/loader/buffered_resource_handler.cc index c31fd80..a3afb3f 100644 --- a/content/browser/loader/buffered_resource_handler.cc +++ b/content/browser/loader/buffered_resource_handler.cc @@ -23,13 +23,13 @@ #include "content/public/browser/resource_context.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" #include "content/public/common/resource_response.h" +#include "content/public/common/webplugininfo.h" #include "net/base/io_buffer.h" #include "net/base/mime_sniffer.h" #include "net/base/mime_util.h" #include "net/base/net_errors.h" #include "net/http/http_content_disposition.h" #include "net/http/http_response_headers.h" -#include "webkit/plugins/webplugininfo.h" namespace content { @@ -439,7 +439,7 @@ bool BufferedResourceHandler::HasSupportingPlugin(bool* stale) { ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request_); bool allow_wildcard = false; - webkit::WebPluginInfo plugin; + WebPluginInfo plugin; return PluginServiceImpl::GetInstance()->GetPluginInfo( info->GetChildID(), info->GetRouteID(), info->GetContext(), request_->url(), GURL(), response_->head.mime_type, allow_wildcard, @@ -461,7 +461,7 @@ bool BufferedResourceHandler::CopyReadBufferToNextHandler(int request_id) { } void BufferedResourceHandler::OnPluginsLoaded( - const std::vector<webkit::WebPluginInfo>& plugins) { + const std::vector<WebPluginInfo>& plugins) { bool defer = false; if (!ProcessResponse(&defer)) { controller()->Cancel(); diff --git a/content/browser/loader/buffered_resource_handler.h b/content/browser/loader/buffered_resource_handler.h index ee70a3d..c1a7a6e 100644 --- a/content/browser/loader/buffered_resource_handler.h +++ b/content/browser/loader/buffered_resource_handler.h @@ -16,12 +16,9 @@ namespace net { class URLRequest; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { class ResourceDispatcherHostImpl; +struct WebPluginInfo; // Used to buffer a request until enough data has been received. class BufferedResourceHandler @@ -72,7 +69,7 @@ class BufferedResourceHandler bool CopyReadBufferToNextHandler(int request_id); // Called on the IO thread once the list of plugins has been loaded. - void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins); + void OnPluginsLoaded(const std::vector<WebPluginInfo>& plugins); enum State { STATE_STARTING, diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc index 45b799b..d711f80 100644 --- a/content/browser/plugin_data_remover_impl.cc +++ b/content/browser/plugin_data_remover_impl.cc @@ -41,16 +41,16 @@ PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { // static void PluginDataRemover::GetSupportedPlugins( - std::vector<webkit::WebPluginInfo>* supported_plugins) { + std::vector<WebPluginInfo>* supported_plugins) { bool allow_wildcard = false; - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; PluginService::GetInstance()->GetPluginInfoArray( GURL(), kFlashPluginSwfMimeType, allow_wildcard, &plugins, NULL); Version min_version(kMinFlashVersion); - for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); + for (std::vector<WebPluginInfo>::iterator it = plugins.begin(); it != plugins.end(); ++it) { Version version; - webkit::WebPluginInfo::CreateVersionFromString(it->version, &version); + WebPluginInfo::CreateVersionFromString(it->version, &version); if (version.IsValid() && min_version.CompareTo(version) == -1) supported_plugins->push_back(*it); } @@ -88,7 +88,7 @@ class PluginDataRemoverImpl::Context PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance(); // Get the plugin file path. - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; plugin_service->GetPluginInfoArray( GURL(), mime_type, false, &plugins, NULL); base::FilePath plugin_path; @@ -135,7 +135,7 @@ class PluginDataRemoverImpl::Context return resource_context_; } - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE {} + virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE {} virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE {} diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index 7aa2b89..e6bc3ea 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -116,7 +116,7 @@ void PluginLoaderPosix::LoadPluginsInternal() { } void PluginLoaderPosix::OnPluginLoaded(uint32 index, - const webkit::WebPluginInfo& plugin) { + const WebPluginInfo& plugin) { if (index != next_load_index_) { LOG(ERROR) << "Received unexpected plugin load message for " << plugin.path.value() << "; index=" << index; @@ -147,8 +147,7 @@ void PluginLoaderPosix::OnPluginLoadFailed(uint32 index, bool PluginLoaderPosix::MaybeAddInternalPlugin( const base::FilePath& plugin_path) { - for (std::vector<webkit::WebPluginInfo>::iterator it = - internal_plugins_.begin(); + for (std::vector<WebPluginInfo>::iterator it = internal_plugins_.begin(); it != internal_plugins_.end(); ++it) { if (it->path == plugin_path) { diff --git a/content/browser/plugin_loader_posix.h b/content/browser/plugin_loader_posix.h index 12bec96..60cd5c6 100644 --- a/content/browser/plugin_loader_posix.h +++ b/content/browser/plugin_loader_posix.h @@ -14,8 +14,8 @@ #include "base/time/time.h" #include "content/browser/plugin_service_impl.h" #include "content/public/browser/utility_process_host_client.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_sender.h" -#include "webkit/plugins/webplugininfo.h" namespace base { class MessageLoopProxy; @@ -82,7 +82,7 @@ class CONTENT_EXPORT PluginLoaderPosix virtual void LoadPluginsInternal(); // Message handlers. - void OnPluginLoaded(uint32 index, const webkit::WebPluginInfo& plugin); + void OnPluginLoaded(uint32 index, const WebPluginInfo& plugin); void OnPluginLoadFailed(uint32 index, const base::FilePath& plugin_path); // Checks if the plugin path is an internal plugin, and, if it is, adds it to @@ -106,10 +106,10 @@ class CONTENT_EXPORT PluginLoaderPosix size_t next_load_index_; // Internal plugins that have been registered at the time of loading. - std::vector<webkit::WebPluginInfo> internal_plugins_; + std::vector<WebPluginInfo> internal_plugins_; // A vector of plugins that have been loaded successfully. - std::vector<webkit::WebPluginInfo> loaded_plugins_; + std::vector<WebPluginInfo> loaded_plugins_; // The callback and message loop on which the callback will be run when the // plugin loading process has been completed. diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index 6defebb..8f90723 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc @@ -13,7 +13,6 @@ #include "content/browser/browser_thread_impl.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/plugins/webplugininfo.h" namespace content { @@ -33,11 +32,11 @@ class MockPluginLoaderPosix : public PluginLoaderPosix { return next_load_index_; } - const std::vector<webkit::WebPluginInfo>& loaded_plugins() { + const std::vector<WebPluginInfo>& loaded_plugins() { return loaded_plugins_; } - std::vector<webkit::WebPluginInfo>* internal_plugins() { + std::vector<WebPluginInfo>* internal_plugins() { return &internal_plugins_; } @@ -45,7 +44,7 @@ class MockPluginLoaderPosix : public PluginLoaderPosix { PluginLoaderPosix::LoadPluginsInternal(); } - void TestOnPluginLoaded(uint32 index, const webkit::WebPluginInfo& plugin) { + void TestOnPluginLoaded(uint32 index, const WebPluginInfo& plugin) { OnPluginLoaded(index, plugin); } @@ -57,7 +56,7 @@ class MockPluginLoaderPosix : public PluginLoaderPosix { virtual ~MockPluginLoaderPosix() {} }; -void VerifyCallback(int* run_count, const std::vector<webkit::WebPluginInfo>&) { +void VerifyCallback(int* run_count, const std::vector<WebPluginInfo>&) { ++(*run_count); } @@ -90,9 +89,9 @@ class PluginLoaderPosixTest : public testing::Test { } // Data used for testing. - webkit::WebPluginInfo plugin1_; - webkit::WebPluginInfo plugin2_; - webkit::WebPluginInfo plugin3_; + WebPluginInfo plugin1_; + WebPluginInfo plugin2_; + WebPluginInfo plugin3_; private: base::ShadowingAtExitManager at_exit_manager_; // Destroys PluginService. @@ -152,8 +151,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { EXPECT_EQ(0u, plugin_loader()->next_load_index()); - const std::vector<webkit::WebPluginInfo>& plugins( - plugin_loader()->loaded_plugins()); + const std::vector<WebPluginInfo>& plugins(plugin_loader()->loaded_plugins()); plugin_loader()->TestOnPluginLoaded(0, plugin1_); EXPECT_EQ(1u, plugin_loader()->next_load_index()); @@ -193,8 +191,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { EXPECT_EQ(0u, plugin_loader()->next_load_index()); - const std::vector<webkit::WebPluginInfo>& plugins( - plugin_loader()->loaded_plugins()); + const std::vector<WebPluginInfo>& plugins(plugin_loader()->loaded_plugins()); plugin_loader()->TestOnPluginLoaded(0, plugin1_); EXPECT_EQ(1u, plugin_loader()->next_load_index()); @@ -236,8 +233,7 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { EXPECT_EQ(0u, plugin_loader()->next_load_index()); - const std::vector<webkit::WebPluginInfo>& plugins( - plugin_loader()->loaded_plugins()); + const std::vector<WebPluginInfo>& plugins(plugin_loader()->loaded_plugins()); plugin_loader()->TestOnPluginLoadFailed(0, plugin1_.path); EXPECT_EQ(1u, plugin_loader()->next_load_index()); @@ -275,8 +271,7 @@ TEST_F(PluginLoaderPosixTest, CrashedProcess) { EXPECT_EQ(0u, plugin_loader()->next_load_index()); - const std::vector<webkit::WebPluginInfo>& plugins( - plugin_loader()->loaded_plugins()); + const std::vector<WebPluginInfo>& plugins(plugin_loader()->loaded_plugins()); plugin_loader()->TestOnPluginLoaded(0, plugin1_); EXPECT_EQ(1u, plugin_loader()->next_load_index()); @@ -313,8 +308,7 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { EXPECT_EQ(0u, plugin_loader()->next_load_index()); - const std::vector<webkit::WebPluginInfo>& plugins( - plugin_loader()->loaded_plugins()); + const std::vector<WebPluginInfo>& plugins(plugin_loader()->loaded_plugins()); plugin_loader()->TestOnPluginLoaded(0, plugin1_); EXPECT_EQ(1u, plugin_loader()->next_load_index()); diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index fcde1ff..bffd16e 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -145,7 +145,7 @@ bool PluginProcessHost::Send(IPC::Message* message) { return process_->Send(message); } -bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { +bool PluginProcessHost::Init(const WebPluginInfo& info) { info_ = info; process_->SetName(info_.name); diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index 63696ef..61ce44d 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h @@ -19,8 +19,8 @@ #include "content/public/browser/browser_child_process_host_delegate.h" #include "content/public/browser/browser_child_process_host_iterator.h" #include "content/public/common/process_type.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_channel_proxy.h" -#include "webkit/plugins/webplugininfo.h" #include "ui/gfx/native_widget_types.h" namespace gfx { @@ -54,7 +54,7 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHostDelegate, // Returns the resource context for the renderer requesting the channel. virtual ResourceContext* GetResourceContext() = 0; virtual bool OffTheRecord() = 0; - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; + virtual void SetPluginInfo(const WebPluginInfo& info) = 0; virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; virtual void OnSentPluginChannelRequest() = 0; // The client should delete itself when one of these methods is called. @@ -73,7 +73,7 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHostDelegate, // Initialize the new plugin process, returning true on success. This must // be called before the object can be used. - bool Init(const webkit::WebPluginInfo& info); + bool Init(const WebPluginInfo& info); // Force the plugin process to shutdown (cleanly). void ForceShutdown(); @@ -108,7 +108,7 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHostDelegate, void OnAppActivation(); #endif - const webkit::WebPluginInfo& info() const { return info_; } + const WebPluginInfo& info() const { return info_; } #if defined(OS_WIN) // Tracks plugin parent windows created on the browser UI thread. @@ -157,7 +157,7 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHostDelegate, std::list<Client*> sent_requests_; // Information about the plugin. - webkit::WebPluginInfo info_; + WebPluginInfo info_; #if defined(OS_WIN) // Tracks plugin parent windows created on the UI thread. diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 5ebfe20..64efebc 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -28,8 +28,8 @@ #include "content/public/browser/resource_context.h" #include "content/public/common/content_switches.h" #include "content/public/common/process_type.h" +#include "content/public/common/webplugininfo.h" #include "webkit/plugins/plugin_constants.h" -#include "webkit/plugins/webplugininfo.h" #if defined(OS_WIN) #include "content/common/plugin_constants_win.h" @@ -176,13 +176,13 @@ void PluginServiceImpl::Init() { // type we use with the plugin, so the renderer can instantiate it. const CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kSitePerProcess)) { - webkit::WebPluginInfo webview_plugin( + WebPluginInfo webview_plugin( ASCIIToUTF16("WebView Tag"), base::FilePath(), ASCIIToUTF16("1.2.3.4"), ASCIIToUTF16("Browser Plugin.")); - webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; - webkit::WebPluginMimeType webview_plugin_mime_type; + webview_plugin.type = WebPluginInfo::PLUGIN_TYPE_NPAPI; + WebPluginMimeType webview_plugin_mime_type; webview_plugin_mime_type.mime_type = "application/browser-plugin"; webview_plugin_mime_type.file_extensions.push_back("*"); webview_plugin.mime_types.push_back(webview_plugin_mime_type); @@ -302,7 +302,7 @@ PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess( if (plugin_host) return plugin_host; - webkit::WebPluginInfo info; + WebPluginInfo info; if (!GetPluginInfoByPath(plugin_path, &info)) { return NULL; } @@ -448,7 +448,7 @@ void PluginServiceImpl::ForwardGetAllowedPluginForOpenChannelToPlugin( const GURL& url, const std::string& mime_type, PluginProcessHost::Client* client, - const std::vector<webkit::WebPluginInfo>&) { + const std::vector<WebPluginInfo>&) { GetAllowedPluginForOpenChannelToPlugin(params.render_process_id, params.render_view_id, url, params.page_url, mime_type, client, params.resource_context); @@ -462,7 +462,7 @@ void PluginServiceImpl::GetAllowedPluginForOpenChannelToPlugin( const std::string& mime_type, PluginProcessHost::Client* client, ResourceContext* resource_context) { - webkit::WebPluginInfo info; + WebPluginInfo info; bool allow_wildcard = true; bool found = GetPluginInfo( render_process_id, render_view_id, resource_context, @@ -507,7 +507,7 @@ bool PluginServiceImpl::GetPluginInfoArray( const GURL& url, const std::string& mime_type, bool allow_wildcard, - std::vector<webkit::WebPluginInfo>* plugins, + std::vector<WebPluginInfo>* plugins, std::vector<std::string>* actual_mime_types) { bool use_stale = false; PluginList::Singleton()->GetPluginInfoArray( @@ -524,9 +524,9 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, const std::string& mime_type, bool allow_wildcard, bool* is_stale, - webkit::WebPluginInfo* info, + WebPluginInfo* info, std::string* actual_mime_type) { - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; std::vector<std::string> mime_types; bool stale = GetPluginInfoArray( url, mime_type, allow_wildcard, &plugins, &mime_types); @@ -550,11 +550,11 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, } bool PluginServiceImpl::GetPluginInfoByPath(const base::FilePath& plugin_path, - webkit::WebPluginInfo* info) { - std::vector<webkit::WebPluginInfo> plugins; + WebPluginInfo* info) { + std::vector<WebPluginInfo> plugins; PluginList::Singleton()->GetPluginsNoRefresh(&plugins); - for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); + for (std::vector<WebPluginInfo>::iterator it = plugins.begin(); it != plugins.end(); ++it) { if (it->path == plugin_path) { @@ -569,7 +569,7 @@ bool PluginServiceImpl::GetPluginInfoByPath(const base::FilePath& plugin_path, string16 PluginServiceImpl::GetPluginDisplayNameByPath( const base::FilePath& path) { string16 plugin_name = path.LossyDisplayName(); - webkit::WebPluginInfo info; + WebPluginInfo info; if (PluginService::GetInstance()->GetPluginInfoByPath(path, &info) && !info.name.empty()) { plugin_name = info.name; @@ -600,7 +600,7 @@ void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { return; } #if defined(OS_POSIX) - std::vector<webkit::WebPluginInfo> cached_plugins; + std::vector<WebPluginInfo> cached_plugins; if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) { // Can't assume the caller is reentrant. target_loop->PostTask(FROM_HERE, @@ -625,7 +625,7 @@ void PluginServiceImpl::GetPluginsInternal( DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( plugin_list_token_)); - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; PluginList::Singleton()->GetPlugins(&plugins, NPAPIPluginsSupported()); target_loop->PostTask(FROM_HERE, @@ -674,7 +674,7 @@ PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( // can be obtained from the PluginList singleton and we can use it to // construct it and add it to the list. This same deal needs to be done // in the renderer side in PepperPluginRegistry. - webkit::WebPluginInfo webplugin_info; + WebPluginInfo webplugin_info; if (!GetPluginInfoByPath(plugin_path, &webplugin_info)) return NULL; PepperPluginInfo new_pepper_info; @@ -771,10 +771,10 @@ void PluginServiceImpl::AddExtraPluginDir(const base::FilePath& path) { } void PluginServiceImpl::RegisterInternalPlugin( - const webkit::WebPluginInfo& info, + const WebPluginInfo& info, bool add_at_beginning) { if (!NPAPIPluginsSupported() && - info.type == webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI) { + info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) { DLOG(INFO) << "Don't register NPAPI plugins when they're not supported"; return; } @@ -786,7 +786,7 @@ void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { } void PluginServiceImpl::GetInternalPlugins( - std::vector<webkit::WebPluginInfo>* plugins) { + std::vector<WebPluginInfo>* plugins) { PluginList::Singleton()->GetInternalPlugins(plugins); } diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h index d88f3eb..d71cacc 100644 --- a/content/browser/plugin_service_impl.h +++ b/content/browser/plugin_service_impl.h @@ -76,7 +76,7 @@ class CONTENT_EXPORT PluginServiceImpl const GURL& url, const std::string& mime_type, bool allow_wildcard, - std::vector<webkit::WebPluginInfo>* info, + std::vector<WebPluginInfo>* info, std::vector<std::string>* actual_mime_types) OVERRIDE; virtual bool GetPluginInfo(int render_process_id, int render_view_id, @@ -86,10 +86,10 @@ class CONTENT_EXPORT PluginServiceImpl const std::string& mime_type, bool allow_wildcard, bool* is_stale, - webkit::WebPluginInfo* info, + WebPluginInfo* info, std::string* actual_mime_type) OVERRIDE; virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, - webkit::WebPluginInfo* info) OVERRIDE; + WebPluginInfo* info) OVERRIDE; virtual string16 GetPluginDisplayNameByPath( const base::FilePath& path) OVERRIDE; virtual void GetPlugins(const GetPluginsCallback& callback) OVERRIDE; @@ -104,10 +104,10 @@ class CONTENT_EXPORT PluginServiceImpl virtual void RemoveExtraPluginPath(const base::FilePath& path) OVERRIDE; virtual void AddExtraPluginDir(const base::FilePath& path) OVERRIDE; virtual void RegisterInternalPlugin( - const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE; + const WebPluginInfo& info, bool add_at_beginning) OVERRIDE; virtual void UnregisterInternalPlugin(const base::FilePath& path) OVERRIDE; virtual void GetInternalPlugins( - std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE; + std::vector<WebPluginInfo>* plugins) OVERRIDE; virtual bool NPAPIPluginsSupported() OVERRIDE; virtual void DisablePluginsDiscoveryForTesting() OVERRIDE; #if defined(OS_MACOSX) @@ -191,7 +191,7 @@ class CONTENT_EXPORT PluginServiceImpl const GURL& url, const std::string& mime_type, PluginProcessHost::Client* client, - const std::vector<webkit::WebPluginInfo>&); + const std::vector<WebPluginInfo>&); // Helper so we can do the plugin lookup on the FILE thread. void GetAllowedPluginForOpenChannelToPlugin( int render_process_id, diff --git a/content/browser/plugin_service_impl_browsertest.cc b/content/browser/plugin_service_impl_browsertest.cc index 0f61e2f..1abf725 100644 --- a/content/browser/plugin_service_impl_browsertest.cc +++ b/content/browser/plugin_service_impl_browsertest.cc @@ -64,7 +64,7 @@ class MockPluginProcessHostClient : public PluginProcessHost::Client, ASSERT_TRUE(channel_->Connect()); } - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { + virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE { ASSERT_TRUE(info.mime_types.size()); ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); set_plugin_info_called_ = true; @@ -125,7 +125,7 @@ class MockPluginServiceFilter : public content::PluginServiceFilter { const void* context, const GURL& url, const GURL& policy_url, - webkit::WebPluginInfo* plugin) OVERRIDE { return true; } + WebPluginInfo* plugin) OVERRIDE { return true; } virtual bool CanLoadPlugin( int render_process_id, @@ -201,7 +201,7 @@ class MockCanceledPluginServiceClient : public PluginProcessHost::Client { MOCK_METHOD1(OnFoundPluginProcessHost, void(PluginProcessHost* host)); MOCK_METHOD0(OnSentPluginChannelRequest, void()); MOCK_METHOD1(OnChannelOpened, void(const IPC::ChannelHandle& handle)); - MOCK_METHOD1(SetPluginInfo, void(const webkit::WebPluginInfo& info)); + MOCK_METHOD1(SetPluginInfo, void(const WebPluginInfo& info)); MOCK_METHOD0(OnError, void()); bool get_resource_context_called() const { @@ -257,7 +257,7 @@ class MockCanceledBeforeSentPluginProcessHostClient virtual ~MockCanceledBeforeSentPluginProcessHostClient() {} // Client implementation. - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { + virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ASSERT_TRUE(info.mime_types.size()); ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index c8882c9..5f71dac 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -46,6 +46,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/context_menu_params.h" #include "content/public/common/url_constants.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_platform_file.h" #include "media/audio/audio_manager.h" @@ -64,7 +65,6 @@ #include "third_party/WebKit/public/web/WebNotificationPresenter.h" #include "ui/gfx/color_profile.h" #include "webkit/plugins/plugin_constants.h" -#include "webkit/plugins/webplugininfo.h" #if defined(OS_MACOSX) #include "content/common/mac/font_descriptor.h" @@ -242,7 +242,7 @@ class RenderMessageFilter::OpenChannelToNpapiPluginCallback return false; } - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { + virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE { info_ = info; } @@ -284,7 +284,7 @@ class RenderMessageFilter::OpenChannelToNpapiPluginCallback } ResourceContext* context_; - webkit::WebPluginInfo info_; + WebPluginInfo info_; PluginProcessHost* host_; bool sent_plugin_channel_request_; }; @@ -667,16 +667,16 @@ void RenderMessageFilter::OnGetPlugins( void RenderMessageFilter::GetPluginsCallback( IPC::Message* reply_msg, - const std::vector<webkit::WebPluginInfo>& all_plugins) { + const std::vector<WebPluginInfo>& all_plugins) { // Filter the plugin list. PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; int child_process_id = -1; int routing_id = MSG_ROUTING_NONE; for (size_t i = 0; i < all_plugins.size(); ++i) { // Copy because the filter can mutate. - webkit::WebPluginInfo plugin(all_plugins[i]); + WebPluginInfo plugin(all_plugins[i]); if (!filter || filter->IsPluginAvailable(child_process_id, routing_id, resource_context_, @@ -697,7 +697,7 @@ void RenderMessageFilter::OnGetPluginInfo( const GURL& page_url, const std::string& mime_type, bool* found, - webkit::WebPluginInfo* info, + WebPluginInfo* info, std::string* actual_mime_type) { bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index f94ae0f..f726244 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -64,10 +64,6 @@ class URLRequestContext; class URLRequestContextGetter; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { class BrowserContext; class DOMStorageContextImpl; @@ -77,6 +73,7 @@ class RenderWidgetHelper; class ResourceContext; class ResourceDispatcherHostImpl; struct Referrer; +struct WebPluginInfo; // This class filters out incoming IPC messages for the renderer process on the // IPC thread. @@ -162,13 +159,13 @@ class RenderMessageFilter : public BrowserMessageFilter { void OnGetPlugins(bool refresh, IPC::Message* reply_msg); void GetPluginsCallback(IPC::Message* reply_msg, - const std::vector<webkit::WebPluginInfo>& plugins); + const std::vector<WebPluginInfo>& plugins); void OnGetPluginInfo(int routing_id, const GURL& url, const GURL& policy_url, const std::string& mime_type, bool* found, - webkit::WebPluginInfo* info, + WebPluginInfo* info, std::string* actual_mime_type); void OnOpenChannelToPlugin(int routing_id, const GURL& url, diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index c543301..d495db6 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -17,6 +17,7 @@ #include "content/child/npapi/plugin_lib.h" #include "content/child/npapi/plugin_stream_url.h" #include "content/child/npapi/webplugin_delegate.h" +#include "content/public/common/webplugininfo.h" #include "net/base/net_util.h" #include "third_party/WebKit/public/web/WebBindings.h" #include "third_party/WebKit/public/web/WebKit.h" @@ -25,7 +26,6 @@ #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" #include "webkit/common/user_agent/user_agent.h" -#include "webkit/plugins/webplugininfo.h" #if defined(OS_MACOSX) #include "base/mac/mac_util.h" diff --git a/content/child/npapi/plugin_lib.cc b/content/child/npapi/plugin_lib.cc index 13d743b..aa16b08 100644 --- a/content/child/npapi/plugin_lib.cc +++ b/content/child/npapi/plugin_lib.cc @@ -33,7 +33,7 @@ PluginLib* PluginLib::CreatePluginLib(const base::FilePath& filename) { return (*g_loaded_libs)[i].get(); } - webkit::WebPluginInfo info; + WebPluginInfo info; if (!PluginList::Singleton()->ReadPluginInfo(filename, &info)) return NULL; @@ -63,7 +63,7 @@ void PluginLib::ShutdownAllPlugins() { } } -PluginLib::PluginLib(const webkit::WebPluginInfo& info) +PluginLib::PluginLib(const WebPluginInfo& info) : web_plugin_info_(info), library_(NULL), initialized_(false), diff --git a/content/child/npapi/plugin_lib.h b/content/child/npapi/plugin_lib.h index 9d71353..382e281 100644 --- a/content/child/npapi/plugin_lib.h +++ b/content/child/npapi/plugin_lib.h @@ -14,8 +14,8 @@ #include "build/build_config.h" #include "content/child/npapi/webplugin.h" #include "content/common/content_export.h" +#include "content/public/common/webplugininfo.h" #include "third_party/npapi/bindings/nphostapi.h" -#include "webkit/plugins/webplugininfo.h" namespace base { class FilePath; @@ -60,7 +60,7 @@ class CONTENT_EXPORT PluginLib : public base::RefCounted<PluginLib> { // Gets information about this plugin and the mime types that it // supports. - const webkit::WebPluginInfo& plugin_info() { return web_plugin_info_; } + const WebPluginInfo& plugin_info() { return web_plugin_info_; } // // NPAPI functions @@ -96,7 +96,7 @@ class CONTENT_EXPORT PluginLib : public base::RefCounted<PluginLib> { friend class base::RefCounted<PluginLib>; // Creates a new PluginLib. - explicit PluginLib(const webkit::WebPluginInfo& info); + explicit PluginLib(const WebPluginInfo& info); virtual ~PluginLib(); @@ -111,7 +111,7 @@ class CONTENT_EXPORT PluginLib : public base::RefCounted<PluginLib> { void Shutdown(); private: - webkit::WebPluginInfo web_plugin_info_; // Supported mime types, description + WebPluginInfo web_plugin_info_; // Supported mime types, description base::NativeLibrary library_; // The opened library reference. NPPluginFuncs plugin_funcs_; // The struct of plugin side functions. bool initialized_; // Is the plugin initialized? diff --git a/content/child/npapi/plugin_lib_unittest.cc b/content/child/npapi/plugin_lib_unittest.cc index 2193b8d..0438ead 100644 --- a/content/child/npapi/plugin_lib_unittest.cc +++ b/content/child/npapi/plugin_lib_unittest.cc @@ -16,7 +16,7 @@ namespace content { // variable, we can get a crash if no plugin libs were marked as always loaded. class PluginLibTest : public PluginLib { public: - PluginLibTest() : PluginLib(webkit::WebPluginInfo()) {} + PluginLibTest() : PluginLib(WebPluginInfo()) {} using PluginLib::Unload; protected: diff --git a/content/child/npapi/webplugin_delegate_impl_mac.mm b/content/child/npapi/webplugin_delegate_impl_mac.mm index 31b5966..eceaeb0 100644 --- a/content/child/npapi/webplugin_delegate_impl_mac.mm +++ b/content/child/npapi/webplugin_delegate_impl_mac.mm @@ -31,7 +31,6 @@ using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; -using webkit::WebPluginInfo; // Important implementation notes: The Mac definition of NPAPI, particularly // the distinction between windowed and windowless modes, differs from the diff --git a/content/child/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc index d47d2fd..1ac124f 100644 --- a/content/child/npapi/webplugin_delegate_impl_win.cc +++ b/content/child/npapi/webplugin_delegate_impl_win.cc @@ -38,7 +38,6 @@ using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; -using webkit::WebPluginInfo; namespace content { @@ -188,8 +187,7 @@ std::wstring GetKeyPath(HKEY key) { int GetPluginMajorVersion(const WebPluginInfo& plugin_info) { Version plugin_version; - webkit::WebPluginInfo::CreateVersionFromString( - plugin_info.version, &plugin_version); + WebPluginInfo::CreateVersionFromString(plugin_info.version, &plugin_version); int major_version = 0; if (plugin_version.IsValid()) diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc index 21ae626..44bc6a0 100644 --- a/content/common/pepper_plugin_registry.cc +++ b/content/common/pepper_plugin_registry.cc @@ -13,8 +13,6 @@ #include "content/public/common/content_switches.h" #include "ppapi/shared_impl/ppapi_permissions.h" -using webkit::WebPluginInfo; - namespace content { namespace { @@ -66,9 +64,9 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { if (name_parts.size() > 3) plugin.version = name_parts[3]; for (size_t j = 1; j < parts.size(); ++j) { - webkit::WebPluginMimeType mime_type(parts[j], - std::string(), - plugin.description); + WebPluginMimeType mime_type(parts[j], + std::string(), + plugin.description); plugin.mime_types.push_back(mime_type); } @@ -85,7 +83,7 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { } // namespace -bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, +bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info, PepperPluginInfo* pepper_info) { if (!webplugin_info.is_pepper_plugin()) return false; @@ -94,7 +92,7 @@ bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS || webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; pepper_info->is_sandboxed = webplugin_info.type != - webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; + WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; pepper_info->path = base::FilePath(webplugin_info.path); pepper_info->name = UTF16ToASCII(webplugin_info.name); @@ -140,7 +138,7 @@ void PepperPluginRegistry::PreloadModules() { } const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin( - const webkit::WebPluginInfo& info) { + const WebPluginInfo& info) { for (size_t i = 0; i < plugin_list_.size(); ++i) { if (info.path == plugin_list_[i].path) return &plugin_list_[i]; diff --git a/content/common/pepper_plugin_registry.h b/content/common/pepper_plugin_registry.h index de9e8b2..b40f00b 100644 --- a/content/common/pepper_plugin_registry.h +++ b/content/common/pepper_plugin_registry.h @@ -16,7 +16,7 @@ namespace content { // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if // the operation is not possible, in particular the WebPluginInfo::type // must be one of the pepper types. -bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, +bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info, PepperPluginInfo* pepper_info); // This class holds references to all of the known pepper plugin modules. @@ -49,7 +49,7 @@ class PepperPluginRegistry // return value will be NULL if there is no such plugin. // // The returned pointer is owned by the PluginRegistry. - const PepperPluginInfo* GetInfoForPlugin(const webkit::WebPluginInfo& info); + const PepperPluginInfo* GetInfoForPlugin(const WebPluginInfo& info); // Returns an existing loaded module for the given path. It will search for // both preloaded in-process or currently active (non crashed) out-of-process diff --git a/content/common/plugin_list.cc b/content/common/plugin_list.cc index 13c1aa5..615ca26 100644 --- a/content/common/plugin_list.cc +++ b/content/common/plugin_list.cc @@ -21,9 +21,6 @@ #include "content/common/plugin_constants_win.h" #endif -using webkit::WebPluginInfo; -using webkit::WebPluginMimeType; - namespace content { namespace { @@ -100,7 +97,7 @@ void PluginList::AddExtraPluginDir(const base::FilePath& plugin_dir) { #endif } -void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info, +void PluginList::RegisterInternalPlugin(const WebPluginInfo& info, bool add_at_beginning) { base::AutoLock lock(lock_); @@ -126,11 +123,10 @@ void PluginList::UnregisterInternalPlugin(const base::FilePath& path) { } void PluginList::GetInternalPlugins( - std::vector<webkit::WebPluginInfo>* internal_plugins) { + std::vector<WebPluginInfo>* internal_plugins) { base::AutoLock lock(lock_); - for (std::vector<webkit::WebPluginInfo>::iterator it = - internal_plugins_.begin(); + for (std::vector<WebPluginInfo>::iterator it = internal_plugins_.begin(); it != internal_plugins_.end(); ++it) { internal_plugins->push_back(*it); @@ -138,7 +134,7 @@ void PluginList::GetInternalPlugins( } bool PluginList::ReadPluginInfo(const base::FilePath& filename, - webkit::WebPluginInfo* info) { + WebPluginInfo* info) { { base::AutoLock lock(lock_); for (size_t i = 0; i < internal_plugins_.size(); ++i) { @@ -157,7 +153,7 @@ bool PluginList::ParseMimeTypes( const std::string& mime_types_str, const std::string& file_extensions_str, const base::string16& mime_type_descriptions_str, - std::vector<webkit::WebPluginMimeType>* parsed_mime_types) { + std::vector<WebPluginMimeType>* parsed_mime_types) { std::vector<std::string> mime_types, file_extensions; std::vector<base::string16> descriptions; base::SplitString(mime_types_str, '|', &mime_types); @@ -210,7 +206,7 @@ void PluginList::LoadPlugins(bool include_npapi) { loading_state_ = LOADING_STATE_REFRESHING; } - std::vector<webkit::WebPluginInfo> new_plugins; + std::vector<WebPluginInfo> new_plugins; base::Closure will_load_callback; { base::AutoLock lock(lock_); @@ -240,7 +236,7 @@ void PluginList::LoadPlugins(bool include_npapi) { bool PluginList::LoadPluginIntoPluginList( const base::FilePath& path, - std::vector<webkit::WebPluginInfo>* plugins, + std::vector<WebPluginInfo>* plugins, WebPluginInfo* plugin_info) { LOG_IF(ERROR, PluginList::DebugPluginLoading()) << "Loading plugin " << path.value(); @@ -305,7 +301,7 @@ void PluginList::GetPluginPathsToLoad(std::vector<base::FilePath>* plugin_paths, } } -void PluginList::SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins) { +void PluginList::SetPlugins(const std::vector<WebPluginInfo>& plugins) { base::AutoLock lock(lock_); DCHECK_NE(LOADING_STATE_REFRESHING, loading_state_); @@ -327,8 +323,7 @@ void PluginList::GetPlugins(std::vector<WebPluginInfo>* plugins, plugins->insert(plugins->end(), plugins_list_.begin(), plugins_list_.end()); } -bool PluginList::GetPluginsNoRefresh( - std::vector<webkit::WebPluginInfo>* plugins) { +bool PluginList::GetPluginsNoRefresh(std::vector<WebPluginInfo>* plugins) { base::AutoLock lock(lock_); plugins->insert(plugins->end(), plugins_list_.begin(), plugins_list_.end()); @@ -341,7 +336,7 @@ void PluginList::GetPluginInfoArray( bool allow_wildcard, bool* use_stale, bool include_npapi, - std::vector<webkit::WebPluginInfo>* info, + std::vector<WebPluginInfo>* info, std::vector<std::string>* actual_mime_types) { DCHECK(mime_type == StringToLowerASCII(mime_type)); DCHECK(info); @@ -389,7 +384,7 @@ void PluginList::GetPluginInfoArray( } } -bool PluginList::SupportsType(const webkit::WebPluginInfo& plugin, +bool PluginList::SupportsType(const WebPluginInfo& plugin, const std::string& mime_type, bool allow_wildcard) { // Webkit will ask for a plugin to handle empty mime types. @@ -397,7 +392,7 @@ bool PluginList::SupportsType(const webkit::WebPluginInfo& plugin, return false; for (size_t i = 0; i < plugin.mime_types.size(); ++i) { - const webkit::WebPluginMimeType& mime_info = plugin.mime_types[i]; + const WebPluginMimeType& mime_info = plugin.mime_types[i]; if (net::MatchesMimeType(mime_info.mime_type, mime_type)) { if (!allow_wildcard && mime_info.mime_type == "*") continue; @@ -407,11 +402,11 @@ bool PluginList::SupportsType(const webkit::WebPluginInfo& plugin, return false; } -bool PluginList::SupportsExtension(const webkit::WebPluginInfo& plugin, +bool PluginList::SupportsExtension(const WebPluginInfo& plugin, const std::string& extension, std::string* actual_mime_type) { for (size_t i = 0; i < plugin.mime_types.size(); ++i) { - const webkit::WebPluginMimeType& mime_type = plugin.mime_types[i]; + const WebPluginMimeType& mime_type = plugin.mime_types[i]; for (size_t j = 0; j < mime_type.file_extensions.size(); ++j) { if (mime_type.file_extensions[j] == extension) { if (actual_mime_type) diff --git a/content/common/plugin_list.h b/content/common/plugin_list.h index 5599bc9..9a5ef86 100644 --- a/content/common/plugin_list.h +++ b/content/common/plugin_list.h @@ -18,7 +18,7 @@ #include "base/memory/scoped_vector.h" #include "base/synchronization/lock.h" #include "content/common/content_export.h" -#include "webkit/plugins/webplugininfo.h" +#include "content/public/common/webplugininfo.h" class GURL; @@ -44,7 +44,7 @@ class CONTENT_EXPORT PluginList { // Returns true if the plugin supports |mime_type|. |mime_type| should be all // lower case. - static bool SupportsType(const webkit::WebPluginInfo& plugin, + static bool SupportsType(const WebPluginInfo& plugin, const std::string& mime_type, bool allow_wildcard); @@ -72,7 +72,7 @@ class CONTENT_EXPORT PluginList { // be loaded using PluginList::LoadPlugin(). // If |add_at_beginning| is true the plugin will be added earlier in // the list so that it can override the MIME types of older registrations. - void RegisterInternalPlugin(const webkit::WebPluginInfo& info, + void RegisterInternalPlugin(const WebPluginInfo& info, bool add_at_beginning); // Removes a specified internal plugin from the list. The search will match @@ -80,13 +80,13 @@ class CONTENT_EXPORT PluginList { void UnregisterInternalPlugin(const base::FilePath& path); // Gets a list of all the registered internal plugins. - void GetInternalPlugins(std::vector<webkit::WebPluginInfo>* plugins); + void GetInternalPlugins(std::vector<WebPluginInfo>* plugins); // Creates a WebPluginInfo structure given a plugin's path. On success // returns true, with the information being put into "info". // Returns false if the library couldn't be found, or if it's not a plugin. bool ReadPluginInfo(const base::FilePath& filename, - webkit::WebPluginInfo* info); + WebPluginInfo* info); // In Windows plugins, the mime types are passed as a specially formatted list // of strings. This function parses those strings into a WebPluginMimeType @@ -96,16 +96,15 @@ class CONTENT_EXPORT PluginList { const std::string& mime_types, const std::string& file_extensions, const base::string16& mime_type_descriptions, - std::vector<webkit::WebPluginMimeType>* parsed_mime_types); + std::vector<WebPluginMimeType>* parsed_mime_types); // Get all the plugins synchronously, loading them if necessary. - void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins, + void GetPlugins(std::vector<WebPluginInfo>* plugins, bool include_npapi); // Copies the list of plug-ins into |plugins| without loading them. // Returns true if the list of plugins is up-to-date. - bool GetPluginsNoRefresh( - std::vector<webkit::WebPluginInfo>* plugins); + bool GetPluginsNoRefresh(std::vector<WebPluginInfo>* plugins); // Returns a list in |info| containing plugins that are found for // the given url and mime type (including disabled plugins, for @@ -124,14 +123,14 @@ class CONTENT_EXPORT PluginList { bool allow_wildcard, bool* use_stale, bool include_npapi, - std::vector<webkit::WebPluginInfo>* info, + std::vector<WebPluginInfo>* info, std::vector<std::string>* actual_mime_types); // Load a specific plugin with full path. Return true iff loading the plug-in // was successful. bool LoadPluginIntoPluginList(const base::FilePath& filename, - std::vector<webkit::WebPluginInfo>* plugins, - webkit::WebPluginInfo* plugin_info); + std::vector<WebPluginInfo>* plugins, + WebPluginInfo* plugin_info); // The following functions are used to support probing for WebPluginInfo // using a different instance of this class. @@ -141,7 +140,7 @@ class CONTENT_EXPORT PluginList { bool include_npapi); // Clears the internal list of Plugins and copies them from the vector. - void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); + void SetPlugins(const std::vector<WebPluginInfo>& plugins); void set_will_load_plugins_callback(const base::Closure& callback); @@ -151,18 +150,18 @@ class CONTENT_EXPORT PluginList { // returns true, with the information being put into "info". // Returns false if the library couldn't be found, or if it's not a plugin. static bool ReadWebPluginInfo(const base::FilePath& filename, - webkit::WebPluginInfo* info); + WebPluginInfo* info); #if defined(OS_POSIX) && !defined(OS_MACOSX) // Parse the result of an NP_GetMIMEDescription() call. // This API is only used on Unixes, and is exposed here for testing. static void ParseMIMEDescription(const std::string& description, - std::vector<webkit::WebPluginMimeType>* mime_types); + std::vector<WebPluginMimeType>* mime_types); // Extract a version number from a description string. // This API is only used on Unixes, and is exposed here for testing. static void ExtractVersionString(const std::string& version, - webkit::WebPluginInfo* info); + WebPluginInfo* info); #endif private: @@ -188,15 +187,14 @@ class CONTENT_EXPORT PluginList { // Returns true if we should load the given plugin, or false otherwise. // |plugins| is the list of plugins we have crawled in the current plugin // loading run. - bool ShouldLoadPluginUsingPluginList( - const webkit::WebPluginInfo& info, - std::vector<webkit::WebPluginInfo>* plugins); + bool ShouldLoadPluginUsingPluginList(const WebPluginInfo& info, + std::vector<WebPluginInfo>* plugins); // Returns true if the given plugin supports a given file extension. // |extension| should be all lower case. If |mime_type| is not NULL, it will // be set to the MIME type if found. The MIME type which corresponds to the // extension is optionally returned back. - bool SupportsExtension(const webkit::WebPluginInfo& plugin, + bool SupportsExtension(const WebPluginInfo& plugin, const std::string& extension, std::string* actual_mime_type); // @@ -225,10 +223,10 @@ class CONTENT_EXPORT PluginList { std::vector<base::FilePath> extra_plugin_dirs_; // Holds information about internal plugins. - std::vector<webkit::WebPluginInfo> internal_plugins_; + std::vector<WebPluginInfo> internal_plugins_; // A list holding all plug-ins. - std::vector<webkit::WebPluginInfo> plugins_list_; + std::vector<WebPluginInfo> plugins_list_; // Callback that is invoked whenever the PluginList will reload the plugins. base::Closure will_load_plugins_callback_; diff --git a/content/common/plugin_list_mac.mm b/content/common/plugin_list_mac.mm index 2048b6f..fc4813a 100644 --- a/content/common/plugin_list_mac.mm +++ b/content/common/plugin_list_mac.mm @@ -20,8 +20,6 @@ #include "base/strings/utf_string_conversions.h" using base::ScopedCFTypeRef; -using webkit::WebPluginInfo; -using webkit::WebPluginMimeType; namespace content { @@ -298,7 +296,7 @@ void PluginList::GetPluginsInDir( bool PluginList::ShouldLoadPluginUsingPluginList( const WebPluginInfo& info, - std::vector<webkit::WebPluginInfo>* plugins) { + std::vector<WebPluginInfo>* plugins) { return !IsBlacklistedPlugin(info); } diff --git a/content/common/plugin_list_posix.cc b/content/common/plugin_list_posix.cc index a8dd510..251fe39 100644 --- a/content/common/plugin_list_posix.cc +++ b/content/common/plugin_list_posix.cc @@ -35,9 +35,6 @@ // happy. #include "base/third_party/nspr/prcpucfg_linux.h" -using webkit::WebPluginInfo; -using webkit::WebPluginMimeType; - namespace content { namespace { @@ -564,7 +561,7 @@ void PluginList::GetPluginsInDir( } bool PluginList::ShouldLoadPluginUsingPluginList( - const WebPluginInfo& info, std::vector<webkit::WebPluginInfo>* plugins) { + const WebPluginInfo& info, std::vector<WebPluginInfo>* plugins) { LOG_IF(ERROR, PluginList::DebugPluginLoading()) << "Considering " << info.path.value() << " (" << info.name << ")"; diff --git a/content/common/plugin_list_unittest.cc b/content/common/plugin_list_unittest.cc index 4a1bd71..342200e 100644 --- a/content/common/plugin_list_unittest.cc +++ b/content/common/plugin_list_unittest.cc @@ -8,9 +8,6 @@ #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -using webkit::WebPluginInfo; -using webkit::WebPluginMimeType; - namespace content { namespace { diff --git a/content/common/plugin_list_win.cc b/content/common/plugin_list_win.cc index fe5e325..aa2e4e9 100644 --- a/content/common/plugin_list_win.cc +++ b/content/common/plugin_list_win.cc @@ -22,8 +22,7 @@ #include "base/win/windows_version.h" #include "content/common/plugin_constants_win.h" -using webkit::WebPluginInfo; - +namespace content { namespace { const char16 kRegistryApps[] = @@ -220,8 +219,8 @@ bool IsValid32BitImage(const base::FilePath& path) { // Returns true if the given plugins share at least one mime type. This is used // to differentiate newer versions of a plugin vs two plugins which happen to // have the same filename. -bool HaveSharedMimeType(const webkit::WebPluginInfo& plugin1, - const webkit::WebPluginInfo& plugin2) { +bool HaveSharedMimeType(const WebPluginInfo& plugin1, + const WebPluginInfo& plugin2) { for (size_t i = 0; i < plugin1.mime_types.size(); ++i) { for (size_t j = 0; j < plugin2.mime_types.size(); ++j) { if (plugin1.mime_types[i].mime_type == plugin2.mime_types[j].mime_type) @@ -259,10 +258,8 @@ bool IsNewerVersion(const base::string16& a, const base::string16& b) { } // namespace -namespace content { - bool PluginList::ReadWebPluginInfo(const base::FilePath& filename, - webkit::WebPluginInfo* info) { + WebPluginInfo* info) { // On windows, the way we get the mime types for the library is // to check the version information in the DLL itself. This // will be a string of the format: <type1>|<type2>|<type3>|... @@ -373,8 +370,8 @@ void PluginList::GetPluginPathsFromRegistry( } bool PluginList::ShouldLoadPluginUsingPluginList( - const webkit::WebPluginInfo& info, - std::vector<webkit::WebPluginInfo>* plugins) { + const WebPluginInfo& info, + std::vector<WebPluginInfo>* plugins) { // Version check for (size_t j = 0; j < plugins->size(); ++j) { base::FilePath::StringType plugin1 = diff --git a/content/common/utility_messages.h b/content/common/utility_messages.h index 01aaa7c..1e5c68b 100644 --- a/content/common/utility_messages.h +++ b/content/common/utility_messages.h @@ -10,8 +10,8 @@ #include "base/basictypes.h" #include "content/common/content_export.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_message_macros.h" -#include "webkit/plugins/webplugininfo.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT @@ -48,5 +48,5 @@ IPC_SYNC_MESSAGE_CONTROL2_0(UtilityHostMsg_LoadPluginFailed, // Notifies the browser that a plugin in the vector sent by it has been loaded. IPC_SYNC_MESSAGE_CONTROL2_0(UtilityHostMsg_LoadedPlugin, uint32_t /* index in the vector */, - webkit::WebPluginInfo /* plugin info */) + content::WebPluginInfo /* plugin info */) #endif // OS_POSIX diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 4fbf80c..96437be 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1679,7 +1679,7 @@ IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CookiesEnabled, // Used to get the list of plugins IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetPlugins, bool /* refresh*/, - std::vector<webkit::WebPluginInfo> /* plugins */) + std::vector<content::WebPluginInfo> /* plugins */) // Return information about a plugin for the given URL and MIME // type. If there is no matching plugin, |found| is false. @@ -1691,7 +1691,7 @@ IPC_SYNC_MESSAGE_CONTROL4_3(ViewHostMsg_GetPluginInfo, GURL /* page_url */, std::string /* mime_type */, bool /* found */, - webkit::WebPluginInfo /* plugin info */, + content::WebPluginInfo /* plugin info */, std::string /* actual_mime_type */) // A renderer sends this to the browser process when it wants to @@ -1704,7 +1704,7 @@ IPC_SYNC_MESSAGE_CONTROL4_2(ViewHostMsg_OpenChannelToPlugin, GURL /* page_url */, std::string /* mime_type */, IPC::ChannelHandle /* channel_handle */, - webkit::WebPluginInfo /* info */) + content::WebPluginInfo /* info */) #if defined(OS_WIN) IPC_MESSAGE_ROUTED1(ViewHostMsg_WindowlessPluginDummyWindowCreated, diff --git a/content/common/webplugininfo_unittest.cc b/content/common/webplugininfo_unittest.cc new file mode 100644 index 0000000..fdf669d --- /dev/null +++ b/content/common/webplugininfo_unittest.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2012 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 "content/public/common/webplugininfo.h" + +#include <string> +#include <vector> + +#include "base/memory/scoped_ptr.h" +#include "base/strings/utf_string_conversions.h" +#include "base/version.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +TEST(PluginUtilsTest, VersionExtraction) { + // Some real-world plugin versions (spaces, commata, parentheses, 'r', oh my) + const char* versions[][2] = { + { "7.6.6 (1671)", "7.6.6.1671" }, // Quicktime + { "2, 0, 0, 254", "2.0.0.254" }, // DivX + { "3, 0, 0, 0", "3.0.0.0" }, // Picasa + { "1, 0, 0, 1", "1.0.0.1" }, // Earth + { "10,0,45,2", "10.0.45.2" }, // Flash + { "10.1 r102", "10.1.102"}, // Flash + { "10.3 d180", "10.3.180" }, // Flash (Debug) + { "11.5.7r609", "11.5.7.609"}, // Shockwave + { "1.6.0_22", "1.6.0.22"}, // Java + { "1.07.00_0005", "1.7.0.5"}, // Java with leading zeros + { "1..0", "1.0.0" } // Empty version component + }; + + for (size_t i = 0; i < arraysize(versions); i++) { + Version version; + WebPluginInfo::CreateVersionFromString( + ASCIIToUTF16(versions[i][0]), &version); + + ASSERT_TRUE(version.IsValid()); + EXPECT_EQ(versions[i][1], version.GetString()); + } +} + +} // namespace content diff --git a/content/content_common.gypi b/content/content_common.gypi index 7ffdc1c..50fbff2 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -99,6 +99,8 @@ 'public/common/url_fetcher.h', 'public/common/url_utils.cc', 'public/common/url_utils.h', + 'public/common/webplugininfo.cc', + 'public/common/webplugininfo.h', 'public/common/zygote_fork_delegate_linux.h', 'common/accessibility_messages.h', 'common/accessibility_notification.h', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 6c47463..92a88f7 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -405,6 +405,7 @@ 'common/sandbox_mac_system_access_unittest.mm', 'common/sandbox_mac_unittest_helper.h', 'common/sandbox_mac_unittest_helper.mm', + 'common/webplugininfo_unittest.cc', 'renderer/active_notification_tracker_unittest.cc', 'renderer/android/email_detector_unittest.cc', 'renderer/android/phone_number_detector_unittest.cc', @@ -541,7 +542,6 @@ '../webkit/plugins/ppapi/ppapi_unittest.h', '../webkit/plugins/ppapi/quota_file_io_unittest.cc', '../webkit/plugins/ppapi/v8_var_converter_unittest.cc', - '../webkit/plugins/webplugininfo_unittest.cc', '../webkit/browser/quota/mock_quota_manager.cc', '../webkit/browser/quota/mock_quota_manager.h', '../webkit/browser/quota/mock_quota_manager_unittest.cc', diff --git a/content/public/browser/plugin_data_remover.h b/content/public/browser/plugin_data_remover.h index 6c39e3d..02d3acd 100644 --- a/content/public/browser/plugin_data_remover.h +++ b/content/public/browser/plugin_data_remover.h @@ -14,11 +14,8 @@ namespace base { class WaitableEvent; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { +struct WebPluginInfo; class BrowserContext; @@ -33,7 +30,7 @@ class CONTENT_EXPORT PluginDataRemover { // Returns a list of all plug-ins that support removing LSO data. This method // will use cached plugin data. Call PluginService::GetPlugins() if the latest // data is needed. - static void GetSupportedPlugins(std::vector<webkit::WebPluginInfo>* plugins); + static void GetSupportedPlugins(std::vector<WebPluginInfo>* plugins); }; } // namespace content diff --git a/content/public/browser/plugin_service.h b/content/public/browser/plugin_service.h index 387752f..8c28948 100644 --- a/content/public/browser/plugin_service.h +++ b/content/public/browser/plugin_service.h @@ -18,10 +18,6 @@ namespace base { class FilePath; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { class BrowserContext; @@ -29,6 +25,7 @@ class PluginProcessHost; class PluginServiceFilter; class ResourceContext; struct PepperPluginInfo; +struct WebPluginInfo; // This must be created on the main thread but it's only called on the IO/file // thread. This is an asynchronous wrapper around the PluginList interface for @@ -36,7 +33,7 @@ struct PepperPluginInfo; // doing expensive disk operations on the IO/UI threads. class PluginService { public: - typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> + typedef base::Callback<void(const std::vector<WebPluginInfo>&)> GetPluginsCallback; // Returns the PluginService singleton. @@ -66,7 +63,7 @@ class PluginService { const GURL& url, const std::string& mime_type, bool allow_wildcard, - std::vector<webkit::WebPluginInfo>* info, + std::vector<WebPluginInfo>* info, std::vector<std::string>* actual_mime_types) = 0; // Gets plugin info for an individual plugin and filters the plugins using @@ -80,14 +77,14 @@ class PluginService { const std::string& mime_type, bool allow_wildcard, bool* is_stale, - webkit::WebPluginInfo* info, + WebPluginInfo* info, std::string* actual_mime_type) = 0; // Get plugin info by plugin path (including disabled plugins). Returns true // if the plugin is found and WebPluginInfo has been filled in |info|. This // will use cached data in the plugin list. virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, - webkit::WebPluginInfo* info) = 0; + WebPluginInfo* info) = 0; // Returns the display name for the plugin identified by the given path. If // the path doesn't identify a plugin, or the plugin has no display name, @@ -132,7 +129,7 @@ class PluginService { // be loaded using PluginList::LoadPlugin(). // If |add_at_beginning| is true the plugin will be added earlier in // the list so that it can override the MIME types of older registrations. - virtual void RegisterInternalPlugin(const webkit::WebPluginInfo& info, + virtual void RegisterInternalPlugin(const WebPluginInfo& info, bool add_at_beginning) = 0; // Removes a specified internal plugin from the list. The search will match @@ -140,8 +137,7 @@ class PluginService { virtual void UnregisterInternalPlugin(const base::FilePath& path) = 0; // Gets a list of all the registered internal plugins. - virtual void GetInternalPlugins( - std::vector<webkit::WebPluginInfo>* plugins) = 0; + virtual void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) = 0; // Returns true iff NPAPI plugins are supported on the current platform. // This can be called from any thread. diff --git a/content/public/browser/plugin_service_filter.h b/content/public/browser/plugin_service_filter.h index 5ec1961..8ff5503 100644 --- a/content/public/browser/plugin_service_filter.h +++ b/content/public/browser/plugin_service_filter.h @@ -11,11 +11,8 @@ namespace base { class FilePath; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { +struct WebPluginInfo; // Callback class to let the client filter the list of all installed plug-ins // and block them from being loaded. @@ -31,7 +28,7 @@ class PluginServiceFilter { const void* context, const GURL& url, const GURL& policy_url, - webkit::WebPluginInfo* plugin) = 0; + WebPluginInfo* plugin) = 0; // Whether the renderer has permission to load available |plugin|. virtual bool CanLoadPlugin(int render_process_id, diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index 3ac2bf1..e66daa7 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h @@ -13,6 +13,7 @@ #include "content/public/common/password_form.h" #include "content/public/common/security_style.h" #include "content/public/common/ssl_status.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_message_macros.h" #include "net/base/request_priority.h" #include "third_party/WebKit/public/platform/WebPoint.h" @@ -21,7 +22,6 @@ #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "ui/base/window_open_disposition.h" #include "webkit/common/webpreferences.h" -#include "webkit/plugins/webplugininfo.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT @@ -76,7 +76,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::SSLStatus) IPC_STRUCT_TRAITS_MEMBER(content_status) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::WebPluginMimeType) +IPC_STRUCT_TRAITS_BEGIN(content::WebPluginMimeType) IPC_STRUCT_TRAITS_MEMBER(mime_type) IPC_STRUCT_TRAITS_MEMBER(file_extensions) IPC_STRUCT_TRAITS_MEMBER(description) @@ -84,7 +84,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit::WebPluginMimeType) IPC_STRUCT_TRAITS_MEMBER(additional_param_values) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::WebPluginInfo) +IPC_STRUCT_TRAITS_BEGIN(content::WebPluginInfo) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(path) IPC_STRUCT_TRAITS_MEMBER(version) diff --git a/content/public/common/pepper_plugin_info.cc b/content/public/common/pepper_plugin_info.cc index 4b94731..f8e88b2 100644 --- a/content/public/common/pepper_plugin_info.cc +++ b/content/public/common/pepper_plugin_info.cc @@ -18,14 +18,14 @@ PepperPluginInfo::PepperPluginInfo() PepperPluginInfo::~PepperPluginInfo() { } -webkit::WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const { - webkit::WebPluginInfo info; +WebPluginInfo PepperPluginInfo::ToWebPluginInfo() const { + WebPluginInfo info; info.type = is_out_of_process ? (is_sandboxed ? - webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : - webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED) : - webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; + WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : + WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED) : + WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; info.name = name.empty() ? path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); diff --git a/content/public/common/pepper_plugin_info.h b/content/public/common/pepper_plugin_info.h index 87b4aa9..8106c6e 100644 --- a/content/public/common/pepper_plugin_info.h +++ b/content/public/common/pepper_plugin_info.h @@ -10,8 +10,8 @@ #include "base/files/file_path.h" #include "content/common/content_export.h" +#include "content/public/common/webplugininfo.h" #include "webkit/plugins/ppapi/plugin_module.h" -#include "webkit/plugins/webplugininfo.h" namespace content { @@ -19,7 +19,7 @@ struct CONTENT_EXPORT PepperPluginInfo { PepperPluginInfo(); ~PepperPluginInfo(); - webkit::WebPluginInfo ToWebPluginInfo() const; + WebPluginInfo ToWebPluginInfo() const; // Indicates internal plugins for which there's not actually a library. // These plugins are implemented in the Chrome binary using a separate set @@ -38,7 +38,7 @@ struct CONTENT_EXPORT PepperPluginInfo { std::string name; std::string description; std::string version; - std::vector<webkit::WebPluginMimeType> mime_types; + std::vector<WebPluginMimeType> mime_types; // When is_internal is set, this contains the function pointers to the // entry points for the internal plugins. diff --git a/content/public/common/webplugininfo.cc b/content/public/common/webplugininfo.cc new file mode 100644 index 0000000..fe2a02e --- /dev/null +++ b/content/public/common/webplugininfo.cc @@ -0,0 +1,103 @@ +// Copyright (c) 2011 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 "content/public/common/webplugininfo.h" + +#include <algorithm> + +#include "base/logging.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/version.h" + +namespace content { + +WebPluginMimeType::WebPluginMimeType() {} + +WebPluginMimeType::WebPluginMimeType(const std::string& m, + const std::string& f, + const std::string& d) + : mime_type(m), + file_extensions(), + description(ASCIIToUTF16(d)) { + file_extensions.push_back(f); +} + +WebPluginMimeType::~WebPluginMimeType() {} + +WebPluginInfo::WebPluginInfo() + : type(PLUGIN_TYPE_NPAPI), + pepper_permissions(0) { +} + +WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs) + : name(rhs.name), + path(rhs.path), + version(rhs.version), + desc(rhs.desc), + mime_types(rhs.mime_types), + type(rhs.type), + pepper_permissions(rhs.pepper_permissions) { +} + +WebPluginInfo::~WebPluginInfo() {} + +WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { + name = rhs.name; + path = rhs.path; + version = rhs.version; + desc = rhs.desc; + mime_types = rhs.mime_types; + type = rhs.type; + pepper_permissions = rhs.pepper_permissions; + return *this; +} + +WebPluginInfo::WebPluginInfo(const base::string16& fake_name, + const base::FilePath& fake_path, + const base::string16& fake_version, + const base::string16& fake_desc) + : name(fake_name), + path(fake_path), + version(fake_version), + desc(fake_desc), + mime_types(), + type(PLUGIN_TYPE_NPAPI), + pepper_permissions(0) { +} + +void WebPluginInfo::CreateVersionFromString( + const base::string16& version_string, + base::Version* parsed_version) { + // Remove spaces and ')' from the version string, + // Replace any instances of 'r', ',' or '(' with a dot. + std::string version = UTF16ToASCII(version_string); + RemoveChars(version, ") ", &version); + std::replace(version.begin(), version.end(), 'd', '.'); + std::replace(version.begin(), version.end(), 'r', '.'); + std::replace(version.begin(), version.end(), ',', '.'); + std::replace(version.begin(), version.end(), '(', '.'); + std::replace(version.begin(), version.end(), '_', '.'); + + // Remove leading zeros from each of the version components. + std::string no_leading_zeros_version; + std::vector<std::string> numbers; + base::SplitString(version, '.', &numbers); + for (size_t i = 0; i < numbers.size(); ++i) { + size_t n = numbers[i].size(); + size_t j = 0; + while (j < n && numbers[i][j] == '0') { + ++j; + } + no_leading_zeros_version += (j < n) ? numbers[i].substr(j) : "0"; + if (i != numbers.size() - 1) { + no_leading_zeros_version += "."; + } + } + + *parsed_version = Version(no_leading_zeros_version); +} + +} // namespace content diff --git a/content/public/common/webplugininfo.h b/content/public/common/webplugininfo.h new file mode 100644 index 0000000..75b4033 --- /dev/null +++ b/content/public/common/webplugininfo.h @@ -0,0 +1,99 @@ +// Copyright (c) 2011 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 CONTENT_PUBLIC_COMMON_WEBPLUGININFO_H_ +#define CONTENT_PUBLIC_COMMON_WEBPLUGININFO_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "base/files/file_path.h" +#include "content/common/content_export.h" + +namespace base { +class Version; +} + +namespace content { + +struct CONTENT_EXPORT WebPluginMimeType { + WebPluginMimeType(); + // A constructor for the common case of a single file extension and an ASCII + // description. + WebPluginMimeType(const std::string& m, + const std::string& f, + const std::string& d); + ~WebPluginMimeType(); + + // The name of the mime type (e.g., "application/x-shockwave-flash"). + std::string mime_type; + + // A list of all the file extensions for this mime type. + std::vector<std::string> file_extensions; + + // Description of the mime type. + base::string16 description; + + // Extra parameters to include when instantiating the plugin. + std::vector<base::string16> additional_param_names; + std::vector<base::string16> additional_param_values; +}; + +// Describes an available NPAPI or Pepper plugin. +struct CONTENT_EXPORT WebPluginInfo { + enum PluginType { + PLUGIN_TYPE_NPAPI, + PLUGIN_TYPE_PEPPER_IN_PROCESS, + PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS, + PLUGIN_TYPE_PEPPER_UNSANDBOXED + }; + + WebPluginInfo(); + WebPluginInfo(const WebPluginInfo& rhs); + ~WebPluginInfo(); + WebPluginInfo& operator=(const WebPluginInfo& rhs); + + // Special constructor only used during unit testing: + WebPluginInfo(const base::string16& fake_name, + const base::FilePath& fake_path, + const base::string16& fake_version, + const base::string16& fake_desc); + + bool is_pepper_plugin() const { + return ((type == PLUGIN_TYPE_PEPPER_IN_PROCESS ) || + (type == PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) || + (type == PLUGIN_TYPE_PEPPER_UNSANDBOXED)); + } + + // Parse a version string as used by a plug-in. This method is more lenient + // in accepting weird version strings than base::Version::GetFromString() + static void CreateVersionFromString(const base::string16& version_string, + base::Version* parsed_version); + + // The name of the plugin (i.e. Flash). + base::string16 name; + + // The path to the plugin file (DLL/bundle/library). + base::FilePath path; + + // The version number of the plugin file (may be OS-specific) + base::string16 version; + + // A description of the plugin that we get from its version info. + base::string16 desc; + + // A list of all the mime types that this plugin supports. + std::vector<WebPluginMimeType> mime_types; + + // Plugin type. See the PluginType enum. + int type; + + // When type is PLUGIN_TYPE_PEPPER_* this indicates the permission bits. + int32 pepper_permissions; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_WEBPLUGININFO_H_ diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 6b5a836..dd75eb17 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -51,13 +51,13 @@ namespace webkit { namespace ppapi { class PpapiInterfaceFactoryManager; } -struct WebPluginInfo; } namespace content { class RenderView; class SynchronousCompositor; +struct WebPluginInfo; // Embedder API for participating in renderer logic. class CONTENT_EXPORT ContentRendererClient { diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h index 547e544..faacb32 100644 --- a/content/public/renderer/render_view.h +++ b/content/public/renderer/render_view.h @@ -31,16 +31,13 @@ namespace gfx { class Size; } -namespace webkit { -struct WebPluginInfo; -} - namespace content { class ContextMenuClient; class RenderViewVisitor; struct ContextMenuParams; struct SSLStatus; +struct WebPluginInfo; class CONTENT_EXPORT RenderView : public IPC::Sender { public: @@ -92,7 +89,7 @@ class CONTENT_EXPORT RenderView : public IPC::Sender { // plugin was found. virtual WebKit::WebPlugin* CreatePlugin( WebKit::WebFrame* frame, - const webkit::WebPluginInfo& info, + const WebPluginInfo& info, const WebKit::WebPluginParams& params) = 0; // Evaluates a string of JavaScript in a particular frame. diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index e44aed1..d489f49 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -35,6 +35,7 @@ #include "content/public/common/context_menu_params.h" #include "content/public/common/media_stream_request.h" #include "content/public/common/referrer.h" +#include "content/public/common/webplugininfo.h" #include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/renderer_restrict_dispatch_group.h" #include "content/renderer/gamepad_shared_memory_reader.h" @@ -101,7 +102,6 @@ #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" #include "webkit/plugins/ppapi/resource_helper.h" -#include "webkit/plugins/webplugininfo.h" using WebKit::WebView; using WebKit::WebFrame; @@ -306,7 +306,7 @@ void DidFailOpenFileSystemURL( void CreateHostForInProcessModule(RenderViewImpl* render_view, webkit::ppapi::PluginModule* module, - const webkit::WebPluginInfo& webplugin_info) { + const WebPluginInfo& webplugin_info) { // First time an in-process plugin was used, make a host for it. const PepperPluginInfo* info = PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); @@ -347,7 +347,7 @@ PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { } WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePepperWebPlugin( - const webkit::WebPluginInfo& webplugin_info, + const WebPluginInfo& webplugin_info, const WebKit::WebPluginParams& params) { bool pepper_plugin_was_registered = false; scoped_refptr<webkit::ppapi::PluginModule> pepper_module( @@ -365,7 +365,7 @@ WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePepperWebPlugin( scoped_refptr<webkit::ppapi::PluginModule> PepperPluginDelegateImpl::CreatePepperPluginModule( - const webkit::WebPluginInfo& webplugin_info, + const WebPluginInfo& webplugin_info, bool* pepper_plugin_was_registered) { *pepper_plugin_was_registered = true; diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index 66b5ba8..139d892 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -41,7 +41,6 @@ class PpapiPermissions; } namespace webkit { -struct WebPluginInfo; namespace ppapi { class PluginInstance; class PluginModule; @@ -59,6 +58,7 @@ class GamepadSharedMemoryReader; class PepperBrokerImpl; class PepperDeviceEnumerationEventHandler; class RenderViewImpl; +struct WebPluginInfo; class PepperPluginDelegateImpl : public webkit::ppapi::PluginDelegate, @@ -114,7 +114,7 @@ class PepperPluginDelegateImpl private: // RenderViewPepperHelper implementation. virtual WebKit::WebPlugin* CreatePepperWebPlugin( - const webkit::WebPluginInfo& webplugin_info, + const WebPluginInfo& webplugin_info, const WebKit::WebPluginParams& params) OVERRIDE; virtual void ViewWillInitiatePaint() OVERRIDE; virtual void ViewInitiatedPaint() OVERRIDE; @@ -385,9 +385,8 @@ class PepperPluginDelegateImpl // |*pepper_plugin_was_registered| will be set to true and the caller should // not fall back on any other plugin types. scoped_refptr<webkit::ppapi::PluginModule> - CreatePepperPluginModule( - const webkit::WebPluginInfo& webplugin_info, - bool* pepper_plugin_was_registered); + CreatePepperPluginModule(const WebPluginInfo& webplugin_info, + bool* pepper_plugin_was_registered); // Asynchronously attempts to create a PPAPI broker for the given plugin. scoped_refptr<PepperBrokerImpl> CreateBroker( diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 59370f3..288b405 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -1134,7 +1134,7 @@ void RenderViewImpl::UnregisterPluginDelegate( bool RenderViewImpl::GetPluginInfo(const GURL& url, const GURL& page_url, const std::string& mime_type, - webkit::WebPluginInfo* plugin_info, + WebPluginInfo* plugin_info, std::string* actual_mime_type) { bool found = false; Send(new ViewHostMsg_GetPluginInfo( @@ -2830,7 +2830,7 @@ WebKit::WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, return GetBrowserPluginManager()->CreateBrowserPlugin(this, frame, params); } - webkit::WebPluginInfo info; + WebPluginInfo info; std::string mime_type; bool found = GetPluginInfo(params.url, frame->top()->document().url(), params.mimeType.utf8(), &info, &mime_type); @@ -4681,7 +4681,7 @@ bool RenderViewImpl::IsEditableNode(const WebNode& node) const { WebKit::WebPlugin* RenderViewImpl::CreatePlugin( WebKit::WebFrame* frame, - const webkit::WebPluginInfo& info, + const WebPluginInfo& info, const WebKit::WebPluginParams& params) { WebKit::WebPlugin* pepper_webplugin = pepper_helper_->CreatePepperWebPlugin(info, params); diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 3c4c3e9..6e0e87d0 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -347,7 +347,7 @@ class CONTENT_EXPORT RenderViewImpl bool GetPluginInfo(const GURL& url, const GURL& page_url, const std::string& mime_type, - webkit::WebPluginInfo* plugin_info, + WebPluginInfo* plugin_info, std::string* actual_mime_type); void TransferActiveWheelFlingAnimation( @@ -712,7 +712,7 @@ class CONTENT_EXPORT RenderViewImpl virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE; virtual WebKit::WebPlugin* CreatePlugin( WebKit::WebFrame* frame, - const webkit::WebPluginInfo& info, + const WebPluginInfo& info, const WebKit::WebPluginParams& params) OVERRIDE; virtual void EvaluateScript(const string16& frame_xpath, const string16& jscript, diff --git a/content/renderer/render_view_pepper_helper.cc b/content/renderer/render_view_pepper_helper.cc index f69ca4f..c2f701b 100644 --- a/content/renderer/render_view_pepper_helper.cc +++ b/content/renderer/render_view_pepper_helper.cc @@ -12,7 +12,7 @@ RenderViewPepperHelper::~RenderViewPepperHelper() { } WebKit::WebPlugin* RenderViewPepperHelper::CreatePepperWebPlugin( - const webkit::WebPluginInfo& webplugin_info, + const WebPluginInfo& webplugin_info, const WebKit::WebPluginParams& params) { return NULL; } diff --git a/content/renderer/render_view_pepper_helper.h b/content/renderer/render_view_pepper_helper.h index 2a81945..14e22ef 100644 --- a/content/renderer/render_view_pepper_helper.h +++ b/content/renderer/render_view_pepper_helper.h @@ -31,7 +31,6 @@ class Range; } namespace webkit { -struct WebPluginInfo; namespace ppapi { class PluginInstance; } @@ -44,6 +43,7 @@ class WebPlugin; } namespace content { +struct WebPluginInfo; class CONTENT_EXPORT RenderViewPepperHelper { public: @@ -51,7 +51,7 @@ class CONTENT_EXPORT RenderViewPepperHelper { virtual ~RenderViewPepperHelper(); virtual WebKit::WebPlugin* CreatePepperWebPlugin( - const webkit::WebPluginInfo& webplugin_info, + const WebPluginInfo& webplugin_info, const WebKit::WebPluginParams& params); // Called by RenderView to implement the corresponding function in its base diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 320d7fe..e31e59e 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -27,6 +27,7 @@ #include "content/common/mime_registry_messages.h" #include "content/common/view_messages.h" #include "content/public/common/content_switches.h" +#include "content/public/common/webplugininfo.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/device_orientation/device_motion_event_pump.h" #include "content/renderer/dom_storage/webstoragenamespace_impl.h" @@ -67,7 +68,6 @@ #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/webplugininfo.h" #if defined(OS_WIN) #include "content/common/child_process_messages.h" @@ -908,20 +908,20 @@ void RendererWebKitPlatformSupportImpl::getPluginList( bool refresh, WebKit::WebPluginListBuilder* builder) { #if defined(ENABLE_PLUGINS) - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( new ViewHostMsg_GetPlugins(refresh, &plugins)); for (size_t i = 0; i < plugins.size(); ++i) { - const webkit::WebPluginInfo& plugin = plugins[i]; + const WebPluginInfo& plugin = plugins[i]; builder->addPlugin( plugin.name, plugin.desc, plugin.path.BaseName().AsUTF16Unsafe()); for (size_t j = 0; j < plugin.mime_types.size(); ++j) { - const webkit::WebPluginMimeType& mime_type = plugin.mime_types[j]; + const WebPluginMimeType& mime_type = plugin.mime_types[j]; builder->addMediaTypeToLastPlugin( WebString::fromUTF8(mime_type.mime_type), mime_type.description); diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index 39972ab..687f19e 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -1186,7 +1186,7 @@ bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { // The move networks plugin needs to be informed of geometry updates // synchronously. - std::vector<webkit::WebPluginMimeType>::iterator index; + std::vector<WebPluginMimeType>::iterator index; for (index = info_.mime_types.begin(); index != info_.mime_types.end(); index++) { if (index->mime_type == "application/x-vnd.moveplayer.qm" || diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h index bc6d721..c0838a2 100644 --- a/content/renderer/webplugin_delegate_proxy.h +++ b/content/renderer/webplugin_delegate_proxy.h @@ -13,6 +13,7 @@ #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner_helpers.h" #include "content/child/npapi/webplugin_delegate.h" +#include "content/public/common/webplugininfo.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sender.h" @@ -20,7 +21,6 @@ #include "ui/gfx/rect.h" #include "ui/surface/transport_dib.h" #include "url/gurl.h" -#include "webkit/plugins/webplugininfo.h" #if defined(OS_MACOSX) #include "base/containers/hash_tables.h" @@ -259,7 +259,7 @@ class WebPluginDelegateProxy scoped_refptr<PluginChannelHost> channel_host_; std::string mime_type_; int instance_id_; - webkit::WebPluginInfo info_; + WebPluginInfo info_; gfx::Rect plugin_rect_; gfx::Rect clip_rect_; diff --git a/content/shell/shell_plugin_service_filter.cc b/content/shell/shell_plugin_service_filter.cc index 31f080c..f164637 100644 --- a/content/shell/shell_plugin_service_filter.cc +++ b/content/shell/shell_plugin_service_filter.cc @@ -5,7 +5,7 @@ #include "content/shell/shell_plugin_service_filter.h" #include "base/strings/utf_string_conversions.h" -#include "webkit/plugins/webplugininfo.h" +#include "content/public/common/webplugininfo.h" namespace content { @@ -19,7 +19,7 @@ bool ShellPluginServiceFilter::IsPluginAvailable( const void* context, const GURL& url, const GURL& policy_url, - webkit::WebPluginInfo* plugin) { + WebPluginInfo* plugin) { return plugin->name == ASCIIToUTF16("WebKit Test PlugIn"); } diff --git a/content/shell/shell_plugin_service_filter.h b/content/shell/shell_plugin_service_filter.h index 81f8063..a489aff 100644 --- a/content/shell/shell_plugin_service_filter.h +++ b/content/shell/shell_plugin_service_filter.h @@ -22,7 +22,7 @@ class ShellPluginServiceFilter : public PluginServiceFilter { const void* context, const GURL& url, const GURL& policy_url, - webkit::WebPluginInfo* plugin) OVERRIDE; + WebPluginInfo* plugin) OVERRIDE; virtual bool CanLoadPlugin(int render_process_id, const base::FilePath& path) OVERRIDE; diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index f0e483b..e02d172 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -143,12 +143,12 @@ void UtilityThreadImpl::OnLoadPlugins( gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); #endif - std::vector<webkit::WebPluginInfo> plugins; + std::vector<WebPluginInfo> plugins; // TODO(bauerb): If we restart loading plug-ins, we might mess up the logic in // PluginList::ShouldLoadPlugin due to missing the previously loaded plug-ins // in |plugin_groups|. for (size_t i = 0; i < plugin_paths.size(); ++i) { - webkit::WebPluginInfo plugin; + WebPluginInfo plugin; if (!plugin_list->LoadPluginIntoPluginList( plugin_paths[i], &plugins, &plugin)) Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |