diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 00:26:19 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-24 00:26:19 +0000 |
commit | 130757671de6d0dc4b54dd3ef11c1b9eb5f039cc (patch) | |
tree | 0c92593a755e31425f69d8c3c345fff10287c4ce /content/browser | |
parent | 375abf5c85ab185e3d659cde1e585aff2f8e6b3a (diff) | |
download | chromium_src-130757671de6d0dc4b54dd3ef11c1b9eb5f039cc.zip chromium_src-130757671de6d0dc4b54dd3ef11c1b9eb5f039cc.tar.gz chromium_src-130757671de6d0dc4b54dd3ef11c1b9eb5f039cc.tar.bz2 |
Move the remaning files in content\common to the content namespace.
Review URL: https://codereview.chromium.org/11235068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
28 files changed, 240 insertions, 233 deletions
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index c10d82db..8380e50 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc @@ -34,12 +34,7 @@ #include "content/browser/mach_broker_mac.h" #endif -using content::BrowserChildProcessHostDelegate; -using content::BrowserThread; -using content::ChildProcessData; -using content::ChildProcessHost; -using content::ChildProcessHostImpl; - +namespace content { namespace { static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> @@ -49,15 +44,13 @@ static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> // UI thread. void ChildNotificationHelper(int notification_type, const ChildProcessData& data) { - content::NotificationService::current()-> - Notify(notification_type, content::NotificationService::AllSources(), - content::Details<const ChildProcessData>(&data)); + NotificationService::current()->Notify( + notification_type, NotificationService::AllSources(), + Details<const ChildProcessData>(&data)); } } // namespace -namespace content { - BrowserChildProcessHost* BrowserChildProcessHost::Create( ProcessType type, BrowserChildProcessHostDelegate* delegate) { @@ -70,15 +63,13 @@ base::ProcessMetrics::PortProvider* BrowserChildProcessHost::GetPortProvider() { } #endif -} // namespace content - BrowserChildProcessHostImpl::BrowserChildProcessList* BrowserChildProcessHostImpl::GetIterator() { return g_child_process_list.Pointer(); } BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( - content::ProcessType type, + ProcessType type, BrowserChildProcessHostDelegate* delegate) : data_(type), delegate_(delegate) { @@ -86,11 +77,11 @@ BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( child_process_host_.reset(ChildProcessHost::Create(this)); child_process_host_->AddFilter(new TraceMessageFilter); - child_process_host_->AddFilter(new content::ProfilerMessageFilter(type)); - child_process_host_->AddFilter(new content::HistogramMessageFilter()); + child_process_host_->AddFilter(new ProfilerMessageFilter(type)); + child_process_host_->AddFilter(new HistogramMessageFilter()); g_child_process_list.Get().push_back(this); - content::GetContentClient()->browser()->BrowserChildProcessHostCreated(this); + GetContentClient()->browser()->BrowserChildProcessHostCreated(this); } BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { @@ -119,7 +110,7 @@ void BrowserChildProcessHostImpl::Launch( CommandLine* cmd_line) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( + GetContentClient()->browser()->AppendExtraCommandLineSwitches( cmd_line, data_.id); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); @@ -211,7 +202,7 @@ bool BrowserChildProcessHostImpl::OnMessageReceived( } void BrowserChildProcessHostImpl::OnChannelConnected(int32 peer_pid) { - Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED); + Notify(NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED); delegate_->OnChannelConnected(peer_pid); } @@ -232,10 +223,10 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() { case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: { delegate_->OnProcessCrashed(exit_code); // Report that this child process crashed. - Notify(content::NOTIFICATION_CHILD_PROCESS_CRASHED); + Notify(NOTIFICATION_CHILD_PROCESS_CRASHED); UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed", data_.type, - content::PROCESS_TYPE_MAX); + PROCESS_TYPE_MAX); break; } case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { @@ -243,22 +234,22 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() { // Report that this child process was killed. UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed", data_.type, - content::PROCESS_TYPE_MAX); + PROCESS_TYPE_MAX); break; } case base::TERMINATION_STATUS_STILL_RUNNING: { UMA_HISTOGRAM_ENUMERATION("ChildProcess.DisconnectedAlive", data_.type, - content::PROCESS_TYPE_MAX); + PROCESS_TYPE_MAX); } default: break; } UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", data_.type, - content::PROCESS_TYPE_MAX); + PROCESS_TYPE_MAX); // Notify in the main loop of the disconnection. - Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED); + Notify(NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED); delete delegate_; // Will delete us } @@ -274,3 +265,5 @@ void BrowserChildProcessHostImpl::OnProcessLaunched() { data_.handle = child_process_->GetHandle(); delegate_->OnProcessLaunched(); } + +} // namespace content diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h index 3d628f0..317a808 100644 --- a/content/browser/browser_child_process_host_impl.h +++ b/content/browser/browser_child_process_host_impl.h @@ -17,19 +17,18 @@ namespace content { class BrowserChildProcessHostIterator; -} // Plugins/workers and other child processes that live on the IO thread use this // class. RenderProcessHostImpl is the main exception that doesn't use this /// class because it lives on the UI thread. class CONTENT_EXPORT BrowserChildProcessHostImpl - : public content::BrowserChildProcessHost, - public NON_EXPORTED_BASE(content::ChildProcessHostDelegate), + : public BrowserChildProcessHost, + public NON_EXPORTED_BASE(ChildProcessHostDelegate), public ChildProcessLauncher::Client { public: BrowserChildProcessHostImpl( - content::ProcessType type, - content::BrowserChildProcessHostDelegate* delegate); + ProcessType type, + BrowserChildProcessHostDelegate* delegate); virtual ~BrowserChildProcessHostImpl(); // Terminates all child processes and deletes each BrowserChildProcessHost @@ -46,8 +45,8 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl const base::EnvironmentVector& environ, #endif CommandLine* cmd_line) OVERRIDE; - virtual const content::ChildProcessData& GetData() const OVERRIDE; - virtual content::ChildProcessHost* GetHost() const OVERRIDE; + virtual const ChildProcessData& GetData() const OVERRIDE; + virtual ChildProcessHost* GetHost() const OVERRIDE; virtual base::TerminationStatus GetTerminationStatus(int* exit_code) OVERRIDE; virtual void SetName(const string16& name) OVERRIDE; virtual void SetHandle(base::ProcessHandle handle) OVERRIDE; @@ -66,13 +65,12 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl // Sends the given notification on the UI thread. void Notify(int type); - content::BrowserChildProcessHostDelegate* delegate() const { - return delegate_; + BrowserChildProcessHostDelegate* delegate() const { return delegate_; } typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; private: - friend class content::BrowserChildProcessHostIterator; + friend class BrowserChildProcessHostIterator; static BrowserChildProcessList* GetIterator(); @@ -86,11 +84,13 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl // ChildProcessLauncher::Client implementation. virtual void OnProcessLaunched() OVERRIDE; - content::ChildProcessData data_; - content::BrowserChildProcessHostDelegate* delegate_; - scoped_ptr<content::ChildProcessHost> child_process_host_; + ChildProcessData data_; + BrowserChildProcessHostDelegate* delegate_; + scoped_ptr<ChildProcessHost> child_process_host_; scoped_ptr<ChildProcessLauncher> child_process_; }; +} // namespace content + #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 53501bf..cf59b5d 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -91,8 +91,7 @@ #undef DestroyAll #endif -using content::TraceControllerImpl; - +namespace content { namespace { #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) @@ -185,8 +184,6 @@ static void SetUpGLibLogHandler() { } // namespace -namespace content { - // The currently-running BrowserMainLoop. There can be one or zero. BrowserMainLoop* g_current_browser_main_loop = NULL; @@ -201,9 +198,9 @@ class BrowserShutdownImpl { #if defined(OS_WIN) // At this point the message loop is still running yet we've shut everything // down. If any messages are processed we'll likely crash. Exit now. - ExitProcess(content::RESULT_CODE_NORMAL_EXIT); + ExitProcess(RESULT_CODE_NORMAL_EXIT); #elif defined(OS_POSIX) && !defined(OS_MACOSX) - _exit(content::RESULT_CODE_NORMAL_EXIT); + _exit(RESULT_CODE_NORMAL_EXIT); #else NOTIMPLEMENTED(); #endif @@ -225,10 +222,10 @@ media_stream::MediaStreamManager* BrowserMainLoop::GetMediaStreamManager() { } // BrowserMainLoop construction / destruction ============================= -BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) +BrowserMainLoop::BrowserMainLoop(const MainFunctionParams& parameters) : parameters_(parameters), parsed_command_line_(parameters.command_line), - result_code_(content::RESULT_CODE_NORMAL_EXIT) { + result_code_(RESULT_CODE_NORMAL_EXIT) { DCHECK(!g_current_browser_main_loop); g_current_browser_main_loop = this; } @@ -304,7 +301,7 @@ void BrowserMainLoop::EarlyInitialization() { switches::kRendererProcessLimit); size_t process_limit; if (base::StringToSizeT(limit_string, &process_limit)) { - content::RenderProcessHost::SetMaxRendererProcessCount(process_limit); + RenderProcessHost::SetMaxRendererProcessCount(process_limit); } } #endif // !defined(OS_IOS) @@ -460,7 +457,7 @@ void BrowserMainLoop::CreateThreads() { BrowserThread::IO, FROM_HERE, base::Bind( base::IgnoreResult(&GpuProcessHost::Get), GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, - content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); + CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); } #endif // !defined(OS_IOS) @@ -639,7 +636,7 @@ void BrowserMainLoop::BrowserThreadsStarted() { #if !defined(OS_IOS) HistogramSynchronizer::GetInstance(); - content::BrowserGpuChannelHostFactory::Initialize(); + BrowserGpuChannelHostFactory::Initialize(); #if defined(USE_AURA) ImageTransportFactory::Initialize(); #endif diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index 4715904..82a0f2b 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc @@ -39,7 +39,7 @@ #include "base/global_descriptors_posix.h" #endif -using content::BrowserThread; +namespace content { // Having the functionality of ChildProcessLauncher be in an internal // ref counted object allows us to automatically terminate the process when the @@ -51,7 +51,7 @@ class ChildProcessLauncher::Context : client_(NULL), client_thread_id_(BrowserThread::UI), termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION), - exit_code_(content::RESULT_CODE_NORMAL_EXIT), + exit_code_(RESULT_CODE_NORMAL_EXIT), starting_(true) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) , zygote_(false) @@ -167,15 +167,15 @@ class ChildProcessLauncher::Context #elif defined(OS_ANDROID) std::string process_type = cmd_line->GetSwitchValueASCII(switches::kProcessType); - std::vector<content::FileDescriptorInfo> files_to_register; + std::vector<FileDescriptorInfo> files_to_register; files_to_register.push_back( - content::FileDescriptorInfo(kPrimaryIPCChannel, + FileDescriptorInfo(kPrimaryIPCChannel, base::FileDescriptor(ipcfd, false))); - content::GetContentClient()->browser()-> + GetContentClient()->browser()-> GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register); - content::StartSandboxedProcess(cmd_line->argv(), files_to_register, + StartSandboxedProcess(cmd_line->argv(), files_to_register, base::Bind(&ChildProcessLauncher::Context::OnSandboxedProcessStarted, this_object, client_thread_id)); @@ -187,13 +187,13 @@ class ChildProcessLauncher::Context std::string process_type = cmd_line->GetSwitchValueASCII(switches::kProcessType); - std::vector<content::FileDescriptorInfo> files_to_register; + std::vector<FileDescriptorInfo> files_to_register; files_to_register.push_back( - content::FileDescriptorInfo(kPrimaryIPCChannel, + FileDescriptorInfo(kPrimaryIPCChannel, base::FileDescriptor(ipcfd, false))); #if !defined(OS_MACOSX) - content::GetContentClient()->browser()-> + GetContentClient()->browser()-> GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register); if (use_zygote) { handle = ZygoteHostImpl::GetInstance()->ForkRequest(cmd_line->argv(), @@ -205,9 +205,9 @@ class ChildProcessLauncher::Context { // Convert FD mapping to FileHandleMappingVector base::FileHandleMappingVector fds_to_map; - for (std::vector<content::FileDescriptorInfo>::const_iterator + for (std::vector<FileDescriptorInfo>::const_iterator i = files_to_register.begin(); i != files_to_register.end(); ++i) { - const content::FileDescriptorInfo& fd_info = *i; + const FileDescriptorInfo& fd_info = *i; fds_to_map.push_back(std::make_pair( fd_info.fd.fd, fd_info.id + base::GlobalDescriptors::kBaseDescriptor)); @@ -329,12 +329,12 @@ class ChildProcessLauncher::Context base::ProcessHandle handle) { #if defined(OS_ANDROID) LOG(INFO) << "ChromeProcess: Stopping process with handle " << handle; - content::StopSandboxedProcess(handle); + StopSandboxedProcess(handle); #else base::Process process(handle); // Client has gone away, so just kill the process. Using exit code 0 // means that UMA won't treat this as a crash. - process.Terminate(content::RESULT_CODE_NORMAL_EXIT); + process.Terminate(RESULT_CODE_NORMAL_EXIT); // On POSIX, we must additionally reap the child. #if defined(OS_POSIX) #if !defined(OS_MACOSX) @@ -456,3 +456,5 @@ void ChildProcessLauncher::SetTerminateChildOnShutdown( if (context_) context_->set_terminate_child_on_shutdown(terminate_on_shutdown); } + +} // namespace content diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h index 8f610b2..efc1f74 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h @@ -12,6 +12,8 @@ class CommandLine; +namespace content { + // Launches a process asynchronously and notifies the client of the process // handle when it's available. It's used to avoid blocking the calling thread // on the OS since often it can take > 100 ms to create the process. @@ -72,4 +74,6 @@ class CONTENT_EXPORT ChildProcessLauncher { DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); }; +} // namespace content + #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index d03bb4a..5f964c0 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -46,6 +46,7 @@ #include "ui/surface/accelerated_surface_win.h" #endif +using content::BrowserChildProcessHostImpl; using content::BrowserThread; using content::ChildProcessHost; using content::GpuChildThread; diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index 1ecd7d3..457fd5f 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -28,7 +28,9 @@ struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; struct GpuHostMsg_AcceleratedSurfaceRelease_Params; +namespace content { class BrowserChildProcessHostImpl; +} namespace IPC { struct ChannelHandle; @@ -217,7 +219,7 @@ class GpuProcessHost : public content::BrowserChildProcessHostDelegate, static bool hardware_gpu_enabled_; - scoped_ptr<BrowserChildProcessHostImpl> process_; + scoped_ptr<content::BrowserChildProcessHostImpl> process_; DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); }; diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index a0cd639..b852dd3 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -14,8 +14,7 @@ #include "content/public/browser/browser_thread.h" #include "webkit/plugins/npapi/plugin_list.h" -using content::BrowserThread; -using content::ChildProcessHost; +namespace content { PluginLoaderPosix::PluginLoaderPosix() : next_load_index_(0) { @@ -23,7 +22,7 @@ PluginLoaderPosix::PluginLoaderPosix() void PluginLoaderPosix::LoadPlugins( scoped_refptr<base::MessageLoopProxy> target_loop, - const content::PluginService::GetPluginsCallback& callback) { + const PluginService::GetPluginsCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); callbacks_.push_back(PendingCallback(target_loop, callback)); @@ -190,10 +189,12 @@ bool PluginLoaderPosix::MaybeRunPendingCallbacks() { PluginLoaderPosix::PendingCallback::PendingCallback( scoped_refptr<base::MessageLoopProxy> loop, - const content::PluginService::GetPluginsCallback& cb) + const PluginService::GetPluginsCallback& cb) : target_loop(loop), callback(cb) { } PluginLoaderPosix::PendingCallback::~PendingCallback() { } + +} // namespace content diff --git a/content/browser/plugin_loader_posix.h b/content/browser/plugin_loader_posix.h index ad9e9f1..dca29ef 100644 --- a/content/browser/plugin_loader_posix.h +++ b/content/browser/plugin_loader_posix.h @@ -23,7 +23,6 @@ class MessageLoopProxy; namespace content { class UtilityProcessHost; -} // This class is responsible for managing the out-of-process plugin loading on // POSIX systems. It primarily lives on the IO thread, but has a brief stay on @@ -47,7 +46,7 @@ class UtilityProcessHost; // end, after which the list of loaded plugins is set on the PluginList and // the completion callback is run. class CONTENT_EXPORT PluginLoaderPosix - : public NON_EXPORTED_BASE(content::UtilityProcessHostClient), + : public NON_EXPORTED_BASE(UtilityProcessHostClient), public IPC::Sender { public: PluginLoaderPosix(); @@ -55,7 +54,7 @@ class CONTENT_EXPORT PluginLoaderPosix // Must be called from the IO thread. void LoadPlugins( scoped_refptr<base::MessageLoopProxy> target_loop, - const content::PluginService::GetPluginsCallback& callback); + const PluginService::GetPluginsCallback& callback); // UtilityProcessHostClient: virtual void OnProcessCrashed(int exit_code) OVERRIDE; @@ -67,11 +66,11 @@ class CONTENT_EXPORT PluginLoaderPosix private: struct PendingCallback { PendingCallback(scoped_refptr<base::MessageLoopProxy> target_loop, - const content::PluginService::GetPluginsCallback& callback); + const PluginService::GetPluginsCallback& callback); ~PendingCallback(); scoped_refptr<base::MessageLoopProxy> target_loop; - content::PluginService::GetPluginsCallback callback; + PluginService::GetPluginsCallback callback; }; virtual ~PluginLoaderPosix(); @@ -96,7 +95,7 @@ class CONTENT_EXPORT PluginLoaderPosix bool MaybeRunPendingCallbacks(); // The process host for which this is a client. - base::WeakPtr<content::UtilityProcessHost> process_host_; + base::WeakPtr<UtilityProcessHost> process_host_; // A list of paths to plugins which will be loaded by the utility process, in // the order specified by this vector. @@ -123,4 +122,6 @@ class CONTENT_EXPORT PluginLoaderPosix DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); }; +} // namespace content + #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index d81a99c..5c8e200 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc @@ -15,8 +15,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/plugins/webplugininfo.h" -using content::BrowserThread; -using content::BrowserThreadImpl; +namespace content { class MockPluginLoaderPosix : public PluginLoaderPosix { public: @@ -107,7 +106,7 @@ class PluginLoaderPosixTest : public testing::Test { TEST_F(PluginLoaderPosixTest, QueueRequests) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); EXPECT_EQ(0u, plugin_loader()->number_of_pending_callbacks()); @@ -141,7 +140,7 @@ TEST_F(PluginLoaderPosixTest, QueueRequests) { TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -182,7 +181,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -225,7 +224,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { TEST_F(PluginLoaderPosixTest, TwoFailures) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -264,7 +263,7 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { TEST_F(PluginLoaderPosixTest, CrashedProcess) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -297,7 +296,7 @@ TEST_F(PluginLoaderPosixTest, CrashedProcess) { TEST_F(PluginLoaderPosixTest, InternalPlugin) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -346,7 +345,7 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { TEST_F(PluginLoaderPosixTest, AllCrashed) { int did_callback = 0; - content::PluginService::GetPluginsCallback callback = + PluginService::GetPluginsCallback callback = base::Bind(&VerifyCallback, base::Unretained(&did_callback)); plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); @@ -376,3 +375,5 @@ TEST_F(PluginLoaderPosixTest, AllCrashed) { EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); } + +} // namespace content diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 7d8b89f..f95577d 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -39,10 +39,6 @@ #include "ui/gfx/native_widget_types.h" #include "ui/gl/gl_switches.h" -using content::BrowserThread; -using content::ChildProcessData; -using content::ChildProcessHost; - #if defined(USE_X11) #include "ui/gfx/gtk_native_view_id_manager.h" #endif @@ -57,7 +53,11 @@ using content::ChildProcessHost; #include "base/win/windows_version.h" #include "webkit/plugins/npapi/plugin_constants_win.h" #include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#endif + +namespace content { +#if defined(OS_WIN) void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { // The window is destroyed at this point, we just care about its parent, which // is the intermediate window we created. @@ -91,8 +91,7 @@ PluginProcessHost::PluginProcessHost() : plugin_cursor_visible_(true) #endif { - process_.reset( - new BrowserChildProcessHostImpl(content::PROCESS_TYPE_PLUGIN, this)); + process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_PLUGIN, this)); } PluginProcessHost::~PluginProcessHost() { @@ -208,8 +207,7 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { if (!plugin_launcher.empty()) cmd_line->PrependWrapper(plugin_launcher); - std::string locale = - content::GetContentClient()->browser()->GetApplicationLocale(); + std::string locale = GetContentClient()->browser()->GetApplicationLocale(); if (!locale.empty()) { // Pass on the locale so the null plugin will use the right language in the // prompt to install the desired plugin. @@ -222,21 +220,18 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { base::EnvironmentVector env; #if defined(OS_MACOSX) && !defined(__LP64__) if (!browser_command_line.HasSwitch(switches::kDisableCarbonInterposing)) { - std::string interpose_list = - content::GetContentClient()->GetCarbonInterposePath(); + std::string interpose_list = GetContentClient()->GetCarbonInterposePath(); if (!interpose_list.empty()) { // Add our interposing library for Carbon. This is stripped back out in // plugin_main.cc, so changes here should be reflected there. - const char* existing_list = - getenv(plugin_interpose_strings::kDYLDInsertLibrariesKey); + const char* existing_list = getenv(kDYLDInsertLibrariesKey); if (existing_list) { interpose_list.insert(0, ":"); interpose_list.insert(0, existing_list); } } env.push_back(std::pair<std::string, std::string>( - plugin_interpose_strings::kDYLDInsertLibrariesKey, - interpose_list)); + kDYLDInsertLibrariesKey, interpose_list)); } #endif #endif @@ -333,7 +328,7 @@ void PluginProcessHost::CancelRequests() { // static void PluginProcessHost::CancelPendingRequestsForResourceContext( - content::ResourceContext* context) { + ResourceContext* context) { for (PluginProcessHostIterator host_it; !host_it.Done(); ++host_it) { PluginProcessHost* host = *host_it; for (size_t i = 0; i < host->pending_requests_.size(); ++i) { @@ -347,7 +342,7 @@ void PluginProcessHost::CancelPendingRequestsForResourceContext( } void PluginProcessHost::OpenChannelToPlugin(Client* client) { - process_->Notify(content::NOTIFICATION_CHILD_INSTANCE_CREATED); + process_->Notify(NOTIFICATION_CHILD_INSTANCE_CREATED); client->SetPluginInfo(info_); if (process_->GetHost()->IsChannelOpening()) { // The channel is already in the process of being opened. Put @@ -412,3 +407,5 @@ void PluginProcessHost::OnChannelCreated( client->OnChannelOpened(channel_handle); sent_requests_.pop_front(); } + +} // namespace content diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index 12e391d..3795df3 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h @@ -22,12 +22,6 @@ #include "webkit/plugins/webplugininfo.h" #include "ui/gfx/native_widget_types.h" -class BrowserChildProcessHostImpl; - -namespace content { -class ResourceContext; -} - namespace gfx { class Rect; } @@ -36,6 +30,10 @@ namespace IPC { struct ChannelHandle; } +namespace content { +class BrowserChildProcessHostImpl; +class ResourceContext; + // Represents the browser side of the browser <--> plugin communication // channel. Different plugins run in their own process, but multiple instances // of the same plugin run in the same process. There will be one @@ -44,9 +42,8 @@ struct ChannelHandle; // starting the plugin process when a plugin is created that doesn't already // have a process. After that, most of the communication is directly between // the renderer and plugin processes. -class CONTENT_EXPORT PluginProcessHost - : public content::BrowserChildProcessHostDelegate, - public IPC::Sender { +class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHostDelegate, + public IPC::Sender { public: class Client { public: @@ -54,7 +51,7 @@ class CONTENT_EXPORT PluginProcessHost // the channel. virtual int ID() = 0; // Returns the resource context for the renderer requesting the channel. - virtual content::ResourceContext* GetResourceContext() = 0; + virtual ResourceContext* GetResourceContext() = 0; virtual bool OffTheRecord() = 0; virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; @@ -90,8 +87,7 @@ class CONTENT_EXPORT PluginProcessHost void OpenChannelToPlugin(Client* client); // Cancels all pending channel requests for the given resource context. - static void CancelPendingRequestsForResourceContext( - content::ResourceContext* context); + static void CancelPendingRequestsForResourceContext(ResourceContext* context); // This function is called to cancel pending requests to open new channels. void CancelPendingRequest(Client* client); @@ -183,11 +179,13 @@ class CONTENT_EXPORT PluginProcessHost }; class PluginProcessHostIterator - : public content::BrowserChildProcessHostTypeIterator<PluginProcessHost> { + : public BrowserChildProcessHostTypeIterator<PluginProcessHost> { public: PluginProcessHostIterator() - : content::BrowserChildProcessHostTypeIterator<PluginProcessHost>( - content::PROCESS_TYPE_PLUGIN) {} + : BrowserChildProcessHostTypeIterator<PluginProcessHost>( + PROCESS_TYPE_PLUGIN) {} }; +} // namespace content + #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ diff --git a/content/browser/plugin_process_host_mac.cc b/content/browser/plugin_process_host_mac.cc index 2638f46..5c7916a 100644 --- a/content/browser/plugin_process_host_mac.cc +++ b/content/browser/plugin_process_host_mac.cc @@ -19,7 +19,7 @@ #include "content/public/browser/child_process_data.h" #include "ui/gfx/rect.h" -using content::BrowserThread; +namespace content { void PluginProcessHost::OnPluginSelectWindow(uint32 window_id, gfx::Rect window_rect, @@ -112,3 +112,5 @@ void PluginProcessHost::OnPluginSetCursorVisibility(bool visible) { visible)); } } + +} // namespace content diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 6d8d7af..2f81ed0 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -44,11 +44,7 @@ using ::base::files::FilePathWatcher; #endif -using content::BrowserThread; -using content::PepperPluginRegistry; -using content::PluginService; -using content::PluginServiceFilter; - +namespace content { namespace { // Callback set on the PluginList to assert that plugin loading happens on the @@ -84,8 +80,8 @@ class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { webkit::npapi::PluginList::Singleton()->RefreshPlugins(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&content::PluginService::PurgePluginListCache, - static_cast<content::BrowserContext*>(NULL), false)); + base::Bind(&PluginService::PurgePluginListCache, + static_cast<BrowserContext*>(NULL), false)); } virtual void OnFilePathError(const FilePath& path) OVERRIDE { @@ -99,7 +95,6 @@ class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { }; #endif -namespace content { // static PluginService* PluginService::GetInstance() { return PluginServiceImpl::GetInstance(); @@ -115,8 +110,6 @@ void PluginService::PurgePluginListCache(BrowserContext* browser_context, } } -} // namespace content - // static PluginServiceImpl* PluginServiceImpl::GetInstance() { return Singleton<PluginServiceImpl>::get(); @@ -155,7 +148,7 @@ void PluginServiceImpl::Init() { RegisterPepperPlugins(); - content::GetContentClient()->AddNPAPIPlugins(plugin_list_); + GetContentClient()->AddNPAPIPlugins(plugin_list_); // Load any specified on the command line as well. const CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -283,7 +276,7 @@ PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess( return plugin_host; // Validate that the plugin is actually registered. - content::PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); + PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); if (!info) return NULL; @@ -302,7 +295,7 @@ PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess( return plugin_host; // Validate that the plugin is actually registered. - content::PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); + PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); if (!info) return NULL; @@ -387,7 +380,7 @@ void PluginServiceImpl::GetAllowedPluginForOpenChannelToPlugin( const GURL& page_url, const std::string& mime_type, PluginProcessHost::Client* client, - content::ResourceContext* resource_context) { + ResourceContext* resource_context) { webkit::WebPluginInfo info; bool allow_wildcard = true; bool found = GetPluginInfo( @@ -438,7 +431,7 @@ bool PluginServiceImpl::GetPluginInfoArray( bool PluginServiceImpl::GetPluginInfo(int render_process_id, int render_view_id, - content::ResourceContext* context, + ResourceContext* context, const GURL& url, const GURL& page_url, const std::string& mime_type, @@ -575,9 +568,9 @@ void PluginServiceImpl::RegisterPepperPlugins() { } // There should generally be very few plugins so a brute-force search is fine. -content::PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( +PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( const FilePath& plugin_path) { - content::PepperPluginInfo* info = NULL; + PepperPluginInfo* info = NULL; for (size_t i = 0; i < ppapi_plugins_.size(); i++) { if (ppapi_plugins_[i].path == plugin_path) { info = &ppapi_plugins_[i]; @@ -594,7 +587,7 @@ content::PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( webkit::WebPluginInfo webplugin_info; if (!GetPluginInfoByPath(plugin_path, &webplugin_info)) return NULL; - content::PepperPluginInfo new_pepper_info; + PepperPluginInfo new_pepper_info; if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info)) return NULL; ppapi_plugins_.push_back(new_pepper_info); @@ -612,11 +605,11 @@ void PluginServiceImpl::RegisterFilePathWatcher( } #endif -void PluginServiceImpl::SetFilter(content::PluginServiceFilter* filter) { +void PluginServiceImpl::SetFilter(PluginServiceFilter* filter) { filter_ = filter; } -content::PluginServiceFilter* PluginServiceImpl::GetFilter() { +PluginServiceFilter* PluginServiceImpl::GetFilter() { return filter_; } @@ -715,3 +708,5 @@ void PluginServiceImpl::GetInternalPlugins( webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { return plugin_list_; } + +} // namespace content diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h index a185fec..6bca392 100644 --- a/content/browser/plugin_service_impl.h +++ b/content/browser/plugin_service_impl.h @@ -36,43 +36,41 @@ #include "base/files/file_path_watcher.h" #endif -class PluginDirWatcherDelegate; -class PluginLoaderPosix; - namespace base { class MessageLoopProxy; } -namespace content { -class BrowserContext; -class PluginServiceFilter; -class ResourceContext; -struct PepperPluginInfo; -} - namespace webkit { namespace npapi { class PluginList; } } +namespace content { +class BrowserContext; +class PluginDirWatcherDelegate; +class PluginLoaderPosix; +class PluginServiceFilter; +class ResourceContext; +struct PepperPluginInfo; + // base::Bind() has limited arity, and the filter-related methods tend to // surpass that limit. struct PluginServiceFilterParams { int render_process_id; int render_view_id; GURL page_url; - content::ResourceContext* resource_context; + ResourceContext* resource_context; }; class CONTENT_EXPORT PluginServiceImpl - : NON_EXPORTED_BASE(public content::PluginService), + : NON_EXPORTED_BASE(public PluginService), public base::WaitableEventWatcher::Delegate { public: // Returns the PluginServiceImpl singleton. static PluginServiceImpl* GetInstance(); - // content::PluginService implementation: + // PluginService implementation: virtual void Init() OVERRIDE; virtual void StartWatchingPlugins() OVERRIDE; virtual bool GetPluginInfoArray( @@ -83,7 +81,7 @@ class CONTENT_EXPORT PluginServiceImpl std::vector<std::string>* actual_mime_types) OVERRIDE; virtual bool GetPluginInfo(int render_process_id, int render_view_id, - content::ResourceContext* context, + ResourceContext* context, const GURL& url, const GURL& page_url, const std::string& mime_type, @@ -95,10 +93,10 @@ class CONTENT_EXPORT PluginServiceImpl webkit::WebPluginInfo* info) OVERRIDE; virtual string16 GetPluginDisplayNameByPath(const FilePath& path) OVERRIDE; virtual void GetPlugins(const GetPluginsCallback& callback) OVERRIDE; - virtual content::PepperPluginInfo* GetRegisteredPpapiPluginInfo( + virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( const FilePath& plugin_path) OVERRIDE; - virtual void SetFilter(content::PluginServiceFilter* filter) OVERRIDE; - virtual content::PluginServiceFilter* GetFilter() OVERRIDE; + virtual void SetFilter(PluginServiceFilter* filter) OVERRIDE; + virtual PluginServiceFilter* GetFilter() OVERRIDE; virtual void ForcePluginShutdown(const FilePath& plugin_path) OVERRIDE; virtual bool IsPluginUnstable(const FilePath& plugin_path) OVERRIDE; virtual void RefreshPlugins() OVERRIDE; @@ -196,7 +194,7 @@ class CONTENT_EXPORT PluginServiceImpl const GURL& page_url, const std::string& mime_type, PluginProcessHost::Client* client, - content::ResourceContext* resource_context); + ResourceContext* resource_context); // Helper so we can finish opening the channel after looking up the // plugin. @@ -230,10 +228,10 @@ class CONTENT_EXPORT PluginServiceImpl scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; #endif - std::vector<content::PepperPluginInfo> ppapi_plugins_; + std::vector<PepperPluginInfo> ppapi_plugins_; // Weak pointer; outlives us. - content::PluginServiceFilter* filter_; + PluginServiceFilter* filter_; std::set<PluginProcessHost::Client*> pending_plugin_clients_; @@ -251,4 +249,6 @@ class CONTENT_EXPORT PluginServiceImpl DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 4669da0..07a42b6 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -26,8 +26,7 @@ #include "ui/base/ui_base_switches.h" #include "webkit/plugins/plugin_switches.h" -using content::ChildProcessHost; -using content::ChildProcessHostImpl; +namespace content { class PpapiPluginProcessHost::PluginNetworkObserver : public net::NetworkChangeNotifier::IPAddressObserver, @@ -74,7 +73,7 @@ PpapiPluginProcessHost::~PpapiPluginProcessHost() { // static PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( - const content::PepperPluginInfo& info, + const PepperPluginInfo& info, const FilePath& profile_data_directory, net::HostResolver* host_resolver) { PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( @@ -88,7 +87,7 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( // static PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( - const content::PepperPluginInfo& info) { + const PepperPluginInfo& info) { PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost(); if (plugin_host->Init(info)) @@ -158,7 +157,7 @@ void PpapiPluginProcessHost::OpenChannelToPlugin(Client* client) { } PpapiPluginProcessHost::PpapiPluginProcessHost( - const content::PepperPluginInfo& info, + const PepperPluginInfo& info, const FilePath& profile_data_directory, net::HostResolver* host_resolver) : permissions_( @@ -167,12 +166,12 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( profile_data_directory_(profile_data_directory), is_broker_(false) { process_.reset(new BrowserChildProcessHostImpl( - content::PROCESS_TYPE_PPAPI_PLUGIN, this)); + PROCESS_TYPE_PPAPI_PLUGIN, this)); filter_ = new PepperMessageFilter(PepperMessageFilter::PLUGIN, host_resolver); - host_impl_ = new content::BrowserPpapiHostImpl(this, permissions_); + host_impl_ = new BrowserPpapiHostImpl(this, permissions_); file_filter_ = new PepperTrustedFileMessageFilter( process_->GetData().id, info.name, profile_data_directory); @@ -181,19 +180,19 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( process_->GetHost()->AddFilter(file_filter_.get()); process_->GetHost()->AddFilter(host_impl_.get()); - content::GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_); + GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_); } PpapiPluginProcessHost::PpapiPluginProcessHost() : is_broker_(true) { process_.reset(new BrowserChildProcessHostImpl( - content::PROCESS_TYPE_PPAPI_BROKER, this)); + PROCESS_TYPE_PPAPI_BROKER, this)); ppapi::PpapiPermissions permissions; // No permissions. - host_impl_ = new content::BrowserPpapiHostImpl(this, permissions); + host_impl_ = new BrowserPpapiHostImpl(this, permissions); } -bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { +bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { plugin_path_ = info.path; if (info.name.empty()) { process_->SetName(plugin_path_.BaseName().LossyDisplayName()); @@ -248,8 +247,7 @@ bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { arraysize(kPluginForwardSwitches)); } - std::string locale = - content::GetContentClient()->browser()->GetApplicationLocale(); + std::string locale = GetContentClient()->browser()->GetApplicationLocale(); if (!locale.empty()) { // Pass on the locale so the plugin will know what language we're using. cmd_line->AppendSwitchASCII(switches::kLang, locale); @@ -366,3 +364,5 @@ void PpapiPluginProcessHost::OnRendererPluginChannelCreated( client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); } + +} // namespace content diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index b19536e..e472c11 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h @@ -20,20 +20,18 @@ #include "ipc/ipc_sender.h" #include "ppapi/shared_impl/ppapi_permissions.h" -class BrowserChildProcessHostImpl; - -namespace content { -struct PepperPluginInfo; -class ResourceContext; -} - namespace net { class HostResolver; } +namespace content { +class BrowserChildProcessHostImpl; +class ResourceContext; +struct PepperPluginInfo; + // Process host for PPAPI plugin and broker processes. // When used for the broker, interpret all references to "plugin" with "broker". -class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, +class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate, public IPC::Sender { public: class Client { @@ -61,7 +59,7 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, class PluginClient : public Client { public: // Returns the resource context for the renderer requesting the channel. - virtual content::ResourceContext* GetResourceContext() = 0; + virtual ResourceContext* GetResourceContext() = 0; protected: virtual ~PluginClient() {} @@ -75,11 +73,11 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, virtual ~PpapiPluginProcessHost(); static PpapiPluginProcessHost* CreatePluginHost( - const content::PepperPluginInfo& info, + const PepperPluginInfo& info, const FilePath& profile_data_directory, net::HostResolver* host_resolver); static PpapiPluginProcessHost* CreateBrokerHost( - const content::PepperPluginInfo& info); + const PepperPluginInfo& info); // Notification that a PP_Instance has been created for the given // RenderView/Process pair for the given plugin. This is necessary so that @@ -113,14 +111,14 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, // Constructors for plugin and broker process hosts, respectively. // You must call Init before doing anything else. - PpapiPluginProcessHost(const content::PepperPluginInfo& info, + PpapiPluginProcessHost(const PepperPluginInfo& info, const FilePath& profile_data_directory, net::HostResolver* host_resolver); PpapiPluginProcessHost(); // Actually launches the process with the given plugin info. Returns true // on success (the process was spawned). - bool Init(const content::PepperPluginInfo& info); + bool Init(const PepperPluginInfo& info); void RequestPluginChannel(Client* client); @@ -140,7 +138,7 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, scoped_refptr<PepperMessageFilter> filter_; ppapi::PpapiPermissions permissions_; - scoped_refptr<content::BrowserPpapiHostImpl> host_impl_; + scoped_refptr<BrowserPpapiHostImpl> host_impl_; // Handles filesystem requests from flash plugins. May be NULL. scoped_refptr<PepperFileMessageFilter> file_filter_; @@ -170,22 +168,24 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, }; class PpapiPluginProcessHostIterator - : public content::BrowserChildProcessHostTypeIterator< + : public BrowserChildProcessHostTypeIterator< PpapiPluginProcessHost> { public: PpapiPluginProcessHostIterator() - : content::BrowserChildProcessHostTypeIterator< - PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_PLUGIN) {} + : BrowserChildProcessHostTypeIterator< + PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_PLUGIN) {} }; class PpapiBrokerProcessHostIterator - : public content::BrowserChildProcessHostTypeIterator< + : public BrowserChildProcessHostTypeIterator< PpapiPluginProcessHost> { public: PpapiBrokerProcessHostIterator() - : content::BrowserChildProcessHostTypeIterator< - PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {} + : BrowserChildProcessHostTypeIterator< + PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_BROKER) {} }; +} // namespace content + #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ diff --git a/content/browser/renderer_host/java/java_bridge_channel_host.h b/content/browser/renderer_host/java/java_bridge_channel_host.h index 6c64437..503d554 100644 --- a/content/browser/renderer_host/java/java_bridge_channel_host.h +++ b/content/browser/renderer_host/java/java_bridge_channel_host.h @@ -7,7 +7,7 @@ #include "content/common/np_channel_base.h" -class JavaBridgeChannelHost : public NPChannelBase { +class JavaBridgeChannelHost : public content::NPChannelBase { public: static JavaBridgeChannelHost* GetJavaBridgeChannelHost( int renderer_id, diff --git a/content/browser/renderer_host/java/java_bridge_dispatcher_host.cc b/content/browser/renderer_host/java/java_bridge_dispatcher_host.cc index 65cd52e..c6b8640 100644 --- a/content/browser/renderer_host/java/java_bridge_dispatcher_host.cc +++ b/content/browser/renderer_host/java/java_bridge_dispatcher_host.cc @@ -18,6 +18,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" using content::BrowserThread; +using content::NPObjectStub; +using content::NPVariant_Param; using content::RenderViewHost; namespace { @@ -114,7 +116,7 @@ void JavaBridgeDispatcherHost::CreateNPVariantParam(NPObject* object, // Create an NPVariantParam suitable for serialization over IPC from our // NPVariant. See CreateNPVariantParam() in npobject_utils. - param->type = NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID; + param->type = content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID; int route_id = JavaBridgeChannelHost::ThreadsafeGenerateRouteID(); param->npobject_routing_id = route_id; diff --git a/content/browser/renderer_host/java/java_bridge_dispatcher_host.h b/content/browser/renderer_host/java/java_bridge_dispatcher_host.h index 5be526b..eb71b5a 100644 --- a/content/browser/renderer_host/java/java_bridge_dispatcher_host.h +++ b/content/browser/renderer_host/java/java_bridge_dispatcher_host.h @@ -9,13 +9,13 @@ #include "base/string16.h" #include "content/public/browser/render_view_host_observer.h" -class NPChannelBase; class RouteIDGenerator; struct NPObject; -struct NPVariant_Param; namespace content { +class NPChannelBase; class RenderViewHost; +struct NPVariant_Param; } // This class handles injecting Java objects into a single RenderView. The Java @@ -58,10 +58,10 @@ class JavaBridgeDispatcherHost void OnGetChannelHandle(IPC::Message* reply_msg); void GetChannelHandle(IPC::Message* reply_msg); - void CreateNPVariantParam(NPObject* object, NPVariant_Param* param); + void CreateNPVariantParam(NPObject* object, content::NPVariant_Param* param); void CreateObjectStub(NPObject* object, int route_id); - scoped_refptr<NPChannelBase> channel_; + scoped_refptr<content::NPChannelBase> channel_; bool is_renderer_initialized_; DISALLOW_COPY_AND_ASSIGN(JavaBridgeDispatcherHost); diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index 7e3afc3..a1205ca 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -31,7 +31,6 @@ #endif class DOMStorageContextImpl; -class PluginServiceImpl; struct FontDescriptor; struct ViewHostMsg_CreateWindow_Params; @@ -63,6 +62,7 @@ struct WebPluginInfo; namespace content { class BrowserContext; class MediaObserver; +class PluginServiceImpl; class RenderWidgetHelper; class ResourceContext; class ResourceDispatcherHostImpl; diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc index 0249836..47fe315 100644 --- a/content/browser/renderer_host/render_sandbox_host_linux.cc +++ b/content/browser/renderer_host/render_sandbox_host_linux.cc @@ -36,11 +36,12 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h" #include "ui/gfx/font_render_params_linux.h" -using content::LinuxSandbox; using WebKit::WebCString; using WebKit::WebFontInfo; using WebKit::WebUChar; +namespace content { + // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC // BEWARE: code in this file run across *processes* (not just threads). @@ -668,7 +669,7 @@ class SandboxIPCProcess { const int browser_socket_; scoped_ptr<FontConfigDirect> font_config_; std::vector<std::string> sandbox_cmd_; - scoped_ptr<content::WebKitPlatformSupportImpl> webkit_platform_support_; + scoped_ptr<WebKitPlatformSupportImpl> webkit_platform_support_; }; SandboxIPCProcess::~SandboxIPCProcess() { @@ -679,7 +680,7 @@ SandboxIPCProcess::~SandboxIPCProcess() { void SandboxIPCProcess::EnsureWebKitInitialized() { if (webkit_platform_support_.get()) return; - webkit_platform_support_.reset(new content::WebKitPlatformSupportImpl); + webkit_platform_support_.reset(new WebKitPlatformSupportImpl); WebKit::initializeWithoutV8(webkit_platform_support_.get()); } @@ -747,3 +748,5 @@ RenderSandboxHostLinux::~RenderSandboxHostLinux() { PLOG(ERROR) << "close"; } } + +} // namespace content diff --git a/content/browser/renderer_host/render_sandbox_host_linux.h b/content/browser/renderer_host/render_sandbox_host_linux.h index 87667cf..d9f7edb 100644 --- a/content/browser/renderer_host/render_sandbox_host_linux.h +++ b/content/browser/renderer_host/render_sandbox_host_linux.h @@ -14,6 +14,8 @@ template <typename T> struct DefaultSingletonTraits; +namespace content { + // This is a singleton object which handles sandbox requests from the // renderers. class CONTENT_EXPORT RenderSandboxHostLinux { @@ -49,4 +51,6 @@ class CONTENT_EXPORT RenderSandboxHostLinux { DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux); }; +} // namespace content + #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc index 82c3c53..5707aad 100644 --- a/content/browser/utility_process_host_impl.cc +++ b/content/browser/utility_process_host_impl.cc @@ -19,10 +19,6 @@ #include "ui/base/ui_base_switches.h" #include "webkit/plugins/plugin_switches.h" -using content::BrowserThread; -using content::ChildProcessHost; -using content::UtilityProcessHostClient; - namespace content { UtilityProcessHost* UtilityProcessHost::Create( @@ -31,8 +27,6 @@ UtilityProcessHost* UtilityProcessHost::Create( return new UtilityProcessHostImpl(client, client_thread_id); } -} // namespace content - UtilityProcessHostImpl::UtilityProcessHostImpl( UtilityProcessHostClient* client, BrowserThread::ID client_thread_id) @@ -47,8 +41,7 @@ UtilityProcessHostImpl::UtilityProcessHostImpl( #endif use_linux_zygote_(false), started_(false) { - process_.reset( - new BrowserChildProcessHostImpl(content::PROCESS_TYPE_UTILITY, this)); + process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this)); } UtilityProcessHostImpl::~UtilityProcessHostImpl() { @@ -137,8 +130,7 @@ bool UtilityProcessHostImpl::StartProcess() { cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); - std::string locale = - content::GetContentClient()->browser()->GetApplicationLocale(); + std::string locale = GetContentClient()->browser()->GetApplicationLocale(); cmd_line->AppendSwitchASCII(switches::kLang, locale); if (browser_command_line.HasSwitch(switches::kChromeFrame)) @@ -198,3 +190,5 @@ void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), exit_code)); } + +} // namespace content diff --git a/content/browser/utility_process_host_impl.h b/content/browser/utility_process_host_impl.h index e449412..4007881 100644 --- a/content/browser/utility_process_host_impl.h +++ b/content/browser/utility_process_host_impl.h @@ -15,14 +15,15 @@ #include "content/public/browser/browser_child_process_host_delegate.h" #include "content/public/browser/utility_process_host.h" +namespace content { class BrowserChildProcessHostImpl; class CONTENT_EXPORT UtilityProcessHostImpl - : public NON_EXPORTED_BASE(content::UtilityProcessHost), - public content::BrowserChildProcessHostDelegate { + : public NON_EXPORTED_BASE(UtilityProcessHost), + public BrowserChildProcessHostDelegate { public: - UtilityProcessHostImpl(content::UtilityProcessHostClient* client, - content::BrowserThread::ID client_thread_id); + UtilityProcessHostImpl(UtilityProcessHostClient* client, + BrowserThread::ID client_thread_id); virtual ~UtilityProcessHostImpl(); // UtilityProcessHost implementation: @@ -48,8 +49,8 @@ class CONTENT_EXPORT UtilityProcessHostImpl virtual void OnProcessCrashed(int exit_code) OVERRIDE; // A pointer to our client interface, who will be informed of progress. - scoped_refptr<content::UtilityProcessHostClient> client_; - content::BrowserThread::ID client_thread_id_; + scoped_refptr<UtilityProcessHostClient> client_; + BrowserThread::ID client_thread_id_; // True when running in batch mode, i.e., StartBatchMode() has been called // and the utility process will run until EndBatchMode(). bool is_batch_mode_; @@ -74,4 +75,6 @@ class CONTENT_EXPORT UtilityProcessHostImpl DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ diff --git a/content/browser/worker_host/worker_process_host.h b/content/browser/worker_host/worker_process_host.h index 1fde05a..c1f5aad 100644 --- a/content/browser/worker_host/worker_process_host.h +++ b/content/browser/worker_host/worker_process_host.h @@ -20,7 +20,6 @@ #include "googleurl/src/gurl.h" #include "ipc/ipc_sender.h" -class BrowserChildProcessHostImpl; class ChromeAppCacheService; class IndexedDBContextImpl; @@ -33,6 +32,7 @@ class DatabaseTracker; } // namespace webkit_database namespace content { +class BrowserChildProcessHostImpl; class ResourceContext; class WorkerServiceImpl; diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc index 647d902..bbe1efe 100644 --- a/content/browser/zygote_host/zygote_host_impl_linux.cc +++ b/content/browser/zygote_host/zygote_host_impl_linux.cc @@ -39,8 +39,10 @@ #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" #endif +namespace content { + // static -content::ZygoteHost* content::ZygoteHost::GetInstance() { +ZygoteHost* ZygoteHost::GetInstance() { return ZygoteHostImpl::GetInstance(); } @@ -82,7 +84,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); #endif base::FileHandleMappingVector fds_to_map; - fds_to_map.push_back(std::make_pair(fds[1], content::kZygoteSocketPairFd)); + fds_to_map.push_back(std::make_pair(fds[1], kZygoteSocketPairFd)); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { @@ -117,8 +119,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, arraysize(kForwardSwitches)); - content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( - &cmd_line, -1); + GetContentClient()->browser()->AppendExtraCommandLineSwitches(&cmd_line, -1); sandbox_binary_ = sandbox_cmd.c_str(); @@ -154,13 +155,13 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { // Start up the sandbox host process and get the file descriptor for the // renderers to talk to it. const int sfd = RenderSandboxHostLinux::GetInstance()->GetRendererSocket(); - fds_to_map.push_back(std::make_pair(sfd, content::kZygoteRendererSocketFd)); + fds_to_map.push_back(std::make_pair(sfd, kZygoteRendererSocketFd)); int dummy_fd = -1; if (using_suid_sandbox_) { dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0); CHECK(dummy_fd >= 0); - fds_to_map.push_back(std::make_pair(dummy_fd, content::kZygoteIdFd)); + fds_to_map.push_back(std::make_pair(dummy_fd, kZygoteIdFd)); } base::ProcessHandle process = -1; @@ -175,12 +176,12 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { // But first, wait for the zygote to tell us it's running. // The sending code is in content/browser/zygote_main_linux.cc. std::vector<int> fds_vec; - const int kExpectedLength = sizeof(content::kZygoteHelloMessage); + const int kExpectedLength = sizeof(kZygoteHelloMessage); char buf[kExpectedLength]; const ssize_t len = UnixDomainSocket::RecvMsg(fds[0], buf, sizeof(buf), &fds_vec); CHECK(len == kExpectedLength) << "Incorrect zygote magic length"; - CHECK(0 == strcmp(buf, content::kZygoteHelloMessage)) + CHECK(0 == strcmp(buf, kZygoteHelloMessage)) << "Incorrect zygote hello"; std::string inode_output; @@ -214,7 +215,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { control_fd_ = fds[0]; Pickle pickle; - pickle.WriteInt(content::kZygoteCommandGetSandboxStatus); + pickle.WriteInt(kZygoteCommandGetSandboxStatus); if (!SendMessage(pickle, NULL)) LOG(FATAL) << "Cannot communicate with zygote"; // We don't wait for the reply. We'll read it in ReadReply. @@ -222,9 +223,9 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { bool ZygoteHostImpl::SendMessage(const Pickle& data, const std::vector<int>* fds) { - CHECK(data.size() <= content::kZygoteMaxMessageLength) + CHECK(data.size() <= kZygoteMaxMessageLength) << "Trying to send too-large message to zygote (sending " << data.size() - << " bytes, max is " << content::kZygoteMaxMessageLength << ")"; + << " bytes, max is " << kZygoteMaxMessageLength << ")"; CHECK(!fds || fds->size() <= UnixDomainSocket::kMaxFileDescriptors) << "Trying to send message with too many file descriptors to zygote " << "(sending " << fds->size() << ", max is " @@ -253,12 +254,12 @@ ssize_t ZygoteHostImpl::ReadReply(void* buf, size_t buf_len) { pid_t ZygoteHostImpl::ForkRequest( const std::vector<std::string>& argv, - const std::vector<content::FileDescriptorInfo>& mapping, + const std::vector<FileDescriptorInfo>& mapping, const std::string& process_type) { DCHECK(init_); Pickle pickle; - pickle.WriteInt(content::kZygoteCommandFork); + pickle.WriteInt(kZygoteCommandFork); pickle.WriteString(process_type); pickle.WriteInt(argv.size()); for (std::vector<std::string>::const_iterator @@ -271,7 +272,7 @@ pid_t ZygoteHostImpl::ForkRequest( // Scoped pointers cannot be stored in containers, so we have to use a // linked_ptr. std::vector<linked_ptr<file_util::ScopedFD> > autodelete_fds; - for (std::vector<content::FileDescriptorInfo>::const_iterator + for (std::vector<FileDescriptorInfo>::const_iterator i = mapping.begin(); i != mapping.end(); ++i) { pickle.WriteUInt32(i->id); fds.push_back(i->fd.fd); @@ -446,7 +447,7 @@ void ZygoteHostImpl::EnsureProcessTerminated(pid_t process) { DCHECK(init_); Pickle pickle; - pickle.WriteInt(content::kZygoteCommandReap); + pickle.WriteInt(kZygoteCommandReap); pickle.WriteInt(process); if (!SendMessage(pickle, NULL)) LOG(ERROR) << "Failed to send Reap message to zygote"; @@ -457,12 +458,12 @@ base::TerminationStatus ZygoteHostImpl::GetTerminationStatus( int* exit_code) { DCHECK(init_); Pickle pickle; - pickle.WriteInt(content::kZygoteCommandGetTerminationStatus); + pickle.WriteInt(kZygoteCommandGetTerminationStatus); pickle.WriteInt(handle); // Set this now to handle the early termination cases. if (exit_code) - *exit_code = content::RESULT_CODE_NORMAL_EXIT; + *exit_code = RESULT_CODE_NORMAL_EXIT; static const unsigned kMaxMessageLength = 128; char buf[kMaxMessageLength]; @@ -510,3 +511,5 @@ int ZygoteHostImpl::GetSandboxStatus() const { return sandbox_status_; return 0; } + +} // namespace content diff --git a/content/browser/zygote_host/zygote_host_impl_linux.h b/content/browser/zygote_host/zygote_host_impl_linux.h index 8548a2b..8a6c778 100644 --- a/content/browser/zygote_host/zygote_host_impl_linux.h +++ b/content/browser/zygote_host/zygote_host_impl_linux.h @@ -17,7 +17,9 @@ template<typename Type> struct DefaultSingletonTraits; -class CONTENT_EXPORT ZygoteHostImpl : public content::ZygoteHost { +namespace content { + +class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { public: // Returns the singleton instance. static ZygoteHostImpl* GetInstance(); @@ -28,7 +30,7 @@ class CONTENT_EXPORT ZygoteHostImpl : public content::ZygoteHost { // Returns its pid on success, otherwise // base::kNullProcessHandle; pid_t ForkRequest(const std::vector<std::string>& command_line, - const std::vector<content::FileDescriptorInfo>& mapping, + const std::vector<FileDescriptorInfo>& mapping, const std::string& process_type); void EnsureProcessTerminated(pid_t process); @@ -72,4 +74,6 @@ class CONTENT_EXPORT ZygoteHostImpl : public content::ZygoteHost { int sandbox_status_; }; +} // namespace content + #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |