diff options
26 files changed, 145 insertions, 130 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 8657dc8..3059012 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -29,8 +29,8 @@ include_rules = [ # TODO(jam): this needs to be removed, and only use content/public. BUG=98716 "+content/browser", - "-content/browser/notification_service_impl.h" - "-content/browser/plugin_service.h" + "-content/browser/notification_service_impl.h", + "-content/browser/plugin_service_impl.h", "-content/common", # TODO(jam): remove all the exceptions. BUG=98716 diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc index 51990f6..be4100a 100644 --- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc +++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc @@ -14,10 +14,11 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_pref_service.h" #include "content/browser/mock_resource_context.h" -#include "content/browser/plugin_service.h" #include "content/browser/renderer_host/dummy_resource_handler.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" +#include "content/public/browser/plugin_service.h" #include "content/test/test_browser_thread.h" +#include "ipc/ipc_message.h" #include "net/base/load_flags.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" @@ -28,6 +29,7 @@ #include "webkit/plugins/npapi/mock_plugin_list.h" using content::BrowserThread; +using content::PluginService; namespace chromeos { diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index 7e40a0f..7c76cec 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc @@ -16,8 +16,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/plugin_service.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/plugin_service.h" +#include "webkit/plugins/webplugininfo.h" + +using content::PluginService; namespace { diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 295b807..6cdf208 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -61,9 +61,9 @@ #include "content/browser/file_system/browser_file_system_helper.h" #include "content/browser/in_process_webkit/dom_storage_context.h" #include "content/browser/in_process_webkit/webkit_context.h" -#include "content/browser/plugin_service.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/plugin_service.h" #include "content/test/test_browser_thread.h" #include "googleurl/src/gurl.h" #include "net/base/cookie_monster.h" @@ -78,6 +78,7 @@ #include "webkit/quota/quota_manager.h" using content::BrowserThread; +using content::PluginService; namespace keys = extension_manifest_keys; diff --git a/chrome/browser/plugin_prefs_unittest.cc b/chrome/browser/plugin_prefs_unittest.cc index e045a16..d43a4e2 100644 --- a/chrome/browser/plugin_prefs_unittest.cc +++ b/chrome/browser/plugin_prefs_unittest.cc @@ -11,13 +11,14 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" -#include "content/browser/plugin_service.h" +#include "content/public/browser/plugin_service.h" #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/plugins/npapi/mock_plugin_list.cc" #include "webkit/plugins/webplugininfo.h" using content::BrowserThread; +using content::PluginService; class PluginPrefsTest : public ::testing::Test { public: diff --git a/chrome/browser/policy/enterprise_metrics_enrollment_browsertest.cc b/chrome/browser/policy/enterprise_metrics_enrollment_browsertest.cc index d3bc17c..32b5e49 100644 --- a/chrome/browser/policy/enterprise_metrics_enrollment_browsertest.cc +++ b/chrome/browser/policy/enterprise_metrics_enrollment_browsertest.cc @@ -12,11 +12,13 @@ #include "chrome/browser/policy/enterprise_metrics.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/net/gaia/google_service_auth_error.h" -#include "content/browser/plugin_service.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/plugin_service.h" #include "content/test/test_url_fetcher_factory.h" #include "testing/gtest/include/gtest/gtest.h" +using content::PluginService; + namespace chromeos { namespace { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 206444f..f933b4f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2742,7 +2742,7 @@ '../content/browser/in_process_webkit/indexed_db_browsertest.cc', '../content/browser/indexed_db/idbbindingutilities_browsertest.cc', '../content/browser/plugin_data_remover_impl_browsertest.cc', - '../content/browser/plugin_service_browsertest.cc', + '../content/browser/plugin_service_impl_browsertest.cc', '../content/browser/renderer_host/render_process_host_browsertest.cc', '../content/browser/renderer_host/render_process_host_browsertest.h', '../content/browser/renderer_host/render_view_host_browsertest.cc', diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc index dd02f00..dfe0282 100644 --- a/chrome/test/ui/ppapi_uitest.cc +++ b/chrome/test/ui/ppapi_uitest.cc @@ -6,7 +6,6 @@ #include "base/path_service.h" #include "base/test/test_timeouts.h" #include "build/build_config.h" -#include "content/browser/plugin_service.h" #include "content/public/common/content_switches.h" #include "content/common/pepper_plugin_registry.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 736bc00..d4d00a1 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -50,7 +50,6 @@ #include "chrome_frame/test/win_event_receiver.h" #include "chrome_frame/utils.h" #include "content/app/content_main.h" -#include "content/browser/plugin_service.h" #include "content/public/app/startup_helper_win.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc index 7d26690..f613675 100644 --- a/content/browser/plugin_data_remover_impl.cc +++ b/content/browser/plugin_data_remover_impl.cc @@ -9,7 +9,7 @@ #include "base/synchronization/waitable_event.h" #include "base/version.h" #include "content/browser/plugin_process_host.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/common/child_process_host_impl.h" #include "content/common/plugin_messages.h" #include "content/public/browser/browser_thread.h" @@ -95,7 +95,7 @@ class PluginDataRemoverImpl::Context // Balanced in OnChannelOpened or OnError. Exactly one them will eventually // be called, so we need to keep this object around until then. AddRef(); - PluginService::GetInstance()->OpenChannelToNpapiPlugin( + PluginServiceImpl::GetInstance()->OpenChannelToNpapiPlugin( 0, 0, GURL(), GURL(), mime_type, this); } diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index cd6cb56..95614cc 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -23,7 +23,7 @@ PluginLoaderPosix::PluginLoaderPosix() void PluginLoaderPosix::LoadPlugins( scoped_refptr<base::MessageLoopProxy> target_loop, - const PluginService::GetPluginsCallback& callback) { + const content::PluginService::GetPluginsCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); callbacks_.push_back(PendingCallback(target_loop, callback)); @@ -68,11 +68,11 @@ void PluginLoaderPosix::GetPluginsToLoad() { next_load_index_ = 0; canonical_list_.clear(); - PluginService::GetInstance()->GetPluginList()->GetPluginPathsToLoad( + PluginServiceImpl::GetInstance()->GetPluginList()->GetPluginPathsToLoad( &canonical_list_); internal_plugins_.clear(); - PluginService::GetInstance()->GetPluginList()->GetInternalPlugins( + PluginServiceImpl::GetInstance()->GetPluginList()->GetInternalPlugins( &internal_plugins_); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, @@ -152,7 +152,8 @@ bool PluginLoaderPosix::MaybeRunPendingCallbacks() { if (next_load_index_ < canonical_list_.size()) return false; - PluginService::GetInstance()->GetPluginList()->SetPlugins(loaded_plugins_); + PluginServiceImpl::GetInstance()->GetPluginList()->SetPlugins( + loaded_plugins_); for (std::vector<PendingCallback>::iterator it = callbacks_.begin(); it != callbacks_.end(); ++it) { @@ -171,7 +172,7 @@ bool PluginLoaderPosix::MaybeRunPendingCallbacks() { PluginLoaderPosix::PendingCallback::PendingCallback( scoped_refptr<base::MessageLoopProxy> loop, - const PluginService::GetPluginsCallback& cb) + const content::PluginService::GetPluginsCallback& cb) : target_loop(loop), callback(cb) { } diff --git a/content/browser/plugin_loader_posix.h b/content/browser/plugin_loader_posix.h index 213a6a8..1646643 100644 --- a/content/browser/plugin_loader_posix.h +++ b/content/browser/plugin_loader_posix.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/time.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/utility_process_host.h" #include "ipc/ipc_message.h" #include "webkit/plugins/webplugininfo.h" @@ -49,8 +49,9 @@ class CONTENT_EXPORT PluginLoaderPosix : public UtilityProcessHost::Client, PluginLoaderPosix(); // Must be called from the IO thread. - void LoadPlugins(scoped_refptr<base::MessageLoopProxy> target_loop, - const PluginService::GetPluginsCallback& callback); + void LoadPlugins( + scoped_refptr<base::MessageLoopProxy> target_loop, + const content::PluginService::GetPluginsCallback& callback); // UtilityProcessHost::Client: virtual void OnProcessCrashed(int exit_code) OVERRIDE; @@ -62,11 +63,11 @@ class CONTENT_EXPORT PluginLoaderPosix : public UtilityProcessHost::Client, private: struct PendingCallback { PendingCallback(scoped_refptr<base::MessageLoopProxy> target_loop, - const PluginService::GetPluginsCallback& callback); + const content::PluginService::GetPluginsCallback& callback); ~PendingCallback(); scoped_refptr<base::MessageLoopProxy> target_loop; - PluginService::GetPluginsCallback callback; + content::PluginService::GetPluginsCallback callback; }; virtual ~PluginLoaderPosix(); diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index b9cbfac..85e66ad 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc @@ -74,7 +74,7 @@ class PluginLoaderPosixTest : public testing::Test { } virtual void SetUp() OVERRIDE { - PluginService::GetInstance()->Init(); + PluginServiceImpl::GetInstance()->Init(); } MessageLoop* message_loop() { return &message_loop_; } @@ -104,7 +104,7 @@ class PluginLoaderPosixTest : public testing::Test { TEST_F(PluginLoaderPosixTest, QueueRequests) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); EXPECT_EQ(0u, plugin_loader()->number_of_pending_callbacks()); @@ -131,7 +131,7 @@ TEST_F(PluginLoaderPosixTest, QueueRequests) { TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -172,7 +172,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { TEST_F(PluginLoaderPosixTest, TwoFailures) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -211,7 +211,7 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { TEST_F(PluginLoaderPosixTest, CrashedProcess) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -244,7 +244,7 @@ TEST_F(PluginLoaderPosixTest, CrashedProcess) { TEST_F(PluginLoaderPosixTest, InternalPlugin) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -293,7 +293,7 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { TEST_F(PluginLoaderPosixTest, AllCrashed) { int did_callback = 0; - PluginService::GetPluginsCallback callback = + content::PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 4989477..a695441 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -21,7 +21,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/common/child_process_host_impl.h" #include "content/common/plugin_messages.h" #include "content/common/resource_messages.h" diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service_impl.cc index c3ad8ce..fd1f0bd 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "base/bind.h" #include "base/command_line.h" @@ -43,6 +43,7 @@ using ::base::files::FilePathWatcher; #endif using content::BrowserThread; +using content::PluginService; using content::PluginServiceFilter; namespace { @@ -112,7 +113,7 @@ class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { namespace content { // static PluginService* PluginService::GetInstance() { - return ::PluginService::GetInstance(); + return PluginServiceImpl::GetInstance(); } void PluginService::PurgePluginListCache(BrowserContext* browser_context, @@ -128,18 +129,18 @@ void PluginService::PurgePluginListCache(BrowserContext* browser_context, } // namespace content // static -PluginService* PluginService::GetInstance() { - return Singleton<PluginService>::get(); +PluginServiceImpl* PluginServiceImpl::GetInstance() { + return Singleton<PluginServiceImpl>::get(); } -PluginService::PluginService() +PluginServiceImpl::PluginServiceImpl() : plugin_list_(NULL), ui_locale_( content::GetContentClient()->browser()->GetApplicationLocale()), filter_(NULL) { } -PluginService::~PluginService() { +PluginServiceImpl::~PluginServiceImpl() { #if defined(OS_WIN) // Release the events since they're owned by RegKey, not WaitableEvent. hkcu_watcher_.StopWatching(); @@ -153,7 +154,7 @@ PluginService::~PluginService() { DCHECK(pending_plugin_clients_.empty()); } -void PluginService::Init() { +void PluginServiceImpl::Init() { if (!plugin_list_) plugin_list_ = webkit::npapi::PluginList::Singleton(); @@ -181,7 +182,7 @@ void PluginService::Init() { #endif } -void PluginService::StartWatchingPlugins() { +void PluginServiceImpl::StartWatchingPlugins() { // Start watching for changes in the plugin list. This means watching // for changes in the Windows registry keys and on both Windows and POSIX // watch for changes in the paths that are expected to contain plugins. @@ -225,18 +226,18 @@ void PluginService::StartWatchingPlugins() { VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - base::Bind(&PluginService::RegisterFilePathWatcher, watcher, + base::Bind(&PluginServiceImpl::RegisterFilePathWatcher, watcher, plugin_dirs[i], file_watcher_delegate_)); file_watchers_.push_back(watcher); } #endif } -const std::string& PluginService::GetUILocale() { +const std::string& PluginServiceImpl::GetUILocale() { return ui_locale_; } -PluginProcessHost* PluginService::FindNpapiPluginProcess( +PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess( const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -250,7 +251,7 @@ PluginProcessHost* PluginService::FindNpapiPluginProcess( return NULL; } -PpapiPluginProcessHost* PluginService::FindPpapiPluginProcess( +PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess( const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -266,7 +267,7 @@ PpapiPluginProcessHost* PluginService::FindPpapiPluginProcess( return NULL; } -PpapiPluginProcessHost* PluginService::FindPpapiBrokerProcess( +PpapiPluginProcessHost* PluginServiceImpl::FindPpapiBrokerProcess( const FilePath& broker_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -282,7 +283,7 @@ PpapiPluginProcessHost* PluginService::FindPpapiBrokerProcess( return NULL; } -PluginProcessHost* PluginService::FindOrStartNpapiPluginProcess( +PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess( const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -304,7 +305,7 @@ PluginProcessHost* PluginService::FindOrStartNpapiPluginProcess( return new_host.release(); } -PpapiPluginProcessHost* PluginService::FindOrStartPpapiPluginProcess( +PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess( const FilePath& plugin_path, PpapiPluginProcessHost::PluginClient* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -324,7 +325,7 @@ PpapiPluginProcessHost* PluginService::FindOrStartPpapiPluginProcess( client->GetResourceContext()->host_resolver()); } -PpapiPluginProcessHost* PluginService::FindOrStartPpapiBrokerProcess( +PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess( const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -344,7 +345,7 @@ PpapiPluginProcessHost* PluginService::FindOrStartPpapiBrokerProcess( return PpapiPluginProcessHost::CreateBrokerHost(*info); } -void PluginService::OpenChannelToNpapiPlugin( +void PluginServiceImpl::OpenChannelToNpapiPlugin( int render_process_id, int render_view_id, const GURL& url, @@ -362,12 +363,12 @@ void PluginService::OpenChannelToNpapiPlugin( page_url, &client->GetResourceContext() }; - GetPlugins( - base::Bind(&PluginService::ForwardGetAllowedPluginForOpenChannelToPlugin, - base::Unretained(this), params, url, mime_type, client)); + GetPlugins(base::Bind( + &PluginServiceImpl::ForwardGetAllowedPluginForOpenChannelToPlugin, + base::Unretained(this), params, url, mime_type, client)); } -void PluginService::OpenChannelToPpapiPlugin( +void PluginServiceImpl::OpenChannelToPpapiPlugin( const FilePath& path, PpapiPluginProcessHost::PluginClient* client) { PpapiPluginProcessHost* plugin_host = FindOrStartPpapiPluginProcess( @@ -378,7 +379,7 @@ void PluginService::OpenChannelToPpapiPlugin( client->OnChannelOpened(base::kNullProcessHandle, IPC::ChannelHandle()); } -void PluginService::OpenChannelToPpapiBroker( +void PluginServiceImpl::OpenChannelToPpapiBroker( const FilePath& path, PpapiPluginProcessHost::BrokerClient* client) { PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess(path); @@ -388,14 +389,14 @@ void PluginService::OpenChannelToPpapiBroker( client->OnChannelOpened(base::kNullProcessHandle, IPC::ChannelHandle()); } -void PluginService::CancelOpenChannelToNpapiPlugin( +void PluginServiceImpl::CancelOpenChannelToNpapiPlugin( PluginProcessHost::Client* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(ContainsKey(pending_plugin_clients_, client)); pending_plugin_clients_.erase(client); } -void PluginService::ForwardGetAllowedPluginForOpenChannelToPlugin( +void PluginServiceImpl::ForwardGetAllowedPluginForOpenChannelToPlugin( const content::PluginServiceFilterParams& params, const GURL& url, const std::string& mime_type, @@ -406,7 +407,7 @@ void PluginService::ForwardGetAllowedPluginForOpenChannelToPlugin( params.resource_context); } -void PluginService::GetAllowedPluginForOpenChannelToPlugin( +void PluginServiceImpl::GetAllowedPluginForOpenChannelToPlugin( int render_process_id, int render_view_id, const GURL& url, @@ -425,12 +426,13 @@ void PluginService::GetAllowedPluginForOpenChannelToPlugin( plugin_path = info.path; // Now we jump back to the IO thread to finish opening the channel. - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&PluginService::FinishOpenChannelToPlugin, + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&PluginServiceImpl::FinishOpenChannelToPlugin, base::Unretained(this), plugin_path, client)); } -void PluginService::FinishOpenChannelToPlugin( +void PluginServiceImpl::FinishOpenChannelToPlugin( const FilePath& plugin_path, PluginProcessHost::Client* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -449,7 +451,7 @@ void PluginService::FinishOpenChannelToPlugin( } } -bool PluginService::GetPluginInfoArray( +bool PluginServiceImpl::GetPluginInfoArray( const GURL& url, const std::string& mime_type, bool allow_wildcard, @@ -461,16 +463,16 @@ bool PluginService::GetPluginInfoArray( return use_stale; } -bool PluginService::GetPluginInfo(int render_process_id, - int render_view_id, - const content::ResourceContext& context, - const GURL& url, - const GURL& page_url, - const std::string& mime_type, - bool allow_wildcard, - bool* is_stale, - webkit::WebPluginInfo* info, - std::string* actual_mime_type) { +bool PluginServiceImpl::GetPluginInfo(int render_process_id, + int render_view_id, + const content::ResourceContext& context, + const GURL& url, + const GURL& page_url, + const std::string& mime_type, + bool allow_wildcard, + bool* is_stale, + webkit::WebPluginInfo* info, + std::string* actual_mime_type) { std::vector<webkit::WebPluginInfo> plugins; std::vector<std::string> mime_types; bool stale = GetPluginInfoArray( @@ -501,8 +503,8 @@ bool PluginService::GetPluginInfo(int render_process_id, return false; } -bool PluginService::GetPluginInfoByPath(const FilePath& plugin_path, - webkit::WebPluginInfo* info) { +bool PluginServiceImpl::GetPluginInfoByPath(const FilePath& plugin_path, + webkit::WebPluginInfo* info) { std::vector<webkit::WebPluginInfo> plugins; plugin_list_->GetPluginsIfNoRefreshNeeded(&plugins); @@ -518,13 +520,14 @@ bool PluginService::GetPluginInfoByPath(const FilePath& plugin_path, return false; } -void PluginService::GetPlugins(const GetPluginsCallback& callback) { +void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { scoped_refptr<base::MessageLoopProxy> target_loop( MessageLoop::current()->message_loop_proxy()); #if defined(OS_WIN) - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::Bind(&PluginService::GetPluginsInternal, base::Unretained(this), + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, + base::Bind(&PluginServiceImpl::GetPluginsInternal, base::Unretained(this), target_loop, callback)); #else std::vector<webkit::WebPluginInfo> cached_plugins; @@ -544,11 +547,12 @@ void PluginService::GetPlugins(const GetPluginsCallback& callback) { #endif } -void PluginService::GetPluginGroups(const GetPluginGroupsCallback& callback) { +void PluginServiceImpl::GetPluginGroups( + const GetPluginGroupsCallback& callback) { GetPlugins(base::Bind(&GetPluginsForGroupsCallback, callback)); } -void PluginService::GetPluginsInternal( +void PluginServiceImpl::GetPluginsInternal( base::MessageLoopProxy* target_loop, const PluginService::GetPluginsCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -560,7 +564,7 @@ void PluginService::GetPluginsInternal( base::Bind(&RunGetPluginsCallback, callback, plugins)); } -void PluginService::OnWaitableEventSignaled( +void PluginServiceImpl::OnWaitableEventSignaled( base::WaitableEvent* waitable_event) { #if defined(OS_WIN) if (waitable_event == hkcu_event_.get()) { @@ -577,9 +581,9 @@ void PluginService::OnWaitableEventSignaled( #endif // defined(OS_WIN) } -void PluginService::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { +void PluginServiceImpl::Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { #if defined(OS_MACOSX) if (type == content::NOTIFICATION_APP_ACTIVATED) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, @@ -590,7 +594,7 @@ void PluginService::Observe(int type, NOTREACHED(); } -void PluginService::RegisterPepperPlugins() { +void PluginServiceImpl::RegisterPepperPlugins() { // TODO(abarth): It seems like the PepperPluginRegistry should do this work. PepperPluginRegistry::ComputeList(&ppapi_plugins_); for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { @@ -599,7 +603,7 @@ void PluginService::RegisterPepperPlugins() { } // There should generally be very few plugins so a brute-force search is fine. -content::PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( +content::PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( const FilePath& plugin_path) { content::PepperPluginInfo* info = NULL; for (size_t i = 0; i < ppapi_plugins_.size(); i++) { @@ -627,7 +631,7 @@ content::PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) // static -void PluginService::RegisterFilePathWatcher( +void PluginServiceImpl::RegisterFilePathWatcher( FilePathWatcher *watcher, const FilePath& path, FilePathWatcher::Delegate* delegate) { @@ -636,43 +640,44 @@ void PluginService::RegisterFilePathWatcher( } #endif -void PluginService::SetFilter(content::PluginServiceFilter* filter) { +void PluginServiceImpl::SetFilter(content::PluginServiceFilter* filter) { filter_ = filter; } -content::PluginServiceFilter* PluginService::GetFilter() { +content::PluginServiceFilter* PluginServiceImpl::GetFilter() { return filter_; } -void PluginService::RefreshPlugins() { +void PluginServiceImpl::RefreshPlugins() { plugin_list_->RefreshPlugins(); } -void PluginService::AddExtraPluginPath(const FilePath& path) { +void PluginServiceImpl::AddExtraPluginPath(const FilePath& path) { plugin_list_->AddExtraPluginPath(path); } -void PluginService::RemoveExtraPluginPath(const FilePath& path) { +void PluginServiceImpl::RemoveExtraPluginPath(const FilePath& path) { plugin_list_->RemoveExtraPluginPath(path); } -void PluginService::UnregisterInternalPlugin(const FilePath& path) { +void PluginServiceImpl::UnregisterInternalPlugin(const FilePath& path) { plugin_list_->UnregisterInternalPlugin(path); } -void PluginService::SetPluginListForTesting( +void PluginServiceImpl::SetPluginListForTesting( webkit::npapi::PluginList* plugin_list) { plugin_list_ = plugin_list; } -void PluginService::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { +void PluginServiceImpl::RegisterInternalPlugin( + const webkit::WebPluginInfo& info) { plugin_list_->RegisterInternalPlugin(info); } -string16 PluginService::GetPluginGroupName(const std::string& plugin_name) { +string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) { return plugin_list_->GetPluginGroupName(plugin_name); } -webkit::npapi::PluginList* PluginService::GetPluginList() { +webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { return plugin_list_; } diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service_impl.h index 43cb1ef..b106edd 100644 --- a/content/browser/plugin_service.h +++ b/content/browser/plugin_service_impl.h @@ -5,8 +5,8 @@ // This class responds to requests from renderers for the list of plugins, and // also a proxy object for plugin instances. -#ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ -#define CONTENT_BROWSER_PLUGIN_SERVICE_H_ +#ifndef CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ +#define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ #pragma once #include <set> @@ -57,13 +57,13 @@ class PluginList; } } -class CONTENT_EXPORT PluginService +class CONTENT_EXPORT PluginServiceImpl : NON_EXPORTED_BASE(public content::PluginService), public base::WaitableEventWatcher::Delegate, public content::NotificationObserver { public: - // Returns the PluginService singleton. - static PluginService* GetInstance(); + // Returns the PluginServiceImpl singleton. + static PluginServiceImpl* GetInstance(); // content::PluginService implementation: virtual void Init() OVERRIDE; @@ -103,6 +103,8 @@ class CONTENT_EXPORT PluginService const webkit::WebPluginInfo& info) OVERRIDE; virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE; virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE; + virtual void SetPluginListForTesting( + webkit::npapi::PluginList* plugin_list) OVERRIDE; // Gets the browser's UI locale. const std::string& GetUILocale(); @@ -140,15 +142,13 @@ class CONTENT_EXPORT PluginService // Cancels opening a channel to a NPAPI plugin. void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client); - void SetPluginListForTesting(webkit::npapi::PluginList* plugin_list); - private: - friend struct DefaultSingletonTraits<PluginService>; + friend struct DefaultSingletonTraits<PluginServiceImpl>; - // Creates the PluginService object, but doesn't actually build the plugin + // Creates the PluginServiceImpl object, but doesn't actually build the plugin // list yet. It's generated lazily. - PluginService(); - virtual ~PluginService(); + PluginServiceImpl(); + virtual ~PluginServiceImpl(); // base::WaitableEventWatcher::Delegate implementation. virtual void OnWaitableEventSignaled( @@ -231,9 +231,7 @@ class CONTENT_EXPORT PluginService scoped_refptr<PluginLoaderPosix> plugin_loader_; #endif - DISALLOW_COPY_AND_ASSIGN(PluginService); + DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); }; -DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); - -#endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ +#endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ diff --git a/content/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_impl_browsertest.cc index e6752c1..2fc2ca3 100644 --- a/content/browser/plugin_service_browsertest.cc +++ b/content/browser/plugin_service_impl_browsertest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "base/bind.h" #include "base/command_line.h" @@ -26,7 +26,7 @@ const char kNPAPITestPluginMimeType[] = "application/vnd.npapi-test"; void OpenChannel(PluginProcessHost::Client* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Start opening the channel - PluginService::GetInstance()->OpenChannelToNpapiPlugin( + PluginServiceImpl::GetInstance()->OpenChannelToNpapiPlugin( 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client); } @@ -158,11 +158,11 @@ void QuitUIMessageLoopFromIOThread() { void OpenChannelAndThenCancel(PluginProcessHost::Client* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Start opening the channel - PluginService::GetInstance()->OpenChannelToNpapiPlugin( + PluginServiceImpl::GetInstance()->OpenChannelToNpapiPlugin( 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client); // Immediately cancel it. This is guaranteed to work since PluginService needs // to consult its filter on the FILE thread. - PluginService::GetInstance()->CancelOpenChannelToNpapiPlugin(client); + PluginServiceImpl::GetInstance()->CancelOpenChannelToNpapiPlugin(client); // Before we terminate the test, add a roundtrip through the FILE thread to // make sure that it's had a chance to post back to the IO thread. Then signal // the UI thread to stop and exit the test. diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index f633842..0178ed6 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -9,7 +9,7 @@ #include "base/file_path.h" #include "base/process_util.h" #include "base/utf_string_conversions.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/renderer_host/render_message_filter.h" #include "content/common/child_process_host_impl.h" #include "content/common/child_process_messages.h" diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc index 6423c15..c6350ad 100644 --- a/content/browser/renderer_host/buffered_resource_handler.cc +++ b/content/browser/renderer_host/buffered_resource_handler.cc @@ -13,7 +13,7 @@ #include "content/browser/download/download_id_factory.h" #include "content/browser/download/download_resource_handler.h" #include "content/browser/download/download_types.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" @@ -357,7 +357,7 @@ bool BufferedResourceHandler::ShouldWaitForPlugins() { host_->PauseRequest(info->child_id(), info->request_id(), true); // Get the plugins asynchronously. - PluginService::GetInstance()->GetPlugins( + PluginServiceImpl::GetInstance()->GetPlugins( base::Bind(&BufferedResourceHandler::OnPluginsLoaded, this)); return true; } @@ -416,7 +416,7 @@ bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) { ResourceDispatcherHost::InfoForRequest(request_); bool stale = false; webkit::WebPluginInfo plugin; - bool found = PluginService::GetInstance()->GetPluginInfo( + bool found = PluginServiceImpl::GetInstance()->GetPluginInfo( info->child_id(), info->route_id(), *info->context(), request_->url(), GURL(), type, allow_wildcard, &stale, &plugin, NULL); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 2e5cd22..09cb4fc 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -19,8 +19,8 @@ #include "content/browser/download/download_stats.h" #include "content/browser/download/download_types.h" #include "content/browser/plugin_process_host.h" -#include "content/browser/plugin_service.h" #include "content/browser/plugin_service_filter.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/ppapi_plugin_process_host.h" #include "content/browser/renderer_host/media/media_observer.h" #include "content/browser/renderer_host/render_process_host_impl.h" @@ -266,7 +266,7 @@ class RenderMessageFilter::OpenChannelToNpapiPluginCallback RenderMessageFilter::RenderMessageFilter( int render_process_id, - PluginService* plugin_service, + PluginServiceImpl* plugin_service, content::BrowserContext* browser_context, net::URLRequestContextGetter* request_context, RenderWidgetHelper* render_widget_helper) @@ -558,12 +558,12 @@ void RenderMessageFilter::OnGetPlugins( const base::TimeTicks now = base::TimeTicks::Now(); if (now - last_plugin_refresh_time_ >= threshold) { // Only refresh if the threshold hasn't been exceeded yet. - PluginService::GetInstance()->RefreshPlugins(); + PluginServiceImpl::GetInstance()->RefreshPlugins(); last_plugin_refresh_time_ = now; } } - PluginService::GetInstance()->GetPlugins( + PluginServiceImpl::GetInstance()->GetPlugins( base::Bind(&RenderMessageFilter::GetPluginsCallback, this, reply_msg)); } @@ -572,7 +572,7 @@ void RenderMessageFilter::GetPluginsCallback( const std::vector<webkit::WebPluginInfo>& all_plugins) { // Filter the plugin list. content::PluginServiceFilter* filter = - PluginService::GetInstance()->GetFilter(); + PluginServiceImpl::GetInstance()->GetFilter(); std::vector<webkit::WebPluginInfo> plugins; int child_process_id = -1; diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index 4e4d403..3bde746 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -26,7 +26,7 @@ #include "ui/gfx/surface/transport_dib.h" struct FontDescriptor; -class PluginService; +class PluginServiceImpl; class RenderWidgetHelper; struct ViewHostMsg_CreateWindow_Params; @@ -67,7 +67,7 @@ class RenderMessageFilter : public content::BrowserMessageFilter { public: // Create the filter. RenderMessageFilter(int render_process_id, - PluginService* plugin_service, + PluginServiceImpl * plugin_service, content::BrowserContext* browser_context, net::URLRequestContextGetter* request_context, RenderWidgetHelper* render_widget_helper); @@ -230,7 +230,7 @@ class RenderMessageFilter : public content::BrowserMessageFilter { // be non-null if Init succeeds. We do not own the objects, they are managed // by the BrowserProcess, which has a wider scope than we do. ResourceDispatcherHost* resource_dispatcher_host_; - PluginService* plugin_service_; + PluginServiceImpl* plugin_service_; // The browser context associated with our renderer process. This should only // be accessed on the UI thread! diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 108514a..c3f1a9c 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -51,7 +51,7 @@ #include "content/browser/in_process_webkit/dom_storage_message_filter.h" #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" #include "content/browser/mime_registry_message_filter.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/profiler_message_filter.h" #include "content/browser/renderer_host/blob_message_filter.h" #include "content/browser/renderer_host/clipboard_message_filter.h" @@ -445,7 +445,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr<RenderMessageFilter> render_message_filter( new RenderMessageFilter( GetID(), - PluginService::GetInstance(), + PluginServiceImpl::GetInstance(), GetBrowserContext(), GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), widget_helper_)); diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index 8062805..8896fc7 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -31,7 +31,7 @@ #include "content/browser/download/download_resource_handler.h" #include "content/browser/download/save_file_manager.h" #include "content/browser/download/save_file_resource_handler.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/renderer_host/async_resource_handler.h" #include "content/browser/renderer_host/buffered_resource_handler.h" #include "content/browser/renderer_host/cross_site_resource_handler.h" diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 8a58948..d08bd43 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -342,8 +342,8 @@ 'browser/plugin_process_host.cc', 'browser/plugin_process_host.h', 'browser/plugin_process_host_mac.cc', - 'browser/plugin_service.cc', - 'browser/plugin_service.h', + 'browser/plugin_service_impl.cc', + 'browser/plugin_service_impl.h', 'browser/plugin_service_filter.h', 'browser/power_save_blocker.h', 'browser/power_save_blocker_common.cc', diff --git a/content/public/browser/plugin_service.h b/content/public/browser/plugin_service.h index 472f199..ee01e06 100644 --- a/content/public/browser/plugin_service.h +++ b/content/public/browser/plugin_service.h @@ -130,6 +130,9 @@ class PluginService { // TODO(dpranke): This should be private. virtual webkit::npapi::PluginList* GetPluginList() = 0; + + virtual void SetPluginListForTesting( + webkit::npapi::PluginList* plugin_list) = 0; }; } // namespace content diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index 035b302..24d7149 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -12,7 +12,7 @@ #include "content/browser/browser_process_sub_thread.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/save_file_manager.h" -#include "content/browser/plugin_service.h" +#include "content/browser/plugin_service_impl.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/shell/shell.h" #include "content/shell/shell_browser_context.h" |