diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 21:31:26 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 21:31:26 +0000 |
commit | e9ff79ccdf72412480abf22860924c3eedcc61f0 (patch) | |
tree | c85c010a58d15374fc7fc2d31f9c8f33e3f74ae3 | |
parent | 5f23a1cf7f266005763a9c40ec4a422f7dc9b3bb (diff) | |
download | chromium_src-e9ff79ccdf72412480abf22860924c3eedcc61f0.zip chromium_src-e9ff79ccdf72412480abf22860924c3eedcc61f0.tar.gz chromium_src-e9ff79ccdf72412480abf22860924c3eedcc61f0.tar.bz2 |
Move a bunch of code in content\renderer to the content namespace.
Review URL: https://codereview.chromium.org/11232014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163061 0039d316-1c4b-4281-b951-d872f2087c98
113 files changed, 888 insertions, 670 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 13ee1bc..f84d096 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -95,15 +95,15 @@ extern int GpuMain(const content::MainFunctionParams&); extern int PluginMain(const content::MainFunctionParams&); extern int PpapiPluginMain(const content::MainFunctionParams&); extern int PpapiBrokerMain(const content::MainFunctionParams&); -extern int RendererMain(const content::MainFunctionParams&); extern int WorkerMain(const content::MainFunctionParams&); extern int UtilityMain(const content::MainFunctionParams&); -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) namespace content { +extern int RendererMain(const MainFunctionParams&); +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) extern int ZygoteMain(const MainFunctionParams&, ZygoteForkDelegate* forkdelegate); -} // namespace content #endif +} // namespace content namespace { #if defined(OS_WIN) diff --git a/content/public/renderer/render_view_observer.h b/content/public/renderer/render_view_observer.h index fd5ea95..6999159 100644 --- a/content/public/renderer/render_view_observer.h +++ b/content/public/renderer/render_view_observer.h @@ -12,8 +12,6 @@ #include "ipc/ipc_sender.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" -class RenderViewImpl; - namespace ppapi { namespace host { class PpapiHost; @@ -36,6 +34,7 @@ namespace content { class RendererPpapiHost; class RenderView; +class RenderViewImpl; // Base class for objects that want to filter incoming IPCs, and also get // notified of changes to the frame. @@ -107,7 +106,7 @@ class CONTENT_EXPORT RenderViewObserver : public IPC::Listener, int routing_id() { return routing_id_; } private: - friend class ::RenderViewImpl; + friend class RenderViewImpl; // This is called by the RenderView when it's going away so that this object // can null out its pointer. diff --git a/content/public/test/render_view_fake_resources_test.h b/content/public/test/render_view_fake_resources_test.h index 03afab5..789d3fc 100644 --- a/content/public/test/render_view_fake_resources_test.h +++ b/content/public/test/render_view_fake_resources_test.h @@ -53,7 +53,6 @@ #include "testing/gtest/include/gtest/gtest.h" class MockRenderProcess; -class RenderThreadImpl; struct ResourceHostMsg_Request; namespace WebKit { @@ -62,6 +61,7 @@ class WebHistoryItem; } namespace content { +class RenderThreadImpl; class RenderViewFakeResourcesTest : public ::testing::Test, public IPC::Listener, diff --git a/content/renderer/browser_plugin/browser_plugin_manager.h b/content/renderer/browser_plugin/browser_plugin_manager.h index 4720bb1..a55aaec 100644 --- a/content/renderer/browser_plugin/browser_plugin_manager.h +++ b/content/renderer/browser_plugin/browser_plugin_manager.h @@ -10,8 +10,6 @@ #include "content/public/renderer/render_process_observer.h" #include "ipc/ipc_sender.h" -class RenderViewImpl; - namespace WebKit { class WebFrame; struct WebPluginParams; @@ -20,6 +18,7 @@ struct WebPluginParams; namespace content { class BrowserPlugin; +class RenderViewImpl; // BrowserPluginManager manages the routing of messages to the appropriate // BrowserPlugin object based on its instance ID. There is only one diff --git a/content/renderer/device_orientation_dispatcher.cc b/content/renderer/device_orientation_dispatcher.cc index 42ce18d..df8d2e3 100644 --- a/content/renderer/device_orientation_dispatcher.cc +++ b/content/renderer/device_orientation_dispatcher.cc @@ -9,9 +9,12 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationController.h" +namespace content { + + DeviceOrientationDispatcher::DeviceOrientationDispatcher( RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), controller_(NULL), started_(false) { } @@ -91,3 +94,5 @@ void DeviceOrientationDispatcher::OnDeviceOrientationUpdated( last_orientation_.setAbsolute(p.absolute); controller_->didChangeDeviceOrientation(last_orientation_); } + +} // namespace content diff --git a/content/renderer/device_orientation_dispatcher.h b/content/renderer/device_orientation_dispatcher.h index d643166..39bc5f1 100644 --- a/content/renderer/device_orientation_dispatcher.h +++ b/content/renderer/device_orientation_dispatcher.h @@ -11,11 +11,12 @@ #include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_view_observer.h" -class RenderViewImpl; - struct DeviceOrientationMsg_Updated_Params; -class DeviceOrientationDispatcher : public content::RenderViewObserver, +namespace content { +class RenderViewImpl; + +class DeviceOrientationDispatcher : public RenderViewObserver, public WebKit::WebDeviceOrientationClient { public: explicit DeviceOrientationDispatcher(RenderViewImpl* render_view); @@ -40,4 +41,6 @@ class DeviceOrientationDispatcher : public content::RenderViewObserver, bool started_; }; +} // namespace content + #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ diff --git a/content/renderer/devtools_agent.cc b/content/renderer/devtools_agent.cc index dbb1bce..91fc3b3 100644 --- a/content/renderer/devtools_agent.cc +++ b/content/renderer/devtools_agent.cc @@ -37,6 +37,8 @@ using WebKit::WebCString; using WebKit::WebVector; using WebKit::WebView; +namespace content { + namespace { class WebKitClientMessageLoopImpl @@ -64,8 +66,7 @@ base::LazyInstance<IdToAgentMap>::Leaky } // namespace DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), - is_attached_(false) { + : RenderViewObserver(render_view), is_attached_(false) { g_agent_for_routing_id.Get()[routing_id()] = this; render_view->webview()->setDevToolsAgentClient(this); @@ -189,7 +190,7 @@ void DevToolsAgent::OnInspectElement(int x, int y) { } } -void DevToolsAgent::OnAddMessageToConsole(content::ConsoleMessageLevel level, +void DevToolsAgent::OnAddMessageToConsole(ConsoleMessageLevel level, const std::string& message) { WebView* web_view = render_view()->GetWebView(); if (!web_view) @@ -201,16 +202,16 @@ void DevToolsAgent::OnAddMessageToConsole(content::ConsoleMessageLevel level, WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; switch (level) { - case content::CONSOLE_MESSAGE_LEVEL_TIP: + case CONSOLE_MESSAGE_LEVEL_TIP: target_level = WebConsoleMessage::LevelTip; break; - case content::CONSOLE_MESSAGE_LEVEL_LOG: + case CONSOLE_MESSAGE_LEVEL_LOG: target_level = WebConsoleMessage::LevelLog; break; - case content::CONSOLE_MESSAGE_LEVEL_WARNING: + case CONSOLE_MESSAGE_LEVEL_WARNING: target_level = WebConsoleMessage::LevelWarning; break; - case content::CONSOLE_MESSAGE_LEVEL_ERROR: + case CONSOLE_MESSAGE_LEVEL_ERROR: target_level = WebConsoleMessage::LevelError; break; } @@ -240,3 +241,5 @@ WebDevToolsAgent* DevToolsAgent::GetWebAgent() { bool DevToolsAgent::IsAttached() { return is_attached_; } + +} // namespace content diff --git a/content/renderer/devtools_agent.h b/content/renderer/devtools_agent.h index 94f403a..219a767 100644 --- a/content/renderer/devtools_agent.h +++ b/content/renderer/devtools_agent.h @@ -12,17 +12,18 @@ #include "content/public/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h" -class RenderViewImpl; - namespace WebKit { class WebDevToolsAgent; } +namespace content { +class RenderViewImpl; + // DevToolsAgent belongs to the inspectable RenderView and provides Glue's // agents with the communication capabilities. All messages from/to Glue's // agents infrastructure are flowing through this communication agent. // There is a corresponding DevToolsClient object on the client side. -class DevToolsAgent : public content::RenderViewObserver, +class DevToolsAgent : public RenderViewObserver, public WebKit::WebDevToolsAgentClient { public: explicit DevToolsAgent(RenderViewImpl* render_view); @@ -57,7 +58,7 @@ class DevToolsAgent : public content::RenderViewObserver, void OnDetach(); void OnDispatchOnInspectorBackend(const std::string& message); void OnInspectElement(int x, int y); - void OnAddMessageToConsole(content::ConsoleMessageLevel level, + void OnAddMessageToConsole(ConsoleMessageLevel level, const std::string& message); void ContinueProgram(); void OnSetupDevToolsClient(); @@ -67,4 +68,6 @@ class DevToolsAgent : public content::RenderViewObserver, DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); }; +} // namespace content + #endif // CONTENT_RENDERER_DEVTOOLS_AGENT_H_ diff --git a/content/renderer/devtools_agent_filter.cc b/content/renderer/devtools_agent_filter.cc index a45c63d..f640c59 100644 --- a/content/renderer/devtools_agent_filter.cc +++ b/content/renderer/devtools_agent_filter.cc @@ -15,6 +15,8 @@ using WebKit::WebDevToolsAgent; using WebKit::WebString; +namespace content { + namespace { class MessageImpl : public WebDevToolsAgent::MessageDescriptor { @@ -71,3 +73,5 @@ void DevToolsAgentFilter::OnDispatchOnInspectorBackend( render_thread_loop_->PostTask( FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages)); } + +} // namespace content diff --git a/content/renderer/devtools_agent_filter.h b/content/renderer/devtools_agent_filter.h index ed8f67b..627f749 100644 --- a/content/renderer/devtools_agent_filter.h +++ b/content/renderer/devtools_agent_filter.h @@ -12,6 +12,8 @@ class MessageLoop; struct DevToolsMessageData; +namespace content { + // DevToolsAgentFilter is registered as an IPC filter in order to be able to // dispatch messages while on the IO thread. The reason for that is that while // debugging, Render thread is being held by the v8 and hence no messages @@ -41,4 +43,6 @@ class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter); }; +} // namespace content + #endif // CONTENT_RENDERER_DEVTOOLS_AGENT_FILTER_H_ diff --git a/content/renderer/devtools_client.cc b/content/renderer/devtools_client.cc index 5a2677c..1e80381 100644 --- a/content/renderer/devtools_client.cc +++ b/content/renderer/devtools_client.cc @@ -19,8 +19,10 @@ using WebKit::WebDevToolsFrontend; using WebKit::WebString; +namespace content { + DevToolsClient::DevToolsClient(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view) { + : RenderViewObserver(render_view) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); web_tools_frontend_.reset( WebDevToolsFrontend::create( @@ -104,3 +106,5 @@ void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { web_tools_frontend_->dispatchOnInspectorFrontend( WebString::fromUTF8(message)); } + +} // namespace content diff --git a/content/renderer/devtools_client.h b/content/renderer/devtools_client.h index e5113260..2da7431 100644 --- a/content/renderer/devtools_client.h +++ b/content/renderer/devtools_client.h @@ -12,20 +12,22 @@ #include "content/public/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h" -class RenderViewImpl; - namespace WebKit { class WebDevToolsFrontend; class WebString; } +namespace content { + +class RenderViewImpl; + // Developer tools UI end of communication channel between the render process of // the page being inspected and tools UI renderer process. All messages will // go through browser process. On the side of the inspected page there's // corresponding DevToolsAgent object. // TODO(yurys): now the client is almost empty later it will delegate calls to // code in glue -class DevToolsClient : public content::RenderViewObserver, +class DevToolsClient : public RenderViewObserver, public WebKit::WebDevToolsFrontendClient { public: explicit DevToolsClient(RenderViewImpl* render_view); @@ -59,4 +61,6 @@ class DevToolsClient : public content::RenderViewObserver, DISALLOW_COPY_AND_ASSIGN(DevToolsClient); }; +} // namespace content + #endif // CONTENT_RENDERER_DEVTOOLS_CLIENT_H_ diff --git a/content/renderer/do_not_track_bindings.cc b/content/renderer/do_not_track_bindings.cc index 98fb287..0c2731b 100644 --- a/content/renderer/do_not_track_bindings.cc +++ b/content/renderer/do_not_track_bindings.cc @@ -10,6 +10,8 @@ using WebKit::WebFrame; +namespace content { + namespace { v8::Handle<v8::Value> GetDoNotTrack(v8::Local<v8::String> property, @@ -27,8 +29,6 @@ v8::Handle<v8::Value> GetDoNotTrack(v8::Local<v8::String> property, } // namespace -namespace content { - void InjectDoNotTrackBindings(WebFrame* frame) { v8::HandleScope handle_scope; diff --git a/content/renderer/dom_storage/dom_storage_dispatcher.cc b/content/renderer/dom_storage/dom_storage_dispatcher.cc index 6df003a..86bdaf9 100644 --- a/content/renderer/dom_storage/dom_storage_dispatcher.cc +++ b/content/renderer/dom_storage/dom_storage_dispatcher.cc @@ -24,6 +24,8 @@ using dom_storage::DomStorageCachedArea; using dom_storage::DomStorageProxy; using dom_storage::ValuesMap; +namespace content { + namespace { // MessageThrottlingFilter ------------------------------------------- // Used to limit the number of ipc messages pending completion so we @@ -334,3 +336,5 @@ void DomStorageDispatcher::OnStorageEvent( void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { proxy_->CompleteOnePendingCallback(success); } + +} // namespace content diff --git a/content/renderer/dom_storage/dom_storage_dispatcher.h b/content/renderer/dom_storage/dom_storage_dispatcher.h index c987b14..f2498f7 100644 --- a/content/renderer/dom_storage/dom_storage_dispatcher.h +++ b/content/renderer/dom_storage/dom_storage_dispatcher.h @@ -16,6 +16,8 @@ namespace IPC { class Message; } +namespace content { + // Dispatches DomStorage related messages sent to a renderer process from the // main browser process. There is one instance per child process. Messages // are dispatched on the main renderer thread. The RenderThreadImpl @@ -44,4 +46,6 @@ class DomStorageDispatcher { scoped_refptr<ProxyImpl> proxy_; }; +} // namespace content + #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ diff --git a/content/renderer/dom_storage/webstoragearea_impl.cc b/content/renderer/dom_storage/webstoragearea_impl.cc index 1b16cfc..ed94bbb 100644 --- a/content/renderer/dom_storage/webstoragearea_impl.cc +++ b/content/renderer/dom_storage/webstoragearea_impl.cc @@ -18,6 +18,8 @@ using dom_storage::DomStorageCachedArea; using WebKit::WebString; using WebKit::WebURL; +namespace content { + namespace { typedef IDMap<WebStorageAreaImpl> AreaImplMap; base::LazyInstance<AreaImplMap>::Leaky @@ -80,3 +82,5 @@ void WebStorageAreaImpl::clear(const WebURL& page_url) { size_t WebStorageAreaImpl::memoryBytesUsedByCache() const { return cached_area_->MemoryBytesUsedByCache(); } + +} // namespace content diff --git a/content/renderer/dom_storage/webstoragearea_impl.h b/content/renderer/dom_storage/webstoragearea_impl.h index 2d16ba6..8b79406 100644 --- a/content/renderer/dom_storage/webstoragearea_impl.h +++ b/content/renderer/dom_storage/webstoragearea_impl.h @@ -16,6 +16,8 @@ namespace dom_storage { class DomStorageCachedArea; } +namespace content { + class WebStorageAreaImpl : public WebKit::WebStorageArea { public: static WebStorageAreaImpl* FromConnectionId(int id); @@ -40,4 +42,6 @@ class WebStorageAreaImpl : public WebKit::WebStorageArea { scoped_refptr<dom_storage::DomStorageCachedArea> cached_area_; }; +} // namespace content + #endif // CONTENT_RENDERER_DOM_STORAGE_WEBSTORAGEAREA_IMPL_H_ diff --git a/content/renderer/dom_storage/webstoragenamespace_impl.cc b/content/renderer/dom_storage/webstoragenamespace_impl.cc index b718708..427898f 100644 --- a/content/renderer/dom_storage/webstoragenamespace_impl.cc +++ b/content/renderer/dom_storage/webstoragenamespace_impl.cc @@ -14,6 +14,8 @@ using WebKit::WebStorageArea; using WebKit::WebStorageNamespace; using WebKit::WebString; +namespace content { + WebStorageNamespaceImpl::WebStorageNamespaceImpl() : namespace_id_(dom_storage::kLocalStorageNamespaceId) { } @@ -46,3 +48,5 @@ bool WebStorageNamespaceImpl::isSameNamespace( static_cast<const WebStorageNamespaceImpl*>(&other); return namespace_id_ == other_impl->namespace_id_; } + +} // namespace content diff --git a/content/renderer/dom_storage/webstoragenamespace_impl.h b/content/renderer/dom_storage/webstoragenamespace_impl.h index 1e0d7b2..f4d4680 100644 --- a/content/renderer/dom_storage/webstoragenamespace_impl.h +++ b/content/renderer/dom_storage/webstoragenamespace_impl.h @@ -8,6 +8,8 @@ #include "base/basictypes.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" +namespace content { + class WebStorageNamespaceImpl : public WebKit::WebStorageNamespace { public: // The default constructor creates a local storage namespace, the second @@ -26,4 +28,6 @@ class WebStorageNamespaceImpl : public WebKit::WebStorageNamespace { int64 namespace_id_; }; +} // namespace content + #endif // CONTENT_RENDERER_DOM_STORAGE_WEBSTORAGENAMESPACE_IMPL_H_ diff --git a/content/renderer/external_popup_menu.cc b/content/renderer/external_popup_menu.cc index 218bb33..fab79f2 100644 --- a/content/renderer/external_popup_menu.cc +++ b/content/renderer/external_popup_menu.cc @@ -9,6 +9,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebExternalPopupMenuClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" +namespace content { + ExternalPopupMenu::ExternalPopupMenu( RenderViewImpl* render_view, const WebKit::WebPopupMenuInfo& popup_menu_info, @@ -61,3 +63,4 @@ void ExternalPopupMenu::DidSelectItems(bool canceled, } #endif +} // namespace content diff --git a/content/renderer/external_popup_menu.h b/content/renderer/external_popup_menu.h index f039fcf..d701ddc 100644 --- a/content/renderer/external_popup_menu.h +++ b/content/renderer/external_popup_menu.h @@ -11,11 +11,13 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebExternalPopupMenu.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" -class RenderViewImpl; namespace WebKit { class WebExternalPopupMenuClient; } +namespace content { +class RenderViewImpl; + class ExternalPopupMenu : public WebKit::WebExternalPopupMenu { public: ExternalPopupMenu(RenderViewImpl* render_view, @@ -47,4 +49,6 @@ class ExternalPopupMenu : public WebKit::WebExternalPopupMenu { DISALLOW_COPY_AND_ASSIGN(ExternalPopupMenu); }; +} // namespace content + #endif // CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ diff --git a/content/renderer/external_popup_menu_browsertest.cc b/content/renderer/external_popup_menu_browsertest.cc index 296d39d..fe37e14 100644 --- a/content/renderer/external_popup_menu_browsertest.cc +++ b/content/renderer/external_popup_menu_browsertest.cc @@ -12,6 +12,7 @@ // Tests for the external select popup menu (Mac specific). +namespace content { namespace { const char* const kSelectID = "mySelect"; @@ -19,7 +20,7 @@ const char* const kEmptySelectID = "myEmptySelect"; } // namespace -class ExternalPopupMenuTest : public content::RenderViewTest { +class ExternalPopupMenuTest : public RenderViewTest { public: ExternalPopupMenuTest() {} @@ -28,7 +29,7 @@ class ExternalPopupMenuTest : public content::RenderViewTest { } virtual void SetUp() { - content::RenderViewTest::SetUp(); + RenderViewTest::SetUp(); // We need to set this explictly as RenderMain is not run. WebKit::WebView::setUseExternalPopupMenus(true); @@ -143,3 +144,5 @@ TEST_F(ExternalPopupMenuRemoveTest, RemoveOnChange) { // It should return false as the select has been removed. EXPECT_FALSE(SimulateElementClick(kSelectID)); } + +} // namespace content diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc index 9551a2f..3070cbd 100644 --- a/content/renderer/geolocation_dispatcher.cc +++ b/content/renderer/geolocation_dispatcher.cc @@ -20,8 +20,10 @@ using WebKit::WebGeolocationPermissionRequest; using WebKit::WebGeolocationPermissionRequestManager; using WebKit::WebGeolocationPosition; +namespace content { + GeolocationDispatcher::GeolocationDispatcher(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), pending_permissions_(new WebGeolocationPermissionRequestManager()), enable_high_accuracy_(false), updating_(false) { @@ -113,7 +115,7 @@ void GeolocationDispatcher::OnPermissionSet(int bridge_id, bool is_allowed) { // We have an updated geolocation position or error code. void GeolocationDispatcher::OnPositionUpdated( - const content::Geoposition& geoposition) { + const Geoposition& geoposition) { // It is possible for the browser process to have queued an update message // before receiving the stop updating message. if (!updating_) @@ -137,10 +139,10 @@ void GeolocationDispatcher::OnPositionUpdated( } else { WebGeolocationError::Error code; switch (geoposition.error_code) { - case content::Geoposition::ERROR_CODE_PERMISSION_DENIED: + case Geoposition::ERROR_CODE_PERMISSION_DENIED: code = WebGeolocationError::ErrorPermissionDenied; break; - case content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE: + case Geoposition::ERROR_CODE_POSITION_UNAVAILABLE: code = WebGeolocationError::ErrorPositionUnavailable; break; default: @@ -152,3 +154,5 @@ void GeolocationDispatcher::OnPositionUpdated( code, WebKit::WebString::fromUTF8(geoposition.error_message))); } } + +} // namespace content diff --git a/content/renderer/geolocation_dispatcher.h b/content/renderer/geolocation_dispatcher.h index 53f45be..7ce2b6a 100644 --- a/content/renderer/geolocation_dispatcher.h +++ b/content/renderer/geolocation_dispatcher.h @@ -10,12 +10,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationController.h" -class RenderViewImpl; - -namespace content { -struct Geoposition; -} - namespace WebKit { class WebGeolocationController; class WebGeolocationPermissionRequest; @@ -23,10 +17,14 @@ class WebGeolocationPermissionRequestManager; class WebGeolocationPosition; } +namespace content { +class RenderViewImpl; +struct Geoposition; + // GeolocationDispatcher is a delegate for Geolocation messages used by // WebKit. // It's the complement of GeolocationDispatcherHost (owned by RenderViewHost). -class GeolocationDispatcher : public content::RenderViewObserver, +class GeolocationDispatcher : public RenderViewObserver, public WebKit::WebGeolocationClient { public: explicit GeolocationDispatcher(RenderViewImpl* render_view); @@ -65,4 +63,6 @@ class GeolocationDispatcher : public content::RenderViewObserver, bool updating_; }; +} // namespace content + #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc index e50a1e9..71a4be8 100644 --- a/content/renderer/gpu/compositor_output_surface.cc +++ b/content/renderer/gpu/compositor_output_surface.cc @@ -15,6 +15,8 @@ using WebKit::WebGraphicsContext3D; using WebKit::WebCompositorSoftwareOutputDevice; +namespace content { + //------------------------------------------------------------------------------ // static @@ -112,3 +114,5 @@ void CompositorOutputSurface::OnUpdateVSyncParameters( static_cast<double>(base::Time::kMicrosecondsPerSecond); client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); } + +} // namespace content diff --git a/content/renderer/gpu/compositor_output_surface.h b/content/renderer/gpu/compositor_output_surface.h index edff940..ca7f5d5 100644 --- a/content/renderer/gpu/compositor_output_surface.h +++ b/content/renderer/gpu/compositor_output_surface.h @@ -19,16 +19,17 @@ namespace base { } namespace IPC { - class ForwardingMessageFilter; - class Message; - class SyncChannel; +class ForwardingMessageFilter; +class Message; } +namespace content { + // This class can be created only on the main thread, but then becomes pinned // to a fixed thread when bindToClient is called. class CompositorOutputSurface - : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputSurface) - , NON_EXPORTED_BASE(public base::NonThreadSafe) { + : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputSurface), + NON_EXPORTED_BASE(public base::NonThreadSafe) { public: static IPC::ForwardingMessageFilter* CreateFilter( base::TaskRunner* target_task_runner); @@ -81,4 +82,6 @@ class CompositorOutputSurface scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice> software_device_; }; +} // namespace content + #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ diff --git a/content/renderer/gpu/compositor_thread.cc b/content/renderer/gpu/compositor_thread.cc index b52e485..815d1c2 100644 --- a/content/renderer/gpu/compositor_thread.cc +++ b/content/renderer/gpu/compositor_thread.cc @@ -15,6 +15,8 @@ using WebKit::WebCompositorInputHandler; using WebKit::WebInputEvent; +namespace content { + //------------------------------------------------------------------------------ class CompositorThread::InputHandlerWrapper @@ -163,3 +165,5 @@ void CompositorThread::HandleInputEvent( it->second->input_handler()->handleInputEvent(*input_event); } + +} // namespace content diff --git a/content/renderer/gpu/compositor_thread.h b/content/renderer/gpu/compositor_thread.h index aeebd98..a69e831 100644 --- a/content/renderer/gpu/compositor_thread.h +++ b/content/renderer/gpu/compositor_thread.h @@ -19,6 +19,8 @@ class WebInputEvent; class InputEventFilter; +namespace content { + // The CompositorThread class manages the background thread for the compositor. // The CompositorThread instance can be assumed to outlive the background // thread it manages. @@ -68,4 +70,6 @@ class CompositorThread { scoped_refptr<InputEventFilter> filter_; }; +} // namespace content + #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ diff --git a/content/renderer/idle_user_detector.cc b/content/renderer/idle_user_detector.cc index e489fd5..2b635b5 100644 --- a/content/renderer/idle_user_detector.cc +++ b/content/renderer/idle_user_detector.cc @@ -9,8 +9,10 @@ #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/render_thread_impl.h" -IdleUserDetector::IdleUserDetector(content::RenderView* render_view) - : content::RenderViewObserver(render_view){ +namespace content { + +IdleUserDetector::IdleUserDetector(RenderView* render_view) + : RenderViewObserver(render_view){ } IdleUserDetector::~IdleUserDetector() { @@ -24,11 +26,12 @@ bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) { } void IdleUserDetector::OnHandleInputEvent(const IPC::Message& message) { - if (content::GetContentClient()->renderer()-> - RunIdleHandlerWhenWidgetsHidden()) { + if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { RenderThreadImpl* render_thread = RenderThreadImpl::current(); if (render_thread != NULL) { render_thread->PostponeIdleNotification(); } } } + +} // namespace content diff --git a/content/renderer/idle_user_detector.h b/content/renderer/idle_user_detector.h index 5bef3b5..7eead12 100644 --- a/content/renderer/idle_user_detector.h +++ b/content/renderer/idle_user_detector.h @@ -8,11 +8,13 @@ #include "base/basictypes.h" #include "content/public/renderer/render_view_observer.h" +namespace content { + // Class which observes user input events and postpones // idle notifications if the user is active. -class IdleUserDetector : public content::RenderViewObserver { +class IdleUserDetector : public RenderViewObserver { public: - IdleUserDetector(content::RenderView* render_view); + IdleUserDetector(RenderView* render_view); virtual ~IdleUserDetector(); private: @@ -24,4 +26,6 @@ class IdleUserDetector : public content::RenderViewObserver { DISALLOW_COPY_AND_ASSIGN(IdleUserDetector); }; +} // namespace content + #endif // CONTENT_RENDERER_IDLE_USER_DETECTOR_H_ diff --git a/content/renderer/input_tag_speech_dispatcher.cc b/content/renderer/input_tag_speech_dispatcher.cc index 11c868f..7caa3b0 100644 --- a/content/renderer/input_tag_speech_dispatcher.cc +++ b/content/renderer/input_tag_speech_dispatcher.cc @@ -25,10 +25,12 @@ using WebKit::WebInputElement; using WebKit::WebNode; using WebKit::WebView; +namespace content { + InputTagSpeechDispatcher::InputTagSpeechDispatcher( RenderViewImpl* render_view, WebKit::WebSpeechInputListener* listener) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), listener_(listener) { } @@ -85,7 +87,7 @@ void InputTagSpeechDispatcher::stopRecording(int request_id) { void InputTagSpeechDispatcher::OnSpeechRecognitionResult( int request_id, - const content::SpeechRecognitionResult& result) { + const SpeechRecognitionResult& result) { VLOG(1) << "InputTagSpeechDispatcher::OnSpeechRecognitionResult enter"; WebKit::WebSpeechInputResultArray webkit_result(result.hypotheses.size()); for (size_t i = 0; i < result.hypotheses.size(); ++i) { @@ -138,3 +140,5 @@ void InputTagSpeechDispatcher::OnSpeechRecognitionToggleSpeechInput() { input_element->stopSpeechInput(); } } + +} // namespace content diff --git a/content/renderer/input_tag_speech_dispatcher.h b/content/renderer/input_tag_speech_dispatcher.h index dca92ab..eb89e11 100644 --- a/content/renderer/input_tag_speech_dispatcher.h +++ b/content/renderer/input_tag_speech_dispatcher.h @@ -9,19 +9,17 @@ #include "content/public/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputController.h" -class RenderViewImpl; - -namespace content { -struct SpeechRecognitionResult; -} - namespace WebKit { class WebSpeechInputListener; } +namespace content { +class RenderViewImpl; +struct SpeechRecognitionResult; + // InputTagSpeechDispatcher is a delegate for messages used by WebKit. It's // the complement of InputTagSpeechDispatcherHost (owned by RenderViewHost). -class InputTagSpeechDispatcher : public content::RenderViewObserver, +class InputTagSpeechDispatcher : public RenderViewObserver, public WebKit::WebSpeechInputController { public: InputTagSpeechDispatcher(RenderViewImpl* render_view, @@ -42,7 +40,7 @@ class InputTagSpeechDispatcher : public content::RenderViewObserver, virtual void stopRecording(int request_id); void OnSpeechRecognitionResult( - int request_id, const content::SpeechRecognitionResult& result); + int request_id, const SpeechRecognitionResult& result); void OnSpeechRecordingComplete(int request_id); void OnSpeechRecognitionComplete(int request_id); void OnSpeechRecognitionToggleSpeechInput(); @@ -52,4 +50,6 @@ class InputTagSpeechDispatcher : public content::RenderViewObserver, DISALLOW_COPY_AND_ASSIGN(InputTagSpeechDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_INPUT_TAG_SPEECH_DISPATCHER_H_ diff --git a/content/renderer/load_progress_tracker.cc b/content/renderer/load_progress_tracker.cc index b7a14ba..0e7b07d 100644 --- a/content/renderer/load_progress_tracker.cc +++ b/content/renderer/load_progress_tracker.cc @@ -9,6 +9,7 @@ #include "content/common/view_messages.h" #include "content/renderer/render_view_impl.h" +namespace content { namespace { const int kMinimumDelayBetweenUpdatesMS = 100; @@ -87,3 +88,5 @@ void LoadProgressTracker::ResetStates() { weak_factory_.InvalidateWeakPtrs(); last_time_progress_sent_ = base::TimeTicks(); } + +} // namespace content diff --git a/content/renderer/load_progress_tracker.h b/content/renderer/load_progress_tracker.h index f386f91..cfcd5a8 100644 --- a/content/renderer/load_progress_tracker.h +++ b/content/renderer/load_progress_tracker.h @@ -9,12 +9,13 @@ #include "base/memory/weak_ptr.h" #include "base/time.h" -class RenderViewImpl; - namespace WebKit { class WebFrame; } +namespace content { +class RenderViewImpl; + class LoadProgressTracker { public: explicit LoadProgressTracker(RenderViewImpl* render_view); @@ -42,4 +43,6 @@ class LoadProgressTracker { DISALLOW_COPY_AND_ASSIGN(LoadProgressTracker); }; +} // namespace content + #endif // CONTENT_RENDERER_LOAD_PROGRESS_TRACKER_H_ diff --git a/content/renderer/media/audio_hardware.cc b/content/renderer/media/audio_hardware.cc index f0ff736..3e863c6 100644 --- a/content/renderer/media/audio_hardware.cc +++ b/content/renderer/media/audio_hardware.cc @@ -8,6 +8,7 @@ #include "content/common/view_messages.h" #include "content/renderer/render_thread_impl.h" +using content::RenderThreadImpl; using media::ChannelLayout; using media::CHANNEL_LAYOUT_NONE; diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc index 738581f..a6a3d8e 100644 --- a/content/renderer/media/media_stream_dependency_factory.cc +++ b/content/renderer/media/media_stream_dependency_factory.cc @@ -182,18 +182,18 @@ bool MediaStreamDependencyFactory::CreateNativeLocalMediaStream( video_track->set_enabled(video_components[i].isEnabled()); } - description->setExtraData(new MediaStreamExtraData(native_stream)); + description->setExtraData(new content::MediaStreamExtraData(native_stream)); return true; } bool MediaStreamDependencyFactory::CreateNativeLocalMediaStream( WebKit::WebMediaStreamDescriptor* description, - const MediaStreamExtraData::StreamStopCallback& stream_stop) { + const content::MediaStreamExtraData::StreamStopCallback& stream_stop) { if (!CreateNativeLocalMediaStream(description)) return false; - MediaStreamExtraData* extra_data = - static_cast<MediaStreamExtraData*>(description->extraData()); + content::MediaStreamExtraData* extra_data = + static_cast<content::MediaStreamExtraData*>(description->extraData()); extra_data->SetLocalStreamStopCallback(stream_stop); return true; } @@ -201,7 +201,7 @@ bool MediaStreamDependencyFactory::CreateNativeLocalMediaStream( bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { if (!pc_factory_.get()) { DCHECK(!audio_device_); - audio_device_ = new WebRtcAudioDeviceImpl(); + audio_device_ = new content::WebRtcAudioDeviceImpl(); scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( webrtc::CreatePeerConnectionFactory(worker_thread_, signaling_thread_, diff --git a/content/renderer/media/media_stream_dependency_factory.h b/content/renderer/media/media_stream_dependency_factory.h index faa0086..1ab19dd 100644 --- a/content/renderer/media/media_stream_dependency_factory.h +++ b/content/renderer/media/media_stream_dependency_factory.h @@ -22,6 +22,7 @@ class WaitableEvent; namespace content { class IpcNetworkManager; class IpcPacketSocketFactory; +class WebRtcAudioDeviceImpl; } namespace talk_base { @@ -44,7 +45,6 @@ class WebRTCPeerConnectionHandlerClient; } class VideoCaptureImplManager; -class WebRtcAudioDeviceImpl; // Object factory for RTC MediaStreams and RTC PeerConnections. class CONTENT_EXPORT MediaStreamDependencyFactory @@ -76,7 +76,7 @@ class CONTENT_EXPORT MediaStreamDependencyFactory // stopped. bool CreateNativeLocalMediaStream( WebKit::WebMediaStreamDescriptor* description, - const MediaStreamExtraData::StreamStopCallback& stream_stop); + const content::MediaStreamExtraData::StreamStopCallback& stream_stop); // Asks the libjingle PeerConnection factory to create a libjingle // PeerConnection object. @@ -149,7 +149,7 @@ class CONTENT_EXPORT MediaStreamDependencyFactory scoped_refptr<VideoCaptureImplManager> vc_manager_; scoped_refptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_; - scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; + scoped_refptr<content::WebRtcAudioDeviceImpl> audio_device_; // PeerConnection threads. signaling_thread_ is created from the // "current" chrome thread. diff --git a/content/renderer/media/media_stream_dependency_factory_unittest.cc b/content/renderer/media/media_stream_dependency_factory_unittest.cc index 5d0f7ba..3922beb 100644 --- a/content/renderer/media/media_stream_dependency_factory_unittest.cc +++ b/content/renderer/media/media_stream_dependency_factory_unittest.cc @@ -82,8 +82,8 @@ TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStream) { true); EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc)); - MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( - stream_desc.extraData()); + content::MediaStreamExtraData* extra_data = + static_cast<content::MediaStreamExtraData*>(stream_desc.extraData()); ASSERT_TRUE(extra_data && extra_data->local_stream()); EXPECT_EQ(1u, extra_data->local_stream()->audio_tracks()->count()); EXPECT_EQ(1u, extra_data->local_stream()->video_tracks()->count()); @@ -108,8 +108,8 @@ TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStreamWithoutSource) { stream_desc.initialize("new stream", audio_sources, video_sources); EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc)); - MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( - stream_desc.extraData()); + content::MediaStreamExtraData* extra_data = + static_cast<content::MediaStreamExtraData*>(stream_desc.extraData()); ASSERT_TRUE(extra_data && extra_data->local_stream()); EXPECT_EQ(0u, extra_data->local_stream()->video_tracks()->count()); EXPECT_EQ(0u, extra_data->local_stream()->audio_tracks()->count()); diff --git a/content/renderer/media/media_stream_dispatcher.cc b/content/renderer/media/media_stream_dispatcher.cc index 060fa60..b9ef2a5 100644 --- a/content/renderer/media/media_stream_dispatcher.cc +++ b/content/renderer/media/media_stream_dispatcher.cc @@ -10,6 +10,8 @@ #include "content/renderer/render_view_impl.h" #include "googleurl/src/gurl.h" +namespace content { + struct MediaStreamDispatcher::Request { Request(const base::WeakPtr<MediaStreamDispatcherEventHandler>& handler, int request_id, @@ -59,7 +61,7 @@ struct MediaStreamDispatcher::EnumerationState::CachedDevices { }; MediaStreamDispatcher::MediaStreamDispatcher(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), main_loop_(base::MessageLoopProxy::current()), next_ipc_id_(0) { } @@ -117,13 +119,13 @@ void MediaStreamDispatcher::EnumerateDevices( media_stream::MediaStreamType type, const GURL& security_origin) { DCHECK(main_loop_->BelongsToCurrentThread()); - DCHECK(type == content::MEDIA_DEVICE_AUDIO_CAPTURE || - type == content::MEDIA_DEVICE_VIDEO_CAPTURE); + DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || + type == MEDIA_DEVICE_VIDEO_CAPTURE); DVLOG(1) << "MediaStreamDispatcher::EnumerateDevices(" << request_id << ")"; EnumerationState* state = - (type == content::MEDIA_DEVICE_AUDIO_CAPTURE ? + (type == MEDIA_DEVICE_AUDIO_CAPTURE ? &audio_enumeration_state_ : &video_enumeration_state_); state->requests.push_back(EnumerationRequest(event_handler, request_id)); @@ -328,9 +330,9 @@ void MediaStreamDispatcher::OnDeviceOpened( if (request.ipc_request == request_id) { Stream new_stream; new_stream.handler = request.handler; - if (content::IsAudioMediaType(device_info.stream_type)) { + if (IsAudioMediaType(device_info.stream_type)) { new_stream.audio_array.push_back(device_info); - } else if (content::IsVideoMediaType(device_info.stream_type)) { + } else if (IsVideoMediaType(device_info.stream_type)) { new_stream.video_array.push_back(device_info); } else { NOTREACHED(); @@ -388,3 +390,5 @@ int MediaStreamDispatcher::video_session_id(const std::string& label, DCHECK_GT(it->second.video_array.size(), static_cast<size_t>(index)); return it->second.video_array[index].session_id; } + +} // namespace content diff --git a/content/renderer/media/media_stream_dispatcher.h b/content/renderer/media/media_stream_dispatcher.h index a5a4c07..877271a 100644 --- a/content/renderer/media/media_stream_dispatcher.h +++ b/content/renderer/media/media_stream_dispatcher.h @@ -22,6 +22,8 @@ namespace base { class MessageLoopProxy; } +namespace content { + class RenderViewImpl; // MediaStreamDispatcher is a delegate for the Media Stream API messages. @@ -30,7 +32,7 @@ class RenderViewImpl; // It's the complement of MediaStreamDispatcherHost (owned by // BrowserRenderProcessHost). class CONTENT_EXPORT MediaStreamDispatcher - : public content::RenderViewObserver, + : public RenderViewObserver, public base::SupportsWeakPtr<MediaStreamDispatcher> { public: explicit MediaStreamDispatcher(RenderViewImpl* render_view); @@ -161,4 +163,6 @@ class CONTENT_EXPORT MediaStreamDispatcher DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ diff --git a/content/renderer/media/media_stream_dispatcher_unittest.cc b/content/renderer/media/media_stream_dispatcher_unittest.cc index 342e918..1bf9853 100644 --- a/content/renderer/media/media_stream_dispatcher_unittest.cc +++ b/content/renderer/media/media_stream_dispatcher_unittest.cc @@ -14,6 +14,7 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { namespace { const int kRouteId = 0; @@ -25,12 +26,9 @@ const int kRequestId3 = 30; const int kRequestId4 = 40; static const char kLabel[] = "test"; -const content::MediaStreamDeviceType kAudioType = - content::MEDIA_DEVICE_AUDIO_CAPTURE; -const content::MediaStreamDeviceType kVideoType = - content::MEDIA_DEVICE_VIDEO_CAPTURE; -const content::MediaStreamDeviceType kNoAudioType = - content::MEDIA_NO_SERVICE; +const MediaStreamDeviceType kAudioType = MEDIA_DEVICE_AUDIO_CAPTURE; +const MediaStreamDeviceType kVideoType = MEDIA_DEVICE_VIDEO_CAPTURE; +const MediaStreamDeviceType kNoAudioType = MEDIA_NO_SERVICE; class MockMediaStreamDispatcherEventHandler : public MediaStreamDispatcherEventHandler, @@ -408,3 +406,5 @@ TEST(MediaStreamDispatcherTest, CancelGenerateStream) { EXPECT_EQ(handler->label_, stream_label1); EXPECT_EQ(0u, dispatcher->requests_.size()); } + +} // namespace content diff --git a/content/renderer/media/media_stream_extra_data.h b/content/renderer/media/media_stream_extra_data.h index a94e730..984e16c 100644 --- a/content/renderer/media/media_stream_extra_data.h +++ b/content/renderer/media/media_stream_extra_data.h @@ -16,6 +16,8 @@ class MediaStreamInterface; class LocalMediaStreamInterface; } // namespace webrtc +namespace content { + class CONTENT_EXPORT MediaStreamExtraData : NON_EXPORTED_BASE(public WebKit::WebMediaStreamDescriptor::ExtraData) { public: @@ -43,4 +45,6 @@ class CONTENT_EXPORT MediaStreamExtraData DISALLOW_COPY_AND_ASSIGN(MediaStreamExtraData); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_EXTRA_DATA_H_ diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc index d776d69..95ad1a5 100644 --- a/content/renderer/media/media_stream_impl.cc +++ b/content/renderer/media/media_stream_impl.cc @@ -31,6 +31,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" +namespace content { namespace { const int kVideoCaptureWidth = 640; @@ -50,21 +51,21 @@ std::string GetMandatoryStreamConstraint( void UpdateOptionsIfTabMediaRequest( const WebKit::WebUserMediaRequest& user_media_request, media_stream::StreamOptions* options) { - if (options->audio_type != content::MEDIA_NO_SERVICE && + if (options->audio_type != MEDIA_NO_SERVICE && GetMandatoryStreamConstraint(user_media_request.audioConstraints(), media_stream::kMediaStreamSource) == media_stream::kMediaStreamSourceTab) { - options->audio_type = content::MEDIA_TAB_AUDIO_CAPTURE; + options->audio_type = MEDIA_TAB_AUDIO_CAPTURE; options->audio_device_id = GetMandatoryStreamConstraint( user_media_request.audioConstraints(), media_stream::kMediaStreamSourceId); } - if (options->video_type != content::MEDIA_NO_SERVICE && + if (options->video_type != MEDIA_NO_SERVICE && GetMandatoryStreamConstraint(user_media_request.videoConstraints(), media_stream::kMediaStreamSource) == media_stream::kMediaStreamSourceTab) { - options->video_type = content::MEDIA_TAB_VIDEO_CAPTURE; + options->video_type = MEDIA_TAB_VIDEO_CAPTURE; options->video_device_id = GetMandatoryStreamConstraint( user_media_request.videoConstraints(), media_stream::kMediaStreamSourceId); @@ -96,11 +97,11 @@ static void CreateWebKitSourceVector( } MediaStreamImpl::MediaStreamImpl( - content::RenderView* render_view, + RenderView* render_view, MediaStreamDispatcher* media_stream_dispatcher, VideoCaptureImplManager* vc_manager, MediaStreamDependencyFactory* dependency_factory) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), dependency_factory_(dependency_factory), media_stream_dispatcher_(media_stream_dispatcher), vc_manager_(vc_manager) { @@ -126,8 +127,7 @@ void MediaStreamImpl::requestUserMedia( UpdateWebRTCMethodCount(WEBKIT_GET_USER_MEDIA); DCHECK(CalledOnValidThread()); int request_id = g_next_request_id++; - media_stream::StreamOptions options(content::MEDIA_NO_SERVICE, - content::MEDIA_NO_SERVICE); + media_stream::StreamOptions options(MEDIA_NO_SERVICE, MEDIA_NO_SERVICE); WebKit::WebFrame* frame = NULL; GURL security_origin; @@ -136,14 +136,14 @@ void MediaStreamImpl::requestUserMedia( if (user_media_request.isNull()) { // We are in a test. if (audio_sources.size() > 0) - options.audio_type = content::MEDIA_DEVICE_AUDIO_CAPTURE; + options.audio_type = MEDIA_DEVICE_AUDIO_CAPTURE; if (video_sources.size() > 0) - options.video_type = content::MEDIA_DEVICE_VIDEO_CAPTURE; + options.video_type = MEDIA_DEVICE_VIDEO_CAPTURE; } else { if (user_media_request.audio()) - options.audio_type = content::MEDIA_DEVICE_AUDIO_CAPTURE; + options.audio_type = MEDIA_DEVICE_AUDIO_CAPTURE; if (user_media_request.video()) - options.video_type = content::MEDIA_DEVICE_VIDEO_CAPTURE; + options.video_type = MEDIA_DEVICE_VIDEO_CAPTURE; security_origin = GURL(user_media_request.securityOrigin().toString()); // Get the WebFrame that requested a MediaStream. @@ -405,7 +405,7 @@ MediaStreamImpl::CreateLocalVideoFrameProvider( DVLOG(1) << "MediaStreamImpl::CreateLocalVideoFrameProvider video_session_id:" << video_session_id; - return new content::LocalVideoCapture( + return new LocalVideoCapture( video_session_id, vc_manager_.get(), capability, @@ -424,7 +424,7 @@ MediaStreamImpl::CreateRemoteVideoFrameProvider( DVLOG(1) << "MediaStreamImpl::CreateRemoteVideoFrameProvider label:" << stream->label(); - return new content::RTCVideoRenderer( + return new RTCVideoRenderer( stream->video_tracks()->at(0), error_cb, repaint_cb); @@ -494,3 +494,5 @@ void MediaStreamExtraData::OnLocalStreamStop() { if (!stream_stop_callback_.is_null()) stream_stop_callback_.Run(local_stream_->label()); } + +} // namespace content diff --git a/content/renderer/media/media_stream_impl.h b/content/renderer/media/media_stream_impl.h index 19493fe..e8db00d 100644 --- a/content/renderer/media/media_stream_impl.h +++ b/content/renderer/media/media_stream_impl.h @@ -26,10 +26,12 @@ namespace WebKit { class WebMediaStreamDescriptor; } -class MediaStreamDispatcher; class MediaStreamDependencyFactory; class VideoCaptureImplManager; +namespace content { +class MediaStreamDispatcher; + // MediaStreamImpl is a delegate for the Media Stream API messages used by // WebKit. It ties together WebKit, native PeerConnection in libjingle and // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) @@ -37,7 +39,7 @@ class VideoCaptureImplManager; // render thread. // MediaStreamImpl have weak pointers to a MediaStreamDispatcher. class CONTENT_EXPORT MediaStreamImpl - : public content::RenderViewObserver, + : public RenderViewObserver, NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), public MediaStreamDispatcherEventHandler, @@ -45,7 +47,7 @@ class CONTENT_EXPORT MediaStreamImpl NON_EXPORTED_BASE(public base::NonThreadSafe) { public: MediaStreamImpl( - content::RenderView* render_view, + RenderView* render_view, MediaStreamDispatcher* media_stream_dispatcher, VideoCaptureImplManager* vc_manager, MediaStreamDependencyFactory* dependency_factory); @@ -93,7 +95,7 @@ class CONTENT_EXPORT MediaStreamImpl const media_stream::StreamDeviceInfo& device_info) OVERRIDE; virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; - // content::RenderViewObserver OVERRIDE + // RenderViewObserver OVERRIDE virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; protected: @@ -161,4 +163,6 @@ class CONTENT_EXPORT MediaStreamImpl DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ diff --git a/content/renderer/media/media_stream_impl_unittest.cc b/content/renderer/media/media_stream_impl_unittest.cc index a280e8c..f80f2ed 100644 --- a/content/renderer/media/media_stream_impl_unittest.cc +++ b/content/renderer/media/media_stream_impl_unittest.cc @@ -19,6 +19,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" +namespace content { + class MediaStreamImplUnderTest : public MediaStreamImpl { public: MediaStreamImplUnderTest(MediaStreamDispatcher* media_stream_dispatcher, @@ -77,8 +79,8 @@ class MediaStreamImplTest : public ::testing::Test { ms_dispatcher_->video_array()); WebKit::WebMediaStreamDescriptor desc = ms_impl_->last_generated_stream(); - MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( - desc.extraData()); + content::MediaStreamExtraData* extra_data = + static_cast<content::MediaStreamExtraData*>(desc.extraData()); if (!extra_data || !extra_data->local_stream()) { ADD_FAILURE(); return desc; @@ -137,3 +139,5 @@ TEST_F(MediaStreamImplTest, LocalMediaStream) { ms_impl_->FrameWillClose(NULL); EXPECT_EQ(3, ms_dispatcher_->stop_stream_counter()); } + +} // namespace content diff --git a/content/renderer/media/mock_media_stream_dispatcher.cc b/content/renderer/media/mock_media_stream_dispatcher.cc index 5eb18d1..017ad3a 100644 --- a/content/renderer/media/mock_media_stream_dispatcher.cc +++ b/content/renderer/media/mock_media_stream_dispatcher.cc @@ -7,6 +7,8 @@ #include "base/stringprintf.h" #include "content/public/common/media_stream_request.h" +namespace content { + MockMediaStreamDispatcher::MockMediaStreamDispatcher() : MediaStreamDispatcher(NULL), request_id_(-1), @@ -26,7 +28,7 @@ void MockMediaStreamDispatcher::GenerateStream( audio_array_.clear(); video_array_.clear(); - if (content::IsAudioMediaType(components.audio_type)) { + if (IsAudioMediaType(components.audio_type)) { media_stream::StreamDeviceInfo audio; audio.device_id = "audio_device_id"; audio.name = "microphone"; @@ -34,7 +36,7 @@ void MockMediaStreamDispatcher::GenerateStream( audio.session_id = request_id; audio_array_.push_back(audio); } - if (content::IsVideoMediaType(components.video_type)) { + if (IsVideoMediaType(components.video_type)) { media_stream::StreamDeviceInfo video; video.device_id = "video_device_id"; video.name = "usb video camera"; @@ -61,3 +63,5 @@ int MockMediaStreamDispatcher::audio_session_id(const std::string& label, int index) { return -1; } + +} // namespace content diff --git a/content/renderer/media/mock_media_stream_dispatcher.h b/content/renderer/media/mock_media_stream_dispatcher.h index 057311b..a51bcee 100644 --- a/content/renderer/media/mock_media_stream_dispatcher.h +++ b/content/renderer/media/mock_media_stream_dispatcher.h @@ -10,6 +10,8 @@ #include "content/renderer/media/media_stream_dispatcher.h" #include "googleurl/src/gurl.h" +namespace content { + // This class is a mock implementation of MediaStreamDispatcher. class MockMediaStreamDispatcher : public MediaStreamDispatcher { public: @@ -48,4 +50,6 @@ class MockMediaStreamDispatcher : public MediaStreamDispatcher { DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ diff --git a/content/renderer/media/peer_connection_handler_base.cc b/content/renderer/media/peer_connection_handler_base.cc index aee660a..328e384 100644 --- a/content/renderer/media/peer_connection_handler_base.cc +++ b/content/renderer/media/peer_connection_handler_base.cc @@ -14,8 +14,8 @@ static webrtc::LocalMediaStreamInterface* GetLocalNativeMediaStream( const WebKit::WebMediaStreamDescriptor& stream) { - MediaStreamExtraData* extra_data = - static_cast<MediaStreamExtraData*>(stream.extraData()); + content::MediaStreamExtraData* extra_data = + static_cast<content::MediaStreamExtraData*>(stream.extraData()); if (extra_data) return extra_data->local_stream(); return NULL; @@ -91,6 +91,6 @@ PeerConnectionHandlerBase::CreateWebKitStreamDescriptor( WebKit::WebMediaStreamDescriptor descriptor; descriptor.initialize(UTF8ToUTF16(stream->label()), audio_source_vector, video_source_vector); - descriptor.setExtraData(new MediaStreamExtraData(stream)); + descriptor.setExtraData(new content::MediaStreamExtraData(stream)); return descriptor; } diff --git a/content/renderer/media/peer_connection_handler_jsep_unittest.cc b/content/renderer/media/peer_connection_handler_jsep_unittest.cc index cfd0f0d..a561916 100644 --- a/content/renderer/media/peer_connection_handler_jsep_unittest.cc +++ b/content/renderer/media/peer_connection_handler_jsep_unittest.cc @@ -88,7 +88,7 @@ class PeerConnectionHandlerJsepTest : public ::testing::Test { WebKit::WebMediaStreamDescriptor local_stream; local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources, video_sources); - local_stream.setExtraData(new MediaStreamExtraData(native_stream)); + local_stream.setExtraData(new content::MediaStreamExtraData(native_stream)); return local_stream; } diff --git a/content/renderer/media/pepper_platform_video_decoder_impl.cc b/content/renderer/media/pepper_platform_video_decoder_impl.cc index 3c5f234..ab444e8 100644 --- a/content/renderer/media/pepper_platform_video_decoder_impl.cc +++ b/content/renderer/media/pepper_platform_video_decoder_impl.cc @@ -4,8 +4,6 @@ #include "content/renderer/media/pepper_platform_video_decoder_impl.h" -#include <vector> - #include "base/bind.h" #include "base/logging.h" #include "content/common/child_process.h" @@ -14,6 +12,8 @@ using media::BitstreamBuffer; +namespace content { + PlatformVideoDecoderImpl::PlatformVideoDecoderImpl( VideoDecodeAccelerator::Client* client, int32 command_buffer_route_id) @@ -35,7 +35,7 @@ bool PlatformVideoDecoderImpl::Initialize(media::VideoCodecProfile profile) { // it is okay to immediately send IPC messages through the returned channel. GpuChannelHost* channel = render_thread->EstablishGpuChannelSync( - content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); + CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); if (!channel) return false; @@ -126,3 +126,5 @@ void PlatformVideoDecoderImpl::NotifyResetDone() { DCHECK(RenderThreadImpl::current()); client_->NotifyResetDone(); } + +} // namespace content diff --git a/content/renderer/media/pepper_platform_video_decoder_impl.h b/content/renderer/media/pepper_platform_video_decoder_impl.h index 0008531..3ca62c8 100644 --- a/content/renderer/media/pepper_platform_video_decoder_impl.h +++ b/content/renderer/media/pepper_platform_video_decoder_impl.h @@ -13,6 +13,8 @@ #include "media/video/video_decode_accelerator.h" #include "webkit/plugins/ppapi/plugin_delegate.h" +namespace content { + class PlatformVideoDecoderImpl : public webkit::ppapi::PluginDelegate::PlatformVideoDecoder, public media::VideoDecodeAccelerator::Client { @@ -62,4 +64,7 @@ class PlatformVideoDecoderImpl DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl); }; + +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ diff --git a/content/renderer/media/render_audiosourceprovider.cc b/content/renderer/media/render_audiosourceprovider.cc index 335cae2..c8a7fce 100644 --- a/content/renderer/media/render_audiosourceprovider.cc +++ b/content/renderer/media/render_audiosourceprovider.cc @@ -16,11 +16,11 @@ #include "media/base/audio_renderer_mixer_input.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h" -using content::AudioDeviceFactory; -using content::AudioRendererMixerManager; using std::vector; using WebKit::WebVector; +namespace content { + RenderAudioSourceProvider::RenderAudioSourceProvider() : is_initialized_(false), channels_(0), @@ -149,3 +149,5 @@ void RenderAudioSourceProvider::Initialize( } RenderAudioSourceProvider::~RenderAudioSourceProvider() {} + +} // namespace content diff --git a/content/renderer/media/render_audiosourceprovider.h b/content/renderer/media/render_audiosourceprovider.h index 8dc5788..b264c0e4 100644 --- a/content/renderer/media/render_audiosourceprovider.h +++ b/content/renderer/media/render_audiosourceprovider.h @@ -31,6 +31,8 @@ namespace WebKit { class WebAudioSourceProviderClient; } +namespace content { + class RenderAudioSourceProvider : public WebKit::WebAudioSourceProvider, public media::AudioRendererSink { @@ -80,4 +82,6 @@ class RenderAudioSourceProvider DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ diff --git a/content/renderer/media/render_media_log.cc b/content/renderer/media/render_media_log.cc index 2081078..23ea4eef 100644 --- a/content/renderer/media/render_media_log.cc +++ b/content/renderer/media/render_media_log.cc @@ -9,6 +9,8 @@ #include "content/common/view_messages.h" #include "content/renderer/render_thread_impl.h" +namespace content { + RenderMediaLog::RenderMediaLog() : render_loop_(base::MessageLoopProxy::current()) { DCHECK(RenderThreadImpl::current()) << @@ -26,3 +28,5 @@ void RenderMediaLog::AddEvent(scoped_ptr<media::MediaLogEvent> event) { } RenderMediaLog::~RenderMediaLog() {} + +} // namespace content diff --git a/content/renderer/media/render_media_log.h b/content/renderer/media/render_media_log.h index 96fd0e8..4c26cdf 100644 --- a/content/renderer/media/render_media_log.h +++ b/content/renderer/media/render_media_log.h @@ -11,6 +11,8 @@ namespace base { class MessageLoopProxy; } +namespace content { + // RenderMediaLog is an implementation of MediaLog that passes all events to the // browser process. class RenderMediaLog : public media::MediaLog { @@ -28,4 +30,6 @@ class RenderMediaLog : public media::MediaLog { DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ diff --git a/content/renderer/media/rtc_peer_connection_handler_unittest.cc b/content/renderer/media/rtc_peer_connection_handler_unittest.cc index b65a0d6..4889f5e 100644 --- a/content/renderer/media/rtc_peer_connection_handler_unittest.cc +++ b/content/renderer/media/rtc_peer_connection_handler_unittest.cc @@ -92,7 +92,7 @@ class RTCPeerConnectionHandlerTest : public ::testing::Test { WebKit::WebMediaStreamDescriptor local_stream; local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources, video_sources); - local_stream.setExtraData(new MediaStreamExtraData(native_stream)); + local_stream.setExtraData(new content::MediaStreamExtraData(native_stream)); return local_stream; } diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc index 9fea501..36ecab4 100644 --- a/content/renderer/media/webrtc_audio_device_impl.cc +++ b/content/renderer/media/webrtc_audio_device_impl.cc @@ -15,10 +15,11 @@ #include "media/audio/audio_util.h" #include "media/audio/sample_rates.h" -using content::AudioDeviceFactory; using media::AudioParameters; using media::ChannelLayout; +namespace content { + static const int64 kMillisecondsBetweenProcessCalls = 5000; static const double kMaxVolumeLevel = 255.0; @@ -1164,3 +1165,5 @@ int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { session_id_ = session_id; } + +} // namespace content diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h index a63acd7..35bda15 100644 --- a/content/renderer/media/webrtc_audio_device_impl.h +++ b/content/renderer/media/webrtc_audio_device_impl.h @@ -201,6 +201,9 @@ // (WebRTC client a media layer). This approach ensures that we can avoid // transferring maximum levels between the renderer and the browser. // + +namespace content { + class CONTENT_EXPORT WebRtcAudioDeviceImpl : NON_EXPORTED_BASE(public webrtc::AudioDeviceModule), NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), @@ -448,4 +451,6 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); }; +} // namespace content + #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ diff --git a/content/renderer/media/webrtc_audio_device_unittest.cc b/content/renderer/media/webrtc_audio_device_unittest.cc index 3235385..ec6337a 100644 --- a/content/renderer/media/webrtc_audio_device_unittest.cc +++ b/content/renderer/media/webrtc_audio_device_unittest.cc @@ -22,6 +22,8 @@ using testing::InvokeWithoutArgs; using testing::Return; using testing::StrEq; +namespace content { + namespace { class AudioUtil : public AudioUtilInterface { @@ -518,3 +520,5 @@ TEST_F(WebRTCAudioDeviceTest, FullDuplexAudioWithAGC) { EXPECT_EQ(0, base->DeleteChannel(ch)); EXPECT_EQ(0, base->Terminate()); } + +} // namespace content diff --git a/content/renderer/mhtml_generator.cc b/content/renderer/mhtml_generator.cc index 6b641d5..8d82edf 100644 --- a/content/renderer/mhtml_generator.cc +++ b/content/renderer/mhtml_generator.cc @@ -10,8 +10,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" +namespace content { + MHTMLGenerator::MHTMLGenerator(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), file_(base::kInvalidPlatformFileValue) { } @@ -63,3 +65,5 @@ int64 MHTMLGenerator::GenerateMHTML() { } return total_bytes_written; } + +} // namespace content diff --git a/content/renderer/mhtml_generator.h b/content/renderer/mhtml_generator.h index faec63b..352c04c 100644 --- a/content/renderer/mhtml_generator.h +++ b/content/renderer/mhtml_generator.h @@ -9,9 +9,10 @@ #include "ipc/ipc_platform_file.h" +namespace content { class RenderViewImpl; -class MHTMLGenerator : public content::RenderViewObserver { +class MHTMLGenerator : public RenderViewObserver { public: explicit MHTMLGenerator(RenderViewImpl* render_view); virtual ~MHTMLGenerator(); @@ -32,4 +33,6 @@ class MHTMLGenerator : public content::RenderViewObserver { DISALLOW_COPY_AND_ASSIGN(MHTMLGenerator); }; +} // namespace content + #endif // CONTENT_RENDERER_MHTML_GENERATOR_H_ diff --git a/content/renderer/mouse_lock_dispatcher.cc b/content/renderer/mouse_lock_dispatcher.cc index 8d4c617..60a4729 100644 --- a/content/renderer/mouse_lock_dispatcher.cc +++ b/content/renderer/mouse_lock_dispatcher.cc @@ -7,6 +7,8 @@ #include "base/logging.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +namespace content { + MouseLockDispatcher::MouseLockDispatcher() : mouse_locked_(false), pending_lock_request_(false), pending_unlock_request_(false), @@ -100,3 +102,5 @@ void MouseLockDispatcher::OnMouseLockLost() { if (last_target) last_target->OnMouseLockLost(); } + +} // namespace content diff --git a/content/renderer/mouse_lock_dispatcher.h b/content/renderer/mouse_lock_dispatcher.h index b4407ee..6423b7d 100644 --- a/content/renderer/mouse_lock_dispatcher.h +++ b/content/renderer/mouse_lock_dispatcher.h @@ -12,6 +12,8 @@ namespace WebKit { class WebMouseEvent; } // namespace WebKit +namespace content { + class CONTENT_EXPORT MouseLockDispatcher { public: MouseLockDispatcher(); @@ -80,4 +82,6 @@ class CONTENT_EXPORT MouseLockDispatcher { DISALLOW_COPY_AND_ASSIGN(MouseLockDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_ diff --git a/content/renderer/mouse_lock_dispatcher_browsertest.cc b/content/renderer/mouse_lock_dispatcher_browsertest.cc index 7c872ce..f9c44c2 100644 --- a/content/renderer/mouse_lock_dispatcher_browsertest.cc +++ b/content/renderer/mouse_lock_dispatcher_browsertest.cc @@ -13,6 +13,7 @@ using ::testing::_; +namespace content { namespace { class MockLockTarget : public MouseLockDispatcher::LockTarget { @@ -25,18 +26,17 @@ class MockLockTarget : public MouseLockDispatcher::LockTarget { // MouseLockDispatcher is a RenderViewObserver, and we test it by creating a // fixture containing a RenderViewImpl view() and interacting to that interface. -class MouseLockDispatcherTest - : public content::RenderViewTest { +class MouseLockDispatcherTest : public RenderViewTest { public: virtual void SetUp() { - content::RenderViewTest::SetUp(); + RenderViewTest::SetUp(); route_id_ = view()->GetRoutingID(); target_ = new MockLockTarget(); alternate_target_ = new MockLockTarget(); } virtual void TearDown() { - content::RenderViewTest::TearDown(); + RenderViewTest::TearDown(); delete target_; delete alternate_target_; } @@ -230,3 +230,4 @@ TEST_F(MouseLockDispatcherTest, MultipleTargets) { EXPECT_FALSE(dispatcher()->IsMouseLockedTo(target_)); } +} // namespace content diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc index c4de9d1..01a533b 100644 --- a/content/renderer/notification_provider.cc +++ b/content/renderer/notification_provider.cc @@ -22,8 +22,11 @@ using WebKit::WebSecurityOrigin; using WebKit::WebString; using WebKit::WebURL; +namespace content { + + NotificationProvider::NotificationProvider(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view) { + : RenderViewObserver(render_view) { } NotificationProvider::~NotificationProvider() { @@ -99,7 +102,7 @@ bool NotificationProvider::OnMessageReceived(const IPC::Message& message) { bool NotificationProvider::ShowHTML(const WebNotification& notification, int id) { DCHECK(notification.isHTML()); - content::ShowDesktopNotificationHostMsgParams params; + ShowDesktopNotificationHostMsgParams params; WebDocument document = render_view()->GetWebView()->mainFrame()->document(); params.origin = GURL(document.securityOrigin().toString()); params.is_html = true; @@ -112,7 +115,7 @@ bool NotificationProvider::ShowHTML(const WebNotification& notification, bool NotificationProvider::ShowText(const WebNotification& notification, int id) { DCHECK(!notification.isHTML()); - content::ShowDesktopNotificationHostMsgParams params; + ShowDesktopNotificationHostMsgParams params; params.is_html = false; WebDocument document = render_view()->GetWebView()->mainFrame()->document(); params.origin = GURL(document.securityOrigin().toString()); @@ -173,3 +176,5 @@ void NotificationProvider::OnPermissionRequestComplete(int id) { void NotificationProvider::OnNavigate() { manager_.Clear(); } + +} // namespace content diff --git a/content/renderer/notification_provider.h b/content/renderer/notification_provider.h index f2b1f85..c7595e8 100644 --- a/content/renderer/notification_provider.h +++ b/content/renderer/notification_provider.h @@ -10,15 +10,16 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotification.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresenter.h" -class RenderViewImpl; - namespace WebKit { class WebNotificationPermissionCallback; } +namespace content { +class RenderViewImpl; + // NotificationProvider class is owned by the RenderView. Only // to be used on the main thread. -class NotificationProvider : public content::RenderViewObserver, +class NotificationProvider : public RenderViewObserver, public WebKit::WebNotificationPresenter { public: explicit NotificationProvider(RenderViewImpl* render_view); @@ -56,4 +57,6 @@ class NotificationProvider : public content::RenderViewObserver, DISALLOW_COPY_AND_ASSIGN(NotificationProvider); }; +} // namespace content + #endif // CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ diff --git a/content/renderer/p2p/socket_dispatcher.h b/content/renderer/p2p/socket_dispatcher.h index 2bf9ea4..e17a8c1 100644 --- a/content/renderer/p2p/socket_dispatcher.h +++ b/content/renderer/p2p/socket_dispatcher.h @@ -33,8 +33,6 @@ #include "ipc/ipc_channel_proxy.h" #include "net/base/net_util.h" -class RenderViewImpl; - namespace base { class MessageLoopProxy; } // namespace base @@ -49,6 +47,7 @@ class NetworkListObserver; namespace content { +class RenderViewImpl; class P2PHostAddressRequest; class P2PSocketClient; diff --git a/content/renderer/pepper/content_renderer_pepper_host_factory.h b/content/renderer/pepper/content_renderer_pepper_host_factory.h index c4ee4cf..cc790fa 100644 --- a/content/renderer/pepper/content_renderer_pepper_host_factory.h +++ b/content/renderer/pepper/content_renderer_pepper_host_factory.h @@ -9,17 +9,14 @@ #include "ppapi/host/host_factory.h" #include "ppapi/shared_impl/ppapi_permissions.h" -class RenderViewImpl; - namespace ppapi { class PpapiPermissions; } namespace content { - -class RendererPpapiHostImpl; - class PepperInstanceStateAccessor; +class RendererPpapiHostImpl; +class RenderViewImpl; class ContentRendererPepperHostFactory : public ppapi::host::HostFactory { public: diff --git a/content/renderer/pepper/pepper_file_chooser_host.h b/content/renderer/pepper/pepper_file_chooser_host.h index bfdfcfd..5763132 100644 --- a/content/renderer/pepper/pepper_file_chooser_host.h +++ b/content/renderer/pepper/pepper_file_chooser_host.h @@ -15,11 +15,10 @@ #include "ppapi/host/resource_host.h" #include "ppapi/proxy/resource_message_params.h" -class RenderViewImpl; - namespace content { class RendererPpapiHost; +class RenderViewImpl; class CONTENT_EXPORT PepperFileChooserHost : public ppapi::host::ResourceHost, diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index 30d1812..63b36fa 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -144,7 +144,7 @@ class HostDispatcherWrapper return false; } dispatcher_->channel()->SetRestrictDispatchChannelGroup( - content::kRendererRestrictDispatchGroup_Pepper); + kRendererRestrictDispatchGroup_Pepper); return true; } @@ -315,7 +315,7 @@ void CreateHostForInProcessModule(RenderViewImpl* render_view, PepperPluginRegistry::GetInstance()->GetInfoForPlugin( webplugin_info)->permissions); RendererPpapiHostImpl* host_impl = - content::RendererPpapiHostImpl::CreateOnModuleForInProcess( + RendererPpapiHostImpl::CreateOnModuleForInProcess( module, perms); render_view->PpapiPluginCreated(host_impl); } @@ -418,7 +418,7 @@ scoped_refptr<webkit::ppapi::PluginModule> PepperPluginDelegateImpl::CreateBrowserPluginModule( const IPC::ChannelHandle& channel_handle, int guest_process_id) { - content::old::BrowserPluginRegistry* registry = + old::BrowserPluginRegistry* registry = RenderThreadImpl::current()->browser_plugin_registry(); scoped_refptr<webkit::ppapi::PluginModule> module = registry->GetModule(guest_process_id); @@ -501,7 +501,7 @@ RendererPpapiHost* PepperPluginDelegateImpl::CreateOutOfProcessModule( return NULL; RendererPpapiHostImpl* host_impl = - content::RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( + RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( module, dispatcher->dispatcher(), permissions); render_view_->PpapiPluginCreated(host_impl); @@ -1496,7 +1496,7 @@ void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) { void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) { WebFrame* frame = render_view_->webview()->mainFrame(); - content::Referrer referrer(frame->document().url(), + Referrer referrer(frame->document().url(), frame->document().referrerPolicy()); render_view_->Send(new ViewHostMsg_SaveURLAs( render_view_->routing_id(), url, referrer)); diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index a909abc..61b52ee 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -30,7 +30,6 @@ #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" class FilePath; -class RenderViewImpl; class TransportDIB; namespace gfx { @@ -72,6 +71,7 @@ class GamepadSharedMemoryReader; class PepperBrokerImpl; class PepperDeviceEnumerationEventHandler; class PepperPluginDelegateImpl; +class RenderViewImpl; class PepperPluginDelegateImpl : public webkit::ppapi::PluginDelegate, diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index bba9240..f853b5e 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -118,8 +118,8 @@ using WebKit::WebScriptController; using WebKit::WebSecurityPolicy; using WebKit::WebString; using WebKit::WebView; -using content::AudioRendererMixerManager; -using content::RenderProcessObserver; + +namespace content { namespace { @@ -133,13 +133,13 @@ const int kIdleCPUUsageThresholdInPercents = 3; base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > lazy_tls = LAZY_INSTANCE_INITIALIZER; -class RenderViewZoomer : public content::RenderViewVisitor { +class RenderViewZoomer : public RenderViewVisitor { public: RenderViewZoomer(const std::string& host, double zoom_level) : host_(host), zoom_level_(zoom_level) { } - virtual bool Visit(content::RenderView* render_view) { + virtual bool Visit(RenderView* render_view) { WebView* webview = render_view->GetWebView(); WebDocument document = webview->mainFrame()->document(); @@ -297,9 +297,9 @@ void RenderThreadImpl::Init() { dom_storage_dispatcher_.reset(new DomStorageDispatcher()); main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); - browser_plugin_registry_.reset(new content::old::BrowserPluginRegistry()); + browser_plugin_registry_.reset(new old::BrowserPluginRegistry()); browser_plugin_channel_manager_.reset( - new content::old::BrowserPluginChannelManager()); + new old::BrowserPluginChannelManager()); AddObserver(browser_plugin_channel_manager_.get()); media_stream_center_ = NULL; @@ -308,8 +308,7 @@ void RenderThreadImpl::Init() { AddFilter(db_message_filter_.get()); #if defined(ENABLE_WEBRTC) - p2p_socket_dispatcher_ = new content::P2PSocketDispatcher( - GetIOMessageLoopProxy()); + p2p_socket_dispatcher_ = new P2PSocketDispatcher(GetIOMessageLoopProxy()); AddFilter(p2p_socket_dispatcher_); #endif // defined(ENABLE_WEBRTC) vc_manager_ = new VideoCaptureImplManager(); @@ -323,18 +322,18 @@ void RenderThreadImpl::Init() { AddFilter(new IndexedDBMessageFilter); - content::GetContentClient()->renderer()->RenderThreadStarted(); + GetContentClient()->renderer()->RenderThreadStarted(); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) - RegisterExtension(content::GpuBenchmarkingExtension::Get()); + RegisterExtension(GpuBenchmarkingExtension::Get()); context_lost_cb_.reset(new GpuVDAContextLostCallback()); // Note that under Linux, the media library will normally already have // been initialized by the Zygote before this instance became a Renderer. FilePath media_path; - PathService::Get(content::DIR_MEDIA_LIBS, &media_path); + PathService::Get(DIR_MEDIA_LIBS, &media_path); if (!media_path.empty()) media::InitializeMediaLibrary(media_path); @@ -415,7 +414,7 @@ bool RenderThreadImpl::Send(IPC::Message* msg) { if ((msg->type() == ViewHostMsg_GetCookies::ID || msg->type() == ViewHostMsg_GetRawCookies::ID || msg->type() == ViewHostMsg_CookiesEnabled::ID) && - content::GetContentClient()->renderer()-> + GetContentClient()->renderer()-> ShouldPumpEventsDuringCookieMessage()) { pumping_events = true; } @@ -522,17 +521,16 @@ void RenderThreadImpl::SetOutgoingMessageFilter( IPC::ChannelProxy::OutgoingMessageFilter* filter) { } -void RenderThreadImpl::AddObserver(content::RenderProcessObserver* observer) { +void RenderThreadImpl::AddObserver(RenderProcessObserver* observer) { observers_.AddObserver(observer); } -void RenderThreadImpl::RemoveObserver( - content::RenderProcessObserver* observer) { +void RenderThreadImpl::RemoveObserver(RenderProcessObserver* observer) { observers_.RemoveObserver(observer); } void RenderThreadImpl::SetResourceDispatcherDelegate( - content::ResourceDispatcherDelegate* delegate) { + ResourceDispatcherDelegate* delegate) { resource_dispatcher()->set_delegate(delegate); } @@ -540,8 +538,7 @@ void RenderThreadImpl::WidgetHidden() { DCHECK(hidden_widget_count_ < widget_count_); hidden_widget_count_++; - if (!content::GetContentClient()->renderer()-> - RunIdleHandlerWhenWidgetsHidden()) { + if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { return; } @@ -552,8 +549,7 @@ void RenderThreadImpl::WidgetHidden() { void RenderThreadImpl::WidgetRestored() { DCHECK_GT(hidden_widget_count_, 0); hidden_widget_count_--; - if (!content::GetContentClient()->renderer()-> - RunIdleHandlerWhenWidgetsHidden()) { + if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { return; } @@ -576,7 +572,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() { // The new design can be tracked at: http://crbug.com/134492. bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( switches::kGuestRenderer); - bool enable = content::IsThreadedCompositingEnabled() && !is_guest; + bool enable = IsThreadedCompositingEnabled() && !is_guest; if (enable) { compositor_thread_.reset(new CompositorThread(this)); AddFilter(compositor_thread_->GetMessageFilter()); @@ -603,7 +599,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() { if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kDomAutomationController)) { - base::StringPiece extension = content::GetContentClient()->GetDataResource( + base::StringPiece extension = GetContentClient()->GetDataResource( IDR_DOM_AUTOMATION_JS, ui::SCALE_FACTOR_NONE); RegisterExtension(new v8::Extension( "dom_automation.js", extension.data(), 0, NULL, extension.size())); @@ -709,10 +705,8 @@ void RenderThreadImpl::EnsureWebKitInitialized() { devtools_agent_message_filter_ = new DevToolsAgentFilter(); AddFilter(devtools_agent_message_filter_.get()); - if (content::GetContentClient()->renderer()-> - RunIdleHandlerWhenWidgetsHidden()) { + if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) ScheduleIdleHandler(kLongIdleHandlerDelayMs); - } } void RenderThreadImpl::RegisterSchemes() { @@ -749,7 +743,7 @@ void RenderThreadImpl::ScheduleIdleHandler(int64 initial_delay_ms) { void RenderThreadImpl::IdleHandler() { bool run_in_foreground_tab = (widget_count_ > hidden_widget_count_) && - content::GetContentClient()->renderer()-> + GetContentClient()->renderer()-> RunIdleHandlerWhenWidgetsHidden(); if (run_in_foreground_tab) { IdleHandlerInForegroundTab(); @@ -859,8 +853,7 @@ RenderThreadImpl::GetGpuVDAContext3D() { return gpu_vda_context3d_.get(); } -content::AudioRendererMixerManager* -RenderThreadImpl::GetAudioRendererMixerManager() { +AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { if (!audio_renderer_mixer_manager_.get()) { audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( audio_hardware::GetOutputSampleRate(), @@ -977,7 +970,7 @@ void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level) { RenderViewZoomer zoomer(host, zoom_level); - content::RenderView::ForEach(&zoomer); + RenderView::ForEach(&zoomer); } bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { @@ -1057,7 +1050,7 @@ void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { } GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( - content::CauseForGpuLaunch cause_for_gpu_launch) { + CauseForGpuLaunch cause_for_gpu_launch) { TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); if (gpu_channel_.get()) { @@ -1074,7 +1067,7 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( // Ask the browser for the channel name. int client_id = 0; IPC::ChannelHandle channel_handle; - content::GPUInfo gpu_info; + GPUInfo gpu_info; if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, &client_id, &channel_handle, @@ -1090,7 +1083,7 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( gpu_channel_ = new GpuChannelHost(this, 0, client_id); gpu_channel_->set_gpu_info(gpu_info); - content::GetContentClient()->SetGpuInfo(gpu_info); + GetContentClient()->SetGpuInfo(gpu_info); // Connect to the GPU process if a channel name was received. gpu_channel_->Connect(channel_handle); @@ -1102,7 +1095,7 @@ WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( WebKit::WebMediaStreamCenterClient* client) { #if defined(ENABLE_WEBRTC) if (!media_stream_center_) - media_stream_center_ = new content::MediaStreamCenter( + media_stream_center_ = new MediaStreamCenter( client, GetMediaStreamDependencyFactory()); #endif return media_stream_center_; @@ -1148,7 +1141,7 @@ void RenderThreadImpl::OnNetworkStateChanged(bool online) { } void RenderThreadImpl::OnTempCrashWithData(const GURL& data) { - content::GetContentClient()->SetActiveURL(data); + GetContentClient()->SetActiveURL(data); CHECK(false); } @@ -1161,3 +1154,5 @@ RenderThreadImpl::GetFileThreadMessageLoopProxy() { } return file_thread_->message_loop_proxy(); } + +} // namespace content diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 4c08164..4806e3f 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -25,14 +25,10 @@ class AppCacheDispatcher; class AudioInputMessageFilter; class AudioMessageFilter; -class CompositorThread; class DBMessageFilter; -class DevToolsAgentFilter; -class DomStorageDispatcher; class GpuChannelHost; class IndexedDBDispatcher; class MediaStreamDependencyFactory; -class RendererWebKitPlatformSupportImpl; class SkBitmap; class VideoCaptureImplManager; struct ViewMsg_New_Params; @@ -59,10 +55,19 @@ namespace IPC { class ForwardingMessageFilter; } +namespace v8 { +class Extension; +} + namespace content { + class AudioRendererMixerManager; +class CompositorThread; +class DevToolsAgentFilter; +class DomStorageDispatcher; class MediaStreamCenter; class P2PSocketDispatcher; +class RendererWebKitPlatformSupportImpl; class RenderProcessObserver; namespace old { @@ -70,12 +75,6 @@ class BrowserPluginChannelManager; class BrowserPluginRegistry; } -} - -namespace v8 { -class Extension; -} - // The RenderThreadImpl class represents a background thread where RenderView // instances live. The RenderThread supports an API that is used by its // consumer to talk indirectly to the RenderViews and supporting objects. @@ -85,7 +84,7 @@ class Extension; // Most of the communication occurs in the form of IPC messages. They are // routed to the RenderThread according to the routing IDs of the messages. // The routing IDs correspond to RenderView instances. -class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, +class CONTENT_EXPORT RenderThreadImpl : public RenderThread, public ChildThread, public GpuChannelHostFactory { public: @@ -100,7 +99,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // module are registered properly. Static to allow sharing with tests. static void RegisterSchemes(); - // content::RenderThread implementation: + // RenderThread implementation: virtual bool Send(IPC::Message* msg) OVERRIDE; virtual MessageLoop* GetMessageLoop() OVERRIDE; virtual IPC::SyncChannel* GetChannel() OVERRIDE; @@ -115,11 +114,10 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) OVERRIDE; virtual void SetOutgoingMessageFilter( IPC::ChannelProxy::OutgoingMessageFilter* filter) OVERRIDE; - virtual void AddObserver(content::RenderProcessObserver* observer) OVERRIDE; - virtual void RemoveObserver( - content::RenderProcessObserver* observer) OVERRIDE; + virtual void AddObserver(RenderProcessObserver* observer) OVERRIDE; + virtual void RemoveObserver(RenderProcessObserver* observer) OVERRIDE; virtual void SetResourceDispatcherDelegate( - content::ResourceDispatcherDelegate* delegate) OVERRIDE; + ResourceDispatcherDelegate* delegate) OVERRIDE; virtual void WidgetHidden() OVERRIDE; virtual void WidgetRestored() OVERRIDE; virtual void EnsureWebKitInitialized() OVERRIDE; @@ -139,7 +137,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, virtual void ReleaseCachedFonts() OVERRIDE; #endif - // content::ChildThread: + // ChildThread: virtual bool IsWebFrameValid(WebKit::WebFrame* frame) OVERRIDE; // GpuChannelHostFactory implementation: @@ -163,8 +161,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // established or if it has been lost (for example if the GPU plugin crashed). // If there is a pending asynchronous request, it will be completed by the // time this routine returns. - virtual GpuChannelHost* EstablishGpuChannelSync( - content::CauseForGpuLaunch) OVERRIDE; + virtual GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch) OVERRIDE; // These methods modify how the next message is sent. Normally, when sending @@ -184,12 +181,11 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, return compositor_thread_.get(); } - content::old::BrowserPluginRegistry* browser_plugin_registry() const { + old::BrowserPluginRegistry* browser_plugin_registry() const { return browser_plugin_registry_.get(); } - content::old::BrowserPluginChannelManager* - browser_plugin_channel_manager() const { + old::BrowserPluginChannelManager* browser_plugin_channel_manager() const { return browser_plugin_channel_manager_.get(); } @@ -220,7 +216,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, MediaStreamDependencyFactory* GetMediaStreamDependencyFactory(); // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. - content::P2PSocketDispatcher* p2p_socket_dispatcher() { + P2PSocketDispatcher* p2p_socket_dispatcher() { return p2p_socket_dispatcher_.get(); } @@ -255,7 +251,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // AudioRendererMixerManager instance which manages renderer side mixer // instances shared based on configured audio parameters. Lazily created on // first call. - content::AudioRendererMixerManager* GetAudioRendererMixerManager(); + AudioRendererMixerManager* GetAudioRendererMixerManager(); // For producing custom V8 histograms. Custom histograms are produced if all // RenderViews share the same host, and the host is in the pre-specified set @@ -324,11 +320,10 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_; scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; - scoped_ptr<content::old::BrowserPluginChannelManager> - browser_plugin_channel_manager_; + scoped_ptr<old::BrowserPluginChannelManager> browser_plugin_channel_manager_; // Used on the render thread and deleted by WebKit at shutdown. - content::MediaStreamCenter* media_stream_center_; + MediaStreamCenter* media_stream_center_; // Used on the renderer and IPC threads. scoped_refptr<DBMessageFilter> db_message_filter_; @@ -339,7 +334,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, scoped_ptr<MediaStreamDependencyFactory> media_stream_factory_; // Dispatches all P2P sockets. - scoped_refptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_; + scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; // Used on multiple threads. scoped_refptr<VideoCaptureImplManager> vc_manager_; @@ -380,19 +375,21 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, scoped_ptr<CompositorThread> compositor_thread_; scoped_refptr<IPC::ForwardingMessageFilter> compositor_output_surface_filter_; - scoped_ptr<content::old::BrowserPluginRegistry> browser_plugin_registry_; + scoped_ptr<old::BrowserPluginRegistry> browser_plugin_registry_; - ObserverList<content::RenderProcessObserver> observers_; + ObserverList<RenderProcessObserver> observers_; class GpuVDAContextLostCallback; scoped_ptr<GpuVDAContextLostCallback> context_lost_cb_; scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_; - scoped_ptr<content::AudioRendererMixerManager> audio_renderer_mixer_manager_; + scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; HistogramCustomizer histogram_customizer_; DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ diff --git a/content/renderer/render_thread_impl_unittest.cc b/content/renderer/render_thread_impl_unittest.cc index 44b3a7c..7f8c325 100644 --- a/content/renderer/render_thread_impl_unittest.cc +++ b/content/renderer/render_thread_impl_unittest.cc @@ -7,6 +7,8 @@ #include <string> +namespace content { + class RenderThreadImplUnittest : public testing::Test { public: RenderThreadImplUnittest() @@ -76,3 +78,5 @@ TEST_F(RenderThreadImplUnittest, CustomHistogramsForTwoRenderViews) { histogram_customizer_.ConvertToCustomHistogramName( kCustomizableHistogram_)); } + +} // namespace content diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 799b128..b43e53e 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -55,7 +55,8 @@ using WebKit::WebMouseEvent; using WebKit::WebString; using WebKit::WebTextDirection; using WebKit::WebURLError; -using content::NativeWebKeyboardEvent; + +namespace content { namespace { #if defined(USE_AURA) && defined(USE_X11) @@ -82,34 +83,33 @@ int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { } #endif -class WebUITestWebUIControllerFactory : public content::WebUIControllerFactory { +class WebUITestWebUIControllerFactory : public WebUIControllerFactory { public: - virtual content::WebUIController* CreateWebUIControllerForURL( - content::WebUI* web_ui, const GURL& url) const OVERRIDE { + virtual WebUIController* CreateWebUIControllerForURL( + WebUI* web_ui, const GURL& url) const OVERRIDE { return NULL; } - virtual content::WebUI::TypeID GetWebUIType( - content::BrowserContext* browser_context, - const GURL& url) const OVERRIDE { - return content::WebUI::kNoWebUI; + virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, + const GURL& url) const OVERRIDE { + return WebUI::kNoWebUI; } - virtual bool UseWebUIForURL(content::BrowserContext* browser_context, + virtual bool UseWebUIForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } - virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, + virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } virtual bool IsURLAcceptableForWebUI( - content::BrowserContext* browser_context, + BrowserContext* browser_context, const GURL& url, bool data_urls_allowed) const OVERRIDE { return false; } }; -class WebUITestClient : public content::ShellContentClient { +class WebUITestClient : public ShellContentClient { public: WebUITestClient() { } @@ -119,12 +119,11 @@ class WebUITestClient : public content::ShellContentClient { } }; -class WebUITestBrowserClient : public content::ShellContentBrowserClient { +class WebUITestBrowserClient : public ShellContentBrowserClient { public: WebUITestBrowserClient() {} - virtual content::WebUIControllerFactory* - GetWebUIControllerFactory() OVERRIDE { + virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE { return &factory_; } @@ -134,7 +133,7 @@ class WebUITestBrowserClient : public content::ShellContentBrowserClient { } -class RenderViewImplTest : public content::RenderViewTest { +class RenderViewImplTest : public RenderViewTest { public: RenderViewImplTest() { // Attach a pseudo keyboard device to this object. @@ -304,7 +303,7 @@ TEST_F(RenderViewImplTest, OnNavigationHttpPost) { // An http url will trigger a resource load so cannot be used here. nav_params.url = GURL("data:text/html,<div>Page</div>"); nav_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; - nav_params.transition = content::PAGE_TRANSITION_TYPED; + nav_params.transition = PAGE_TRANSITION_TYPED; nav_params.page_id = -1; nav_params.is_post = true; @@ -343,12 +342,11 @@ TEST_F(RenderViewImplTest, OnNavigationHttpPost) { TEST_F(RenderViewImplTest, DecideNavigationPolicy) { WebUITestClient client; WebUITestBrowserClient browser_client; - content::ContentClient* old_client = content::GetContentClient(); - content::ContentBrowserClient* old_browser_client = - content::GetContentClient()->browser(); + ContentClient* old_client = GetContentClient(); + ContentBrowserClient* old_browser_client = GetContentClient()->browser(); - content::SetContentClient(&client); - content::GetContentClient()->set_browser_for_testing(&browser_client); + SetContentClient(&client); + GetContentClient()->set_browser_for_testing(&browser_client); client.set_renderer_for_testing(old_client->renderer()); // Navigations to normal HTTP URLs can be handled locally. @@ -385,13 +383,13 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicy) { false); EXPECT_EQ(WebKit::WebNavigationPolicyIgnore, policy); - content::GetContentClient()->set_browser_for_testing(old_browser_client); - content::SetContentClient(old_client); + GetContentClient()->set_browser_for_testing(old_browser_client); + SetContentClient(old_client); } TEST_F(RenderViewImplTest, DecideNavigationPolicyForWebUI) { // Enable bindings to simulate a WebUI view. - view()->OnAllowBindings(content::BINDINGS_POLICY_WEB_UI); + view()->OnAllowBindings(BINDINGS_POLICY_WEB_UI); // Navigations to normal HTTP URLs will be sent to browser process. WebKit::WebURLRequest request(GURL("http://foo.com")); @@ -491,7 +489,7 @@ TEST_F(RenderViewImplTest, SendSwapOutACK) { ViewMsg_Navigate_Params nav_params; nav_params.url = GURL("data:text/html,<div>Page B</div>"); nav_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; - nav_params.transition = content::PAGE_TRANSITION_TYPED; + nav_params.transition = PAGE_TRANSITION_TYPED; nav_params.current_history_list_length = 1; nav_params.current_history_list_offset = 0; nav_params.pending_history_list_offset = 1; @@ -553,7 +551,7 @@ TEST_F(RenderViewImplTest, LastCommittedUpdateState) { // Go back to C and commit, preparing for our real test. ViewMsg_Navigate_Params params_C; params_C.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params_C.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params_C.transition = PAGE_TRANSITION_FORWARD_BACK; params_C.current_history_list_length = 4; params_C.current_history_list_offset = 3; params_C.pending_history_list_offset = 2; @@ -570,7 +568,7 @@ TEST_F(RenderViewImplTest, LastCommittedUpdateState) { // Back to page B (page_id 2), without committing. ViewMsg_Navigate_Params params_B; params_B.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params_B.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params_B.transition = PAGE_TRANSITION_FORWARD_BACK; params_B.current_history_list_length = 4; params_B.current_history_list_offset = 2; params_B.pending_history_list_offset = 1; @@ -581,7 +579,7 @@ TEST_F(RenderViewImplTest, LastCommittedUpdateState) { // Back to page A (page_id 1) and commit. ViewMsg_Navigate_Params params; params.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params.transition = PAGE_TRANSITION_FORWARD_BACK; params_B.current_history_list_length = 4; params_B.current_history_list_offset = 2; params_B.pending_history_list_offset = 0; @@ -633,7 +631,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { // Back to page A (page_id 1) and commit. ViewMsg_Navigate_Params params_A; params_A.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params_A.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params_A.transition = PAGE_TRANSITION_FORWARD_BACK; params_A.current_history_list_length = 2; params_A.current_history_list_offset = 1; params_A.pending_history_list_offset = 0; @@ -651,7 +649,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { // The browser then sends a stale navigation to B, which should be ignored. ViewMsg_Navigate_Params params_B; params_B.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params_B.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params_B.transition = PAGE_TRANSITION_FORWARD_BACK; params_B.current_history_list_length = 2; params_B.current_history_list_offset = 0; params_B.pending_history_list_offset = 1; @@ -715,7 +713,7 @@ TEST_F(RenderViewImplTest, DontIgnoreBackAfterNavEntryLimit) { // Ensure that going back to page B (page_id 2) at offset 0 is successful. ViewMsg_Navigate_Params params_B; params_B.navigation_type = ViewMsg_Navigate_Type::NORMAL; - params_B.transition = content::PAGE_TRANSITION_FORWARD_BACK; + params_B.transition = PAGE_TRANSITION_FORWARD_BACK; params_B.current_history_list_length = 2; params_B.current_history_list_offset = 1; params_B.pending_history_list_offset = 0; @@ -1700,9 +1698,9 @@ TEST_F(RenderViewImplTest, GetCompositionCharacterBoundsTest) { TEST_F(RenderViewImplTest, ZoomLimit) { const double kMinZoomLevel = - WebKit::WebView::zoomFactorToZoomLevel(content::kMinimumZoomFactor); + WebKit::WebView::zoomFactorToZoomLevel(kMinimumZoomFactor); const double kMaxZoomLevel = - WebKit::WebView::zoomFactorToZoomLevel(content::kMaximumZoomFactor); + WebKit::WebView::zoomFactorToZoomLevel(kMaximumZoomFactor); ViewMsg_Navigate_Params params; params.page_id = -1; @@ -1790,3 +1788,5 @@ TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { EXPECT_EQ(2, info.selectionStart); EXPECT_EQ(2, info.selectionEnd); } + +} // namespace content diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm index d46fd8b..ed9908a 100644 --- a/content/renderer/render_view_browsertest_mac.mm +++ b/content/renderer/render_view_browsertest_mac.mm @@ -12,8 +12,7 @@ #include <Cocoa/Cocoa.h> #include <Carbon/Carbon.h> // for the kVK_* constants. -using content::NativeWebKeyboardEvent; -using content::RenderViewTest; +namespace content { NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { UniChar uniChar = 0; @@ -147,3 +146,4 @@ TEST_F(RenderViewTest, MacTestCmdUp) { EXPECT_EQ(kArrowUpNoScroll, UTF16ToASCII(output)); } +} // namespace content diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index af35bce..c3a28df 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -6,8 +6,6 @@ #include <algorithm> #include <cmath> -#include <string> -#include <vector> #include "base/bind.h" #include "base/bind_helpers.h" @@ -321,32 +319,21 @@ using WebKit::WebWindowFeatures; using appcache::WebApplicationCacheHostImpl; using base::Time; using base::TimeDelta; -using content::DocumentState; -using content::NavigationState; -using content::PasswordForm; -using content::Referrer; -using content::RenderThread; -using content::RenderViewObserver; -using content::RenderViewVisitor; -using content::RendererAccessibilityComplete; -using content::RendererAccessibilityFocusOnly; -using content::V8ValueConverter; + using webkit_glue::AltErrorPageResourceFetcher; using webkit_glue::ResourceFetcher; using webkit_glue::WebPreferences; using webkit_glue::WebURLResponseExtraDataImpl; #if defined(OS_ANDROID) -using content::AddressDetector; -using content::ContentDetector; -using content::EmailDetector; -using content::PhoneNumberDetector; using WebKit::WebContentDetectionResult; using WebKit::WebFloatPoint; using WebKit::WebFloatRect; using WebKit::WebHitTestResult; #endif +namespace content { + //----------------------------------------------------------------------------- typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap; @@ -511,9 +498,9 @@ static void NotifyTimezoneChange(WebKit::WebFrame* frame) { static void ConstructFrameTree(WebKit::WebFrame* frame, WebKit::WebFrame* exclude_frame_subtree, base::DictionaryValue* dict) { - dict->SetString(content::kFrameTreeNodeNameKey, + dict->SetString(kFrameTreeNodeNameKey, UTF16ToUTF8(frame->assignedName()).c_str()); - dict->SetInteger(content::kFrameTreeNodeIdKey, frame->identifier()); + dict->SetInteger(kFrameTreeNodeIdKey, frame->identifier()); WebFrame* child = frame->firstChild(); ListValue* children = new ListValue(); @@ -526,18 +513,17 @@ static void ConstructFrameTree(WebKit::WebFrame* frame, children->Append(d); } if (children->GetSize() > 0) - dict->Set(content::kFrameTreeNodeSubtreeKey, children); + dict->Set(kFrameTreeNodeSubtreeKey, children); } /////////////////////////////////////////////////////////////////////////////// struct RenderViewImpl::PendingFileChooser { - PendingFileChooser(const content::FileChooserParams& p, - WebFileChooserCompletion* c) + PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) : params(p), completion(c) { } - content::FileChooserParams params; + FileChooserParams params; WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. }; @@ -584,7 +570,7 @@ int64 ExtractPostId(const WebHistoryItem& item) { RenderViewImpl::RenderViewImpl( gfx::NativeViewId parent_hwnd, int32 opener_id, - const content::RendererPreferences& renderer_prefs, + const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, SharedRenderViewCounter* counter, int32 routing_id, @@ -595,7 +581,7 @@ RenderViewImpl::RenderViewImpl( bool swapped_out, int32 next_page_id, const WebKit::WebScreenInfo& screen_info, - content::old::GuestToEmbedderChannel* guest_to_embedder_channel, + old::GuestToEmbedderChannel* guest_to_embedder_channel, AccessibilityMode accessibility_mode) : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), webkit_preferences_(webkit_prefs), @@ -668,7 +654,7 @@ RenderViewImpl::RenderViewImpl( const CommandLine& command_line = *CommandLine::ForCurrentProcess(); #if defined(OS_ANDROID) - scoped_ptr<content::DeviceInfo> device_info(new content::DeviceInfo()); + scoped_ptr<DeviceInfo> device_info(new DeviceInfo()); webview()->setDeviceScaleFactor(device_info->GetDPIScale()); @@ -748,11 +734,11 @@ RenderViewImpl::RenderViewImpl( new IdleUserDetector(this); if (command_line.HasSwitch(switches::kDomAutomationController)) - enabled_bindings_ |= content::BINDINGS_POLICY_DOM_AUTOMATION; + enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; ProcessViewLayoutFlags(command_line); - content::GetContentClient()->renderer()->RenderViewCreated(this); + GetContentClient()->renderer()->RenderViewCreated(this); // If we have an opener_id but we weren't created by a renderer, then // it's the browser asking us to set our opener to another RenderView. @@ -812,13 +798,12 @@ RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { } /*static*/ -content::RenderView* - content::RenderView::FromWebView(WebKit::WebView* webview) { +RenderView* RenderView::FromWebView(WebKit::WebView* webview) { return RenderViewImpl::FromWebView(webview); } /*static*/ -void content::RenderView::ForEach(content::RenderViewVisitor* visitor) { +void RenderView::ForEach(RenderViewVisitor* visitor) { ViewMap* views = g_view_map.Pointer(); for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { if (!visitor->Visit(it->second)) @@ -830,7 +815,7 @@ void content::RenderView::ForEach(content::RenderViewVisitor* visitor) { RenderViewImpl* RenderViewImpl::Create( gfx::NativeViewId parent_hwnd, int32 opener_id, - const content::RendererPreferences& renderer_prefs, + const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, SharedRenderViewCounter* counter, int32 routing_id, @@ -841,7 +826,7 @@ RenderViewImpl* RenderViewImpl::Create( bool swapped_out, int32 next_page_id, const WebKit::WebScreenInfo& screen_info, - content::old::GuestToEmbedderChannel* guest_to_embedder_channel, + old::GuestToEmbedderChannel* guest_to_embedder_channel, AccessibilityMode accessibility_mode) { DCHECK(routing_id != MSG_ROUTING_NONE); return new RenderViewImpl( @@ -884,13 +869,12 @@ void RenderViewImpl::SetReportLoadProgressEnabled(bool enabled) { load_progress_tracker_.reset(new LoadProgressTracker(this)); } -content::old::GuestToEmbedderChannel* - RenderViewImpl::GetGuestToEmbedderChannel() const { +old::GuestToEmbedderChannel* RenderViewImpl::GetGuestToEmbedderChannel() const { return guest_to_embedder_channel_; } void RenderViewImpl::SetGuestToEmbedderChannel( - content::old::GuestToEmbedderChannel* channel) { + old::GuestToEmbedderChannel* channel) { guest_to_embedder_channel_ = channel; } @@ -944,7 +928,7 @@ bool RenderViewImpl::HasIMETextFocus() { bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; if (main_frame) - content::GetContentClient()->SetActiveURL(main_frame->document().url()); + GetContentClient()->SetActiveURL(main_frame->document().url()); ObserverListBase<RenderViewObserver>::Iterator it(observers_); RenderViewObserver* observer; @@ -1092,7 +1076,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { // If we don't have guest-to-embedder channel associated with this RenderView // but we need one, grab one now. if (!params.embedder_channel_name.empty() && !GetGuestToEmbedderChannel()) { - content::old::GuestToEmbedderChannel* embedder_channel = + old::GuestToEmbedderChannel* embedder_channel = RenderThreadImpl::current()->browser_plugin_channel_manager()-> GetChannelByName(params.embedder_channel_name); DCHECK(embedder_channel); @@ -1137,7 +1121,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { params.pending_history_list_offset < history_list_length_) history_page_ids_[params.pending_history_list_offset] = params.page_id; - content::GetContentClient()->SetActiveURL(params.url); + GetContentClient()->SetActiveURL(params.url); WebFrame* main_frame = webview()->mainFrame(); if (is_reload && main_frame->currentHistoryItem().isNull()) { @@ -1581,8 +1565,8 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { // will also call us back which will cause us to send a message to // update WebContentsImpl. webview()->zoomLimitsChanged( - WebView::zoomFactorToZoomLevel(content::kMinimumZoomFactor), - WebView::zoomFactorToZoomLevel(content::kMaximumZoomFactor)); + WebView::zoomFactorToZoomLevel(kMinimumZoomFactor), + WebView::zoomFactorToZoomLevel(kMaximumZoomFactor)); // Set zoom level, but don't do it for full-page plugin since they don't use // the same zoom settings. @@ -1607,7 +1591,7 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { params.contents_mime_type = ds->response().mimeType().utf8(); params.transition = navigation_state->transition_type(); - if (!content::PageTransitionIsMainFrame(params.transition)) { + if (!PageTransitionIsMainFrame(params.transition)) { // If the main frame does a load, it should not be reported as a subframe // navigation. This can occur in the following case: // 1. You're on a site with frames. @@ -1619,7 +1603,7 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { // We don't want that, because any navigation that changes the toplevel // frame should be tracked as a toplevel navigation (this allows us to // update the URL bar, etc). - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; } // If we have a valid consumed client redirect source, @@ -1628,8 +1612,8 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { if (completed_client_redirect_src_.url.is_valid()) { DCHECK(completed_client_redirect_src_.url == params.redirects[0]); params.referrer = completed_client_redirect_src_; - params.transition = static_cast<content::PageTransition>( - params.transition | content::PAGE_TRANSITION_CLIENT_REDIRECT); + params.transition = static_cast<PageTransition>( + params.transition | PAGE_TRANSITION_CLIENT_REDIRECT); } else { // Bug 654101: the referrer will be empty on https->http transitions. It // would be nice if we could get the real referrer from somewhere. @@ -1668,9 +1652,9 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { // mark it as such. This test checks if this is the first time UpdateURL // has been called since WillNavigateToURL was called to initiate the load. if (page_id_ > last_page_id_sent_to_browser_) - params.transition = content::PAGE_TRANSITION_MANUAL_SUBFRAME; + params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; else - params.transition = content::PAGE_TRANSITION_AUTO_SUBFRAME; + params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); } @@ -1680,7 +1664,7 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { // If we end up reusing this WebRequest (for example, due to a #ref click), // we don't want the transition type to persist. Just clear it. - navigation_state->set_transition_type(content::PAGE_TRANSITION_LINK); + navigation_state->set_transition_type(PAGE_TRANSITION_LINK); } // Tell the embedding application that the title of the active page has changed @@ -1691,7 +1675,7 @@ void RenderViewImpl::UpdateTitle(WebFrame* frame, if (frame->parent()) return; - string16 shortened_title = title.substr(0, content::kMaxTitleChars); + string16 shortened_title = title.substr(0, kMaxTitleChars); Send(new ViewHostMsg_UpdateTitle(routing_id_, page_id_, shortened_title, title_direction)); } @@ -1727,8 +1711,8 @@ void RenderViewImpl::SendUpdateState(const WebHistoryItem& item) { if (item.isNull()) return; - // Don't send state updates for content::kSwappedOutURL. - if (item.urlString() == WebString::fromUTF8(content::kSwappedOutURL)) + // Don't send state updates for kSwappedOutURL. + if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) return; Send(new ViewHostMsg_UpdateState( @@ -1761,18 +1745,18 @@ void RenderViewImpl::LoadNavigationErrorPage( if (!html.empty()) { error_html = &html; } else { - content::GetContentClient()->renderer()->GetNavigationErrorStrings( + GetContentClient()->renderer()->GetNavigationErrorStrings( failed_request, error, &alt_html, NULL); error_html = &alt_html; } frame->loadHTMLString(*error_html, - GURL(content::kUnreachableWebDataURL), + GURL(kUnreachableWebDataURL), error.unreachableURL, replace); } -bool RenderViewImpl::RunJavaScriptMessage(content::JavaScriptMessageType type, +bool RenderViewImpl::RunJavaScriptMessage(JavaScriptMessageType type, const string16& message, const string16& default_value, const GURL& frame_url, @@ -2130,15 +2114,15 @@ bool RenderViewImpl::runFileChooser( // Do not open the file dialog in a hidden RenderView. if (is_hidden()) return false; - content::FileChooserParams ipc_params; + FileChooserParams ipc_params; if (params.directory) - ipc_params.mode = content::FileChooserParams::OpenFolder; + ipc_params.mode = FileChooserParams::OpenFolder; else if (params.multiSelect) - ipc_params.mode = content::FileChooserParams::OpenMultiple; + ipc_params.mode = FileChooserParams::OpenMultiple; else if (params.saveAs) - ipc_params.mode = content::FileChooserParams::Save; + ipc_params.mode = FileChooserParams::Save; else - ipc_params.mode = content::FileChooserParams::Open; + ipc_params.mode = FileChooserParams::Open; ipc_params.title = params.title; ipc_params.default_file_name = webkit_glue::WebStringToFilePath(params.initialValue); @@ -2151,7 +2135,7 @@ bool RenderViewImpl::runFileChooser( void RenderViewImpl::runModalAlertDialog(WebFrame* frame, const WebString& message) { - RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_ALERT, + RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, message, string16(), frame->document().url(), @@ -2160,7 +2144,7 @@ void RenderViewImpl::runModalAlertDialog(WebFrame* frame, bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, const WebString& message) { - return RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, + return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, message, string16(), frame->document().url(), @@ -2172,7 +2156,7 @@ bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, const WebString& default_value, WebString* actual_value) { string16 result; - bool ok = RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_PROMPT, + bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, message, default_value, frame->document().url(), @@ -2213,7 +2197,7 @@ void RenderViewImpl::showContextMenu( if (GetGuestToEmbedderChannel()) return; - content::ContextMenuParams params(data); + ContextMenuParams params(data); // Plugins, e.g. PDF, don't currently update the render view when their // selected text changes, but the context menu params do contain the updated @@ -2235,12 +2219,12 @@ void RenderViewImpl::showContextMenu( if (frame) params.frame_id = frame->identifier(); - // Serializing a GURL longer than content::kMaxURLChars will fail, so don't do + // Serializing a GURL longer than kMaxURLChars will fail, so don't do // it. We replace it with an empty GURL so the appropriate items are disabled // in the context menu. // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large // data encoded images. We should have a way to save them. - if (params.src_url.spec().size() > content::kMaxURLChars) + if (params.src_url.spec().size() > kMaxURLChars) params.src_url = GURL(); context_menu_node_ = data.node; @@ -2277,9 +2261,9 @@ void RenderViewImpl::UpdateTargetURL(const GURL& url, pending_target_url_ = latest_url; target_url_status_ = TARGET_PENDING; } else { - // URLs larger than |content::kMaxURLChars| cannot be sent through IPC - + // URLs larger than |kMaxURLChars| cannot be sent through IPC - // see |ParamTraits<GURL>|. - if (latest_url.possibly_invalid_spec().size() > content::kMaxURLChars) + if (latest_url.possibly_invalid_spec().size() > kMaxURLChars) latest_url = GURL(); Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, latest_url)); target_url_ = latest_url; @@ -2436,7 +2420,7 @@ void RenderViewImpl::show(WebNavigationPolicy policy) { return; did_show_ = true; - if (content::GetContentClient()->renderer()->AllowPopup(creator_url_)) + if (GetContentClient()->renderer()->AllowPopup(creator_url_)) opened_by_user_gesture_ = true; // Force new windows to a popup if they were not opened with a user gesture. @@ -2513,20 +2497,19 @@ void RenderViewImpl::didActivateCompositor(int input_handler_identifier) { WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, const WebPluginParams& params) { WebPlugin* plugin = NULL; - if (content::GetContentClient()->renderer()->OverrideCreatePlugin( + if (GetContentClient()->renderer()->OverrideCreatePlugin( this, frame, params, &plugin)) { return plugin; } const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); - if (UTF16ToASCII(params.mimeType) == content::kBrowserPluginMimeType) { + if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { if (cmd_line->HasSwitch(switches::kEnableBrowserPluginOldImplementation)) { // TODO(fsamuel): Remove this once upstreaming of the new browser plugin // is complete. - return content::old::BrowserPlugin::Create(this, frame, params); + return old::BrowserPlugin::Create(this, frame, params); } else { - return content::BrowserPluginManager::Get()->CreateBrowserPlugin(this, - frame, + return BrowserPluginManager::Get()->CreateBrowserPlugin(this, frame, params); } } @@ -2582,7 +2565,7 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( GpuChannelHost* gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( - content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); + CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); if (!gpu_channel_host) { LOG(ERROR) << "Failed to establish GPU channel for media player"; return NULL; @@ -2599,12 +2582,12 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( cookieJar(frame), media_player_manager_.get(), media_bridge_manager_.get(), - new content::StreamTextureFactoryImpl( + new StreamTextureFactoryImpl( resource_context, gpu_channel_host, routing_id_), cmd_line->HasSwitch(switches::kDisableMediaHistoryLogging)); } if (!media_player_proxy_) { - media_player_proxy_ = new content::WebMediaPlayerProxyImplAndroid( + media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( this, media_player_manager_.get()); } return new webkit_media::WebMediaPlayerImplAndroid( @@ -2612,7 +2595,7 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( client, media_player_manager_.get(), media_player_proxy_, - new content::StreamTextureFactoryImpl( + new StreamTextureFactoryImpl( resource_context, gpu_channel_host, routing_id_)); #endif @@ -2647,7 +2630,7 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( base::MessageLoopProxy::current(); GpuChannelHost* gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( - content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); + CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); collection->GetVideoDecoders()->push_back(new media::GpuVideoDecoder( base::Bind(&media::MessageLoopFactory::GetMessageLoop, base::Unretained(message_loop_factory), @@ -2658,7 +2641,7 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( } WebMediaPlayer* media_player = - content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( + GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( this, frame, client, AsWeakPtr(), collection, audio_source_provider, audio_source_provider, message_loop_factory, media_stream_impl_, render_media_log); @@ -2750,7 +2733,7 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( GetReferrerPolicyFromRequest(frame, request)); if (is_swapped_out_) { - if (request.url() != GURL(content::kSwappedOutURL)) { + if (request.url() != GURL(kSwappedOutURL)) { // Targeted links may try to navigate a swapped out frame. Allow the // browser process to navigate the tab instead. Note that it is also // possible for non-targeted navigations (from this view) to arrive @@ -2768,7 +2751,7 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( return WebKit::WebNavigationPolicyIgnore; } - // Allow content::kSwappedOutURL to complete. + // Allow kSwappedOutURL to complete. return default_policy; } @@ -2858,8 +2841,8 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); bool is_initial_navigation = page_id_ == -1; bool should_fork = - content::GetContentClient()->HasWebUIScheme(url) || - (cumulative_bindings & content::BINDINGS_POLICY_WEB_UI) || + GetContentClient()->HasWebUIScheme(url) || + (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || url.SchemeIs(chrome::kViewSourceScheme) || frame->isViewSourceModeEnabled(); @@ -2880,7 +2863,7 @@ WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( // with hosted apps and extensions than WebUI pages. We will remove this // check when cross-process POST submissions are supported. if (request.httpMethod() == "GET") { - should_fork = content::GetContentClient()->renderer()->ShouldFork( + should_fork = GetContentClient()->renderer()->ShouldFork( frame, url, is_initial_navigation, &send_referrer); } } @@ -2968,7 +2951,7 @@ void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, // a copy of the password in case it gets lost. DocumentState* document_state = DocumentState::FromDataSource(frame->dataSource()); - document_state->set_password_form_data(content::CreatePasswordForm(form)); + document_state->set_password_form_data(CreatePasswordForm(form)); } void RenderViewImpl::willSubmitForm(WebFrame* frame, @@ -2977,8 +2960,8 @@ void RenderViewImpl::willSubmitForm(WebFrame* frame, DocumentState::FromDataSource(frame->provisionalDataSource()); NavigationState* navigation_state = document_state->navigation_state(); - if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) - navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); + if (navigation_state->transition_type() == PAGE_TRANSITION_LINK) + navigation_state->set_transition_type(PAGE_TRANSITION_FORM_SUBMIT); // Save these to be processed when the ensuing navigation is committed. WebSearchableFormData web_searchable_form_data(form); @@ -2986,7 +2969,7 @@ void RenderViewImpl::willSubmitForm(WebFrame* frame, document_state->set_searchable_form_encoding( web_searchable_form_data.encoding().utf8()); scoped_ptr<PasswordForm> password_form_data = - content::CreatePasswordForm(form); + CreatePasswordForm(form); // In order to save the password that the user actually typed and not one // that may have gotten transformed by the site prior to submit, recover it @@ -3246,7 +3229,7 @@ void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { // Take note of AUTO_SUBFRAME loads here, so that we can know how to // load an error page. See didFailProvisionalLoad. document_state->navigation_state()->set_transition_type( - content::PAGE_TRANSITION_AUTO_SUBFRAME); + PAGE_TRANSITION_AUTO_SUBFRAME); } FOR_EACH_OBSERVER( @@ -3301,7 +3284,7 @@ void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame, params.frame_id = frame->identifier(); params.is_main_frame = !frame->parent(); params.error_code = error.reason; - content::GetContentClient()->renderer()->GetNavigationErrorStrings( + GetContentClient()->renderer()->GetNavigationErrorStrings( failed_request, error, NULL, @@ -3333,7 +3316,7 @@ void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame, bool replace = navigation_state->pending_page_id() != -1 || navigation_state->transition_type() == - content::PAGE_TRANSITION_AUTO_SUBFRAME; + PAGE_TRANSITION_AUTO_SUBFRAME; // If we failed on a browser initiated request, then make sure that our error // page load is regarded as the same browser initiated request. @@ -3387,18 +3370,18 @@ void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, // We bump our Page ID to correspond with the new session history entry. page_id_ = next_page_id_++; - // Don't update history_page_ids_ (etc) for content::kSwappedOutURL, since + // Don't update history_page_ids_ (etc) for kSwappedOutURL, since // we don't want to forget the entry that was there, and since we will - // never come back to content::kSwappedOutURL. Note that we have to call + // never come back to kSwappedOutURL. Note that we have to call // UpdateSessionHistory and update page_id_ even in this case, so that // the current entry gets a state update and so that we don't send a // state update to the wrong entry when we swap back in. - if (GetLoadingUrl(frame) != GURL(content::kSwappedOutURL)) { + if (GetLoadingUrl(frame) != GURL(kSwappedOutURL)) { // Advance our offset in session history, applying the length limit. // There is now no forward history. history_list_offset_++; - if (history_list_offset_ >= content::kMaxSessionHistoryEntries) - history_list_offset_ = content::kMaxSessionHistoryEntries - 1; + if (history_list_offset_ >= kMaxSessionHistoryEntries) + history_list_offset_ = kMaxSessionHistoryEntries - 1; history_list_length_ = history_list_offset_ + 1; history_page_ids_.resize(history_list_length_, -1); history_page_ids_[history_list_offset_] = page_id_; @@ -3465,23 +3448,23 @@ void RenderViewImpl::didClearWindowObject(WebFrame* frame) { DidClearWindowObject(frame)); GURL frame_url = frame->document().url(); - if ((enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) && + if ((enabled_bindings_ & BINDINGS_POLICY_WEB_UI) && (frame_url.SchemeIs(chrome::kChromeUIScheme) || frame_url.SchemeIs(chrome::kDataScheme))) { GetWebUIBindings()->BindToJavascript(frame, "chrome"); } - if (enabled_bindings_ & content::BINDINGS_POLICY_DOM_AUTOMATION) { + if (enabled_bindings_ & BINDINGS_POLICY_DOM_AUTOMATION) { if (!dom_automation_controller_.get()) dom_automation_controller_.reset(new DomAutomationController()); dom_automation_controller_->set_message_sender( - static_cast<content::RenderView*>(this)); + static_cast<RenderView*>(this)); dom_automation_controller_->set_routing_id(routing_id()); dom_automation_controller_->BindToJavascript(frame, "domAutomationController"); } - content::InjectDoNotTrackBindings(frame); + InjectDoNotTrackBindings(frame); } void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) { @@ -3539,7 +3522,7 @@ void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { const WebURLRequest& failed_request = ds->request(); string16 error_description; - content::GetContentClient()->renderer()->GetNavigationErrorStrings( + GetContentClient()->renderer()->GetNavigationErrorStrings( failed_request, error, NULL, @@ -3609,7 +3592,7 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, WebDataSource* data_source = provisional_data_source ? provisional_data_source : top_data_source; - content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; + PageTransition transition_type = PAGE_TRANSITION_LINK; DocumentState* document_state = DocumentState::FromDataSource(data_source); DCHECK(document_state); NavigationState* navigation_state = document_state->navigation_state(); @@ -3617,7 +3600,7 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, GURL request_url(request.url()); GURL new_url; - if (content::GetContentClient()->renderer()->WillSendRequest( + if (GetContentClient()->renderer()->WillSendRequest( frame, transition_type, request_url, &new_url)) { request.setURL(WebURL(new_url)); } @@ -3750,7 +3733,7 @@ void RenderViewImpl::didFinishResourceLoad( } std::string error_domain; - if (content::GetContentClient()->renderer()->HasErrorPage( + if (GetContentClient()->renderer()->HasErrorPage( http_status_code, &error_domain)) { WebURLError error; error.unreachableURL = frame->document().url(); @@ -3809,7 +3792,7 @@ void RenderViewImpl::didCreateScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int extension_group, int world_id) { - content::GetContentClient()->renderer()->DidCreateScriptContext( + GetContentClient()->renderer()->DidCreateScriptContext( frame, context, extension_group, world_id); intents_host_->DidCreateScriptContext( @@ -3819,7 +3802,7 @@ void RenderViewImpl::didCreateScriptContext(WebFrame* frame, void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { - content::GetContentClient()->renderer()->WillReleaseScriptContext( + GetContentClient()->renderer()->WillReleaseScriptContext( frame, context, world_id); } @@ -3886,7 +3869,7 @@ WebGraphicsContext3D* RenderViewImpl::CreateGraphicsContext3D( if (!context->Initialize( attributes, false /* bind generates resources */, - content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) return NULL; return context.release(); } @@ -3913,18 +3896,16 @@ void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, NavigateToSwappedOutURL(frame); string16 name; - if (frame_tree->GetString(content::kFrameTreeNodeNameKey, &name) && - !name.empty()) { + if (frame_tree->GetString(kFrameTreeNodeNameKey, &name) && !name.empty()) frame->setName(name); - } int remote_id; - if (frame_tree->GetInteger(content::kFrameTreeNodeIdKey, &remote_id)) + if (frame_tree->GetInteger(kFrameTreeNodeIdKey, &remote_id)) active_frame_id_map_.insert(std::pair<int, int>(frame->identifier(), remote_id)); ListValue* children; - if (!frame_tree->GetList(content::kFrameTreeNodeSubtreeKey, &children)) + if (!frame_tree->GetList(kFrameTreeNodeSubtreeKey, &children)) return; // Create an invisible iframe tree in the swapped out page. @@ -4280,7 +4261,7 @@ void RenderViewImpl::didSerializeDataForFrame( static_cast<int32>(status))); } -// content::RenderView implementation ------------------------------------------ +// RenderView implementation --------------------------------------------------- bool RenderViewImpl::Send(IPC::Message* message) { return RenderWidget::Send(message); @@ -4441,10 +4422,10 @@ float RenderViewImpl::GetFilteredTimePerFrame() const { return filtered_time_per_frame(); } -int RenderViewImpl::ShowContextMenu(content::ContextMenuClient* client, - const content::ContextMenuParams& params) { +int RenderViewImpl::ShowContextMenu(ContextMenuClient* client, + const ContextMenuParams& params) { DCHECK(client); // A null client means "internal" when we issue callbacks. - content::ContextMenuParams our_params(params); + ContextMenuParams our_params(params); our_params.custom_context.request_id = pending_context_menus_.Add(client); Send(new ViewHostMsg_ContextMenu(routing_id_, our_params)); return our_params.custom_context.request_id; @@ -4498,7 +4479,7 @@ webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement( const FilePath& file_path) { - return content::GetContentClient()->renderer()->CreatePluginReplacement( + return GetContentClient()->renderer()->CreatePluginReplacement( this, file_path); } @@ -4694,7 +4675,7 @@ GURL RenderViewImpl::GetLoadingUrl(WebKit::WebFrame* frame) const { WebUIBindings* RenderViewImpl::GetWebUIBindings() { if (!web_ui_bindings_.get()) { web_ui_bindings_.reset(new WebUIBindings( - static_cast<content::RenderView*>(this), routing_id_)); + static_cast<RenderView*>(this), routing_id_)); } return web_ui_bindings_.get(); } @@ -4834,7 +4815,7 @@ void RenderViewImpl::Find(int request_id, } } -void RenderViewImpl::OnStopFinding(content::StopFindAction action) { +void RenderViewImpl::OnStopFinding(StopFindAction action) { #if defined(OS_ANDROID) // Make sure any asynchronous messages do not disrupt an ongoing synchronous // find request as it might lead to deadlocks. Also, these should be safe to @@ -4846,7 +4827,7 @@ void RenderViewImpl::OnStopFinding(content::StopFindAction action) { StopFinding(action); } -void RenderViewImpl::StopFinding(content::StopFindAction action) { +void RenderViewImpl::StopFinding(StopFindAction action) { WebView* view = webview(); if (!view) return; @@ -4857,7 +4838,7 @@ void RenderViewImpl::StopFinding(content::StopFindAction action) { return; } - bool clear_selection = action == content::STOP_FIND_ACTION_CLEAR_SELECTION; + bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION; if (clear_selection) view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); @@ -4867,7 +4848,7 @@ void RenderViewImpl::StopFinding(content::StopFindAction action) { frame = frame->traverseNext(false); } - if (action == content::STOP_FIND_ACTION_ACTIVATE_SELECTION) { + if (action == STOP_FIND_ACTION_ACTIVATE_SELECTION) { WebFrame* focused_frame = view->focusedFrame(); if (focused_frame) { WebDocument doc = focused_frame->document(); @@ -4892,7 +4873,7 @@ void RenderViewImpl::OnSynchronousFind(int request_id, // Find next should be asynchronous in order to minimize blocking // the UI thread as much as possible. DCHECK(!options.findNext); - StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION); + StopFinding(STOP_FIND_ACTION_KEEP_SELECTION); synchronous_find_active_match_ordinal_ = -1; Find(request_id, search_string, options); @@ -4946,7 +4927,7 @@ void RenderViewImpl::OnFindMatchRects(int current_version) { } #endif -void RenderViewImpl::OnZoom(content::PageZoom zoom) { +void RenderViewImpl::OnZoom(PageZoom zoom) { if (!webview()) // Not sure if this can happen, but no harm in being safe. return; @@ -4954,7 +4935,7 @@ void RenderViewImpl::OnZoom(content::PageZoom zoom) { double old_zoom_level = webview()->zoomLevel(); double zoom_level; - if (zoom == content::PAGE_ZOOM_RESET) { + if (zoom == PAGE_ZOOM_RESET) { zoom_level = 0; } else if (static_cast<int>(old_zoom_level) == old_zoom_level) { // Previous zoom level is a whole number, so just increment/decrement. @@ -4976,13 +4957,13 @@ void RenderViewImpl::OnZoom(content::PageZoom zoom) { zoomLevelChanged(); } -void RenderViewImpl::OnZoomFactor(content::PageZoom zoom, - int zoom_center_x, int zoom_center_y) { +void RenderViewImpl::OnZoomFactor(PageZoom zoom, int zoom_center_x, + int zoom_center_y) { ZoomFactorHelper(zoom, zoom_center_x, zoom_center_y, kScalingIncrementForGesture); } -void RenderViewImpl::ZoomFactorHelper(content::PageZoom zoom, +void RenderViewImpl::ZoomFactorHelper(PageZoom zoom, int zoom_center_x, int zoom_center_y, float scaling_increment) { @@ -4991,7 +4972,7 @@ void RenderViewImpl::ZoomFactorHelper(content::PageZoom zoom, double old_page_scale_factor = webview()->pageScaleFactor(); double page_scale_factor; - if (zoom == content::PAGE_ZOOM_RESET) { + if (zoom == PAGE_ZOOM_RESET) { page_scale_factor = 1.0; } else { page_scale_factor = old_page_scale_factor + @@ -5110,7 +5091,7 @@ void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { void RenderViewImpl::OnSetWebUIProperty(const std::string& name, const std::string& value) { - if (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) + if (enabled_bindings_ & BINDINGS_POLICY_WEB_UI) GetWebUIBindings()->SetProperty(name, value); else NOTREACHED() << "WebUI bindings not enabled."; @@ -5186,11 +5167,11 @@ void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { } void RenderViewImpl::OnCustomContextMenuAction( - const content::CustomContextMenuContext& custom_context, + const CustomContextMenuContext& custom_context, unsigned action) { if (custom_context.request_id) { // External context menu request, look in our map. - content::ContextMenuClient* client = + ContextMenuClient* client = pending_context_menus_.Lookup(custom_context.request_id); if (client) client->OnMenuAction(custom_context.request_id, action); @@ -5277,7 +5258,7 @@ void RenderViewImpl::OnDisableScrollbarsForSmallWindows( } void RenderViewImpl::OnSetRendererPrefs( - const content::RendererPreferences& renderer_prefs) { + const RendererPreferences& renderer_prefs) { double old_zoom_level = renderer_preferences_.default_zoom_level; renderer_preferences_ = renderer_prefs; UpdateFontRenderingFromRendererPrefs(); @@ -5311,7 +5292,7 @@ void RenderViewImpl::OnSetRendererPrefs( // If the zoom level for this page matches the old zoom default, and this // is not a plugin, update the zoom level to match the new default. if (webview() && !webview()->mainFrame()->document().isPluginDocument() && - content::ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { + ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { webview()->setZoomLevel(false, renderer_preferences_.default_zoom_level); zoomLevelChanged(); } @@ -5345,12 +5326,12 @@ void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( &referrer_policies_list, &frames_list); - // webkit/ doesn't know about content::Referrer. + // webkit/ doesn't know about Referrer. if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage( webview(), page_url, &result, - const_cast<const char**>(content::GetSavableSchemes()))) { + const_cast<const char**>(GetSavableSchemes()))) { // If something is wrong when collecting all savable resource links, // send empty list to embedder(browser) to tell it failed. referrer_urls_list.clear(); @@ -5359,11 +5340,11 @@ void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( frames_list.clear(); } - std::vector<content::Referrer> referrers_list; + std::vector<Referrer> referrers_list; CHECK_EQ(referrer_urls_list.size(), referrer_policies_list.size()); for (unsigned i = 0; i < referrer_urls_list.size(); ++i) { referrers_list.push_back( - content::Referrer(referrer_urls_list[i], referrer_policies_list[i])); + Referrer(referrer_urls_list[i], referrer_policies_list[i])); } // Send result of all savable resource links to embedder. @@ -5439,9 +5420,9 @@ void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { void RenderViewImpl::NavigateToSwappedOutURL(WebKit::WebFrame* frame) { // We use loadRequest instead of loadHTMLString because the former commits // synchronously. Otherwise a new navigation can interrupt the navigation - // to content::kSwappedOutURL. If that happens to be to the page we had been + // to kSwappedOutURL. If that happens to be to the page we had been // showing, then WebKit will never send a commit and we'll be left spinning. - GURL swappedOutURL(content::kSwappedOutURL); + GURL swappedOutURL(kSwappedOutURL); WebURLRequest request(swappedOutURL); frame->loadRequest(request); } @@ -5510,7 +5491,7 @@ bool RenderViewImpl::MaybeLoadAlternateErrorPage(WebFrame* frame, // Load an empty page first so there is an immediate response to the error, // and then kick off a request for the alternate error page. frame->loadHTMLString(std::string(), - GURL(content::kUnreachableWebDataURL), + GURL(kUnreachableWebDataURL), error.unreachableURL, replace); @@ -5877,7 +5858,7 @@ void RenderViewImpl::PpapiPluginSelectionChanged() { SyncSelectionIfRequired(); } -void RenderViewImpl::PpapiPluginCreated(content::RendererPpapiHost* host) { +void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCreatePepperPlugin(host)); } @@ -6104,7 +6085,7 @@ void RenderViewImpl::AcceleratedSurfaceBuffersSwapped( #endif // defined(OS_MACOSX) bool RenderViewImpl::ScheduleFileChooser( - const content::FileChooserParams& params, + const FileChooserParams& params, WebFileChooserCompletion* completion) { static const size_t kMaximumPendingFileChooseRequests = 4; if (file_chooser_completions_.size() > kMaximumPendingFileChooseRequests) { @@ -6210,7 +6191,7 @@ WebKit::WebPageVisibilityState RenderViewImpl::visibilityState() const { WebKit::WebPageVisibilityStateHidden : WebKit::WebPageVisibilityStateVisible; WebKit::WebPageVisibilityState override_state = current_state; - if (content::GetContentClient()->renderer()-> + if (GetContentClient()->renderer()-> ShouldOverridePageVisibilityState(this, &override_state)) return override_state; @@ -6330,10 +6311,10 @@ void RenderViewImpl::OnSelectPopupMenuItems( #endif void RenderViewImpl::OnContextMenuClosed( - const content::CustomContextMenuContext& custom_context) { + const CustomContextMenuContext& custom_context) { if (custom_context.request_id) { // External request, should be in our map. - content::ContextMenuClient* client = + ContextMenuClient* client = pending_context_menus_.Lookup(custom_context.request_id); if (client) { client->OnMenuClosed(custom_context.request_id); @@ -6395,7 +6376,6 @@ void RenderViewImpl::OnUpdatedFrameTree( bool RenderViewImpl::didTapMultipleTargets( const WebKit::WebGestureEvent& event, const WebVector<WebRect>& target_rects) { - using content::DisambiguationPopupHelper; gfx::Rect finger_rect( event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, event.data.tap.width, event.data.tap.height); @@ -6435,3 +6415,5 @@ void RenderViewImpl::OnReleaseDisambiguationPopupDIB( TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); RenderProcess::current()->ReleaseTransportDIB(dib); } + +} // namespace content diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 84d9773..16659b5 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -5,11 +5,7 @@ #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ -#include <deque> -#include <map> #include <set> -#include <string> -#include <vector> #include "base/basictypes.h" #include "base/gtest_prod_util.h" @@ -46,7 +42,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" @@ -68,57 +63,17 @@ #endif class CommandLine; -class DeviceOrientationDispatcher; -class DevToolsAgent; class DomAutomationController; -class ExternalPopupMenu; -class GeolocationDispatcher; -class GURL; class JavaBridgeDispatcher; -class LoadProgressTracker; -class MediaStreamDispatcher; -class MediaStreamImpl; -class MouseLockDispatcher; -class NotificationProvider; class PepperDeviceTest; -struct PP_NetAddress_Private; -class RenderWidgetFullscreenPepper; -class RendererWebColorChooserImpl; class SkBitmap; -class InputTagSpeechDispatcher; -class SpeechRecognitionDispatcher; +class WebUIBindings; +struct PP_NetAddress_Private; struct ViewMsg_Navigate_Params; struct ViewMsg_PostMessage_Params; struct ViewMsg_StopFinding_Params; struct ViewMsg_SwapOut_Params; struct WebDropData; -class WebIntentsHost; -class WebPluginDelegateProxy; -class WebUIBindings; - -namespace content { -class DocumentState; -class NavigationState; -class RenderViewObserver; -class RenderViewTest; -class RendererAccessibility; -class RendererPpapiHost; -#if defined(OS_ANDROID) -class WebMediaPlayerProxyImplAndroid; -#endif -struct CustomContextMenuContext; -struct FileChooserParams; - -namespace old { -class GuestToEmbedderChannel; -} - -} // namespace content - -namespace gfx { -class Point; -class Rect; -} // namespace gfx namespace ui { struct SelectedFileInfo; @@ -154,9 +109,6 @@ class WebDataSource; class WebDragData; class WebGeolocationClient; class WebGestureEvent; -#if defined(OS_ANDROID) -class WebHitTestResult; -#endif class WebIconURL; class WebImage; class WebPeerConnection00Handler; @@ -181,6 +133,43 @@ struct WebMediaPlayerAction; struct WebPluginAction; struct WebPoint; struct WebWindowFeatures; + +#if defined(OS_ANDROID) +class WebHitTestResult; +#endif +} + +namespace content { +class DeviceOrientationDispatcher; +class DevToolsAgent; +class DocumentState; +class ExternalPopupMenu; +class GeolocationDispatcher; +class InputTagSpeechDispatcher; +class LoadProgressTracker; +class MediaStreamDispatcher; +class MediaStreamImpl; +class MouseLockDispatcher; +class NavigationState; +class NotificationProvider; +class RenderViewObserver; +class RenderViewTest; +class RendererAccessibility; +class RendererPpapiHost; +class RendererWebColorChooserImpl; +class RenderWidgetFullscreenPepper; +class SpeechRecognitionDispatcher; +class WebIntentsHost; +class WebPluginDelegateProxy; +struct CustomContextMenuContext; +struct FileChooserParams; + +#if defined(OS_ANDROID) +class WebMediaPlayerProxyImplAndroid; +#endif + +namespace old { +class GuestToEmbedderChannel; } // We need to prevent a page from trying to create infinite popups. It is not @@ -205,7 +194,7 @@ class RenderViewImpl : public RenderWidget, public WebKit::WebViewClient, public WebKit::WebFrameClient, public WebKit::WebPageSerializerClient, - public content::RenderView, + public RenderView, public webkit::npapi::WebPluginPageDelegate, public webkit_media::WebMediaPlayerDelegate, public WebGraphicsContext3DSwapBuffersClient, @@ -220,7 +209,7 @@ class RenderViewImpl : public RenderWidget, CONTENT_EXPORT static RenderViewImpl* Create( gfx::NativeViewId parent_hwnd, int32 opener_id, - const content::RendererPreferences& renderer_prefs, + const RendererPreferences& renderer_prefs, const webkit_glue::WebPreferences& webkit_prefs, SharedRenderViewCounter* counter, int32 routing_id, @@ -231,7 +220,7 @@ class RenderViewImpl : public RenderWidget, bool swapped_out, int32 next_page_id, const WebKit::WebScreenInfo& screen_info, - content::old::GuestToEmbedderChannel* guest_to_embedder_channel, + old::GuestToEmbedderChannel* guest_to_embedder_channel, AccessibilityMode accessibility_mode); // Returns the RenderViewImpl containing the given WebView. @@ -277,8 +266,8 @@ class RenderViewImpl : public RenderWidget, #endif // Functions to add and remove observers for this object. - void AddObserver(content::RenderViewObserver* observer); - void RemoveObserver(content::RenderViewObserver* observer); + void AddObserver(RenderViewObserver* observer); + void RemoveObserver(RenderViewObserver* observer); // Adds the given file chooser request to the file_chooser_completion_ queue // (see that var for more) and requests the chooser be displayed if there are @@ -286,14 +275,14 @@ class RenderViewImpl : public RenderWidget, // // Returns true if the chooser was successfully scheduled. False means we // didn't schedule anything. - bool ScheduleFileChooser(const content::FileChooserParams& params, + bool ScheduleFileChooser(const FileChooserParams& params, WebKit::WebFileChooserCompletion* completion); // Sets whether the renderer should report load progress to the browser. void SetReportLoadProgressEnabled(bool enabled); - content::old::GuestToEmbedderChannel* GetGuestToEmbedderChannel() const; - void SetGuestToEmbedderChannel(content::old::GuestToEmbedderChannel* channel); + old::GuestToEmbedderChannel* GetGuestToEmbedderChannel() const; + void SetGuestToEmbedderChannel(old::GuestToEmbedderChannel* channel); PP_Instance guest_pp_instance() const { return guest_pp_instance_; } void set_guest_pp_instance(PP_Instance instance) { guest_pp_instance_ = instance; @@ -346,7 +335,7 @@ class RenderViewImpl : public RenderWidget, void PpapiPluginSelectionChanged(); // Notification that a PPAPI plugin has been created. - void PpapiPluginCreated(content::RendererPpapiHost* host); + void PpapiPluginCreated(RendererPpapiHost* host); // Retrieves the current caret position if a PPAPI plugin has focus. bool GetPpapiPluginCaretBounds(gfx::Rect* rect); @@ -698,7 +687,7 @@ class RenderViewImpl : public RenderWidget, const WebKit::WebCString& data, PageSerializationStatus status) OVERRIDE; - // content::RenderView implementation ---------------------------------------- + // RenderView implementation ------------------------------------------------- virtual bool Send(IPC::Message* message) OVERRIDE; virtual int GetRoutingID() const OVERRIDE; @@ -721,9 +710,8 @@ class RenderViewImpl : public RenderWidget, virtual int GetEnabledBindings() const OVERRIDE; virtual bool GetContentStateImmediately() const OVERRIDE; virtual float GetFilteredTimePerFrame() const OVERRIDE; - virtual int ShowContextMenu( - content::ContextMenuClient* client, - const content::ContextMenuParams& params) OVERRIDE; + virtual int ShowContextMenu(ContextMenuClient* client, + const ContextMenuParams& params) OVERRIDE; virtual void CancelContextMenu(int request_id) OVERRIDE; virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE; virtual void RunModalAlertDialog(WebKit::WebFrame* frame, @@ -810,7 +798,7 @@ class RenderViewImpl : public RenderWidget, friend class PepperDeviceTest; friend class RendererAccessibilityTest; friend class WebIntentsHostTest; - friend class content::RenderViewTest; + friend class RenderViewTest; FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); @@ -853,7 +841,7 @@ class RenderViewImpl : public RenderWidget, RenderViewImpl(gfx::NativeViewId parent_hwnd, int32 opener_id, - const content::RendererPreferences& renderer_prefs, + const RendererPreferences& renderer_prefs, const webkit_glue::WebPreferences& webkit_prefs, SharedRenderViewCounter* counter, int32 routing_id, @@ -864,8 +852,7 @@ class RenderViewImpl : public RenderWidget, bool swapped_out, int32 next_page_id, const WebKit::WebScreenInfo& screen_info, - content::old::GuestToEmbedderChannel* - guest_to_embedder_channel, + old::GuestToEmbedderChannel* guest_to_embedder_channel, AccessibilityMode accessibility_mode); // Do not delete directly. This class is reference counted. @@ -895,10 +882,10 @@ class RenderViewImpl : public RenderWidget, void OpenURL(WebKit::WebFrame* frame, const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WebKit::WebNavigationPolicy policy); - bool RunJavaScriptMessage(content::JavaScriptMessageType type, + bool RunJavaScriptMessage(JavaScriptMessageType type, const string16& message, const string16& default_value, const GURL& frame_url, @@ -926,15 +913,13 @@ class RenderViewImpl : public RenderWidget, void OnCancelDownload(int32 download_id); void OnClearFocusedNode(); void OnClosePage(); - void OnContextMenuClosed( - const content::CustomContextMenuContext& custom_context); + void OnContextMenuClosed(const CustomContextMenuContext& custom_context); void OnCopy(); void OnCopyImageAt(int x, int y); void OnCut(); void OnCSSInsertRequest(const string16& frame_xpath, const std::string& css); - void OnCustomContextMenuAction( - const content::CustomContextMenuContext& custom_context, + void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, unsigned action); void OnDelete(); void OnDeterminePageLanguage(); @@ -1016,14 +1001,14 @@ class RenderViewImpl : public RenderWidget, void OnSetInitialFocus(bool reverse); void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect); void OnSetPageEncoding(const std::string& encoding_name); - void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs); + void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); void OnSetZoomLevel(double zoom_level); CONTENT_EXPORT void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); void OnExitFullscreen(); void OnShouldClose(); void OnStop(); - void OnStopFinding(content::StopFindAction action); + void OnStopFinding(StopFindAction action); CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params); void OnThemeChanged(); void OnUndo(); @@ -1033,9 +1018,8 @@ class RenderViewImpl : public RenderWidget, const webkit_glue::WebPreferences& prefs); CONTENT_EXPORT void OnUnselect(); - void OnZoom(content::PageZoom zoom); - void OnZoomFactor(content::PageZoom zoom, int zoom_center_x, - int zoom_center_y); + void OnZoom(PageZoom zoom); + void OnZoomFactor(PageZoom zoom, int zoom_center_x, int zoom_center_y); void OnEnableViewSourceMode(); @@ -1070,8 +1054,8 @@ class RenderViewImpl : public RenderWidget, // and put it in the same position in the .cc file. // Misc private functions ---------------------------------------------------- - void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x, - int zoom_center_y, float scaling_increment); + void ZoomFactorHelper(PageZoom zoom, int zoom_center_x, int zoom_center_y, + float scaling_increment); void AltErrorPageFinished(WebKit::WebFrame* frame, const WebKit::WebURLError& original_error, @@ -1161,11 +1145,11 @@ class RenderViewImpl : public RenderWidget, // If we initiated a navigation, this function will populate |document_state| // with the navigation information saved in OnNavigate(). - void PopulateDocumentStateFromPending(content::DocumentState* document_state); + void PopulateDocumentStateFromPending(DocumentState* document_state); // Returns a new NavigationState populated with the navigation information // saved in OnNavigate(). - content::NavigationState* CreateNavigationStateFromPending(); + NavigationState* CreateNavigationStateFromPending(); // Processes the command-line flags --enable-viewport and // --enable-fixed-layout[=w,h]. @@ -1187,7 +1171,7 @@ class RenderViewImpl : public RenderWidget, void StartNavStateSyncTimerIfNecessary(); // Stops the current find-in-page search. - void StopFinding(content::StopFindAction action); + void StopFinding(StopFindAction action); // Dispatches the current navigation state to the browser. Called on a // periodic timer so we don't send too many messages. @@ -1217,7 +1201,7 @@ class RenderViewImpl : public RenderWidget, // Settings ------------------------------------------------------------------ webkit_glue::WebPreferences webkit_preferences_; - content::RendererPreferences renderer_preferences_; + RendererPreferences renderer_preferences_; HostZoomLevels host_zoom_levels_; @@ -1268,7 +1252,7 @@ class RenderViewImpl : public RenderWidget, // of the page that initiated it. Specifically, when a load is committed this // is used to determine if that load originated from a client-side redirect. // It is empty if there is no top-level client-side redirect. - content::Referrer completed_client_redirect_src_; + Referrer completed_client_redirect_src_; // Holds state pertaining to a navigation that we initiated. This is held by // the WebDataSource::ExtraData attribute. We use pending_navigation_state_ @@ -1280,7 +1264,7 @@ class RenderViewImpl : public RenderWidget, base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_; // Page IDs ------------------------------------------------------------------ - // See documentation in content::RenderView. + // See documentation in RenderView. int32 page_id_; // Indicates the ID of the last page that we sent a FrameNavigate to the @@ -1362,8 +1346,7 @@ class RenderViewImpl : public RenderWidget, // plugins) are normally only on "regular" pages and the regular pages will // always respond properly to the request, so we don't have to worry so // much about leaks. - IDMap<content::ContextMenuClient, IDMapExternalPointer> - pending_context_menus_; + IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_; // View ---------------------------------------------------------------------- @@ -1431,7 +1414,7 @@ class RenderViewImpl : public RenderWidget, // Only valid if |accessibility_mode_| is anything other than // AccessibilityModeOff. - content::RendererAccessibility* renderer_accessibility_; + RendererAccessibility* renderer_accessibility_; // Java Bridge dispatcher attached to this view; lazily initialized. JavaBridgeDispatcher* java_bridge_dispatcher_; @@ -1447,13 +1430,12 @@ class RenderViewImpl : public RenderWidget, size_t expected_content_intent_id_; // List of click-based content detectors. - typedef std::vector< linked_ptr<content::ContentDetector> > - ContentDetectorList; + typedef std::vector< linked_ptr<ContentDetector> > ContentDetectorList; ContentDetectorList content_detectors_; // Proxy class for WebMediaPlayer to communicate with the real media player // objects in browser process. - content::WebMediaPlayerProxyImplAndroid* media_player_proxy_; + WebMediaPlayerProxyImplAndroid* media_player_proxy_; // The media player manager for managing all the media players on this view. scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; @@ -1518,7 +1500,7 @@ class RenderViewImpl : public RenderWidget, // All the registered observers. We expect this list to be small, so vector // is fine. - ObserverList<content::RenderViewObserver> observers_; + ObserverList<RenderViewObserver> observers_; // Used to inform didChangeSelection() when it is called in the context // of handling a ViewMsg_SelectRange IPC. @@ -1544,8 +1526,7 @@ class RenderViewImpl : public RenderWidget, scoped_ptr<DomAutomationController> dom_automation_controller_; // Channel for communication with embedding renderer, if it exists. - scoped_refptr<content::old::GuestToEmbedderChannel> - guest_to_embedder_channel_; + scoped_refptr<old::GuestToEmbedderChannel> guest_to_embedder_channel_; // The pepper instance identifer for this guest RenderView. PP_Instance guest_pp_instance_; @@ -1591,7 +1572,7 @@ class RenderViewImpl : public RenderWidget, // NOTE: pepper_delegate_ should be last member because its constructor calls // AddObservers method of RenderViewImpl from c-tor. - content::PepperPluginDelegateImpl pepper_delegate_; + PepperPluginDelegateImpl pepper_delegate_; // --------------------------------------------------------------------------- // ADDING NEW DATA? Please see if it fits appropriately in one of the above @@ -1605,4 +1586,6 @@ class RenderViewImpl : public RenderWidget, DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ diff --git a/content/renderer/render_view_linux.cc b/content/renderer/render_view_linux.cc index f41fa61..43d8b43 100644 --- a/content/renderer/render_view_linux.cc +++ b/content/renderer/render_view_linux.cc @@ -9,19 +9,21 @@ using WebKit::WebFontRendering; +namespace content { + static SkPaint::Hinting RendererPreferencesToSkiaHinting( - const content::RendererPreferences& prefs) { + const RendererPreferences& prefs) { if (!prefs.should_antialias_text) { // When anti-aliasing is off, GTK maps all non-zero hinting settings to // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' // hinting selected will see readable text in everything expect Chromium. switch (prefs.hinting) { - case content::RENDERER_PREFERENCES_HINTING_NONE: + case RENDERER_PREFERENCES_HINTING_NONE: return SkPaint::kNo_Hinting; - case content::RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: - case content::RENDERER_PREFERENCES_HINTING_SLIGHT: - case content::RENDERER_PREFERENCES_HINTING_MEDIUM: - case content::RENDERER_PREFERENCES_HINTING_FULL: + case RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: + case RENDERER_PREFERENCES_HINTING_SLIGHT: + case RENDERER_PREFERENCES_HINTING_MEDIUM: + case RENDERER_PREFERENCES_HINTING_FULL: return SkPaint::kNormal_Hinting; default: NOTREACHED(); @@ -30,15 +32,15 @@ static SkPaint::Hinting RendererPreferencesToSkiaHinting( } switch (prefs.hinting) { - case content::RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: + case RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: return SkPaint::kNormal_Hinting; - case content::RENDERER_PREFERENCES_HINTING_NONE: + case RENDERER_PREFERENCES_HINTING_NONE: return SkPaint::kNo_Hinting; - case content::RENDERER_PREFERENCES_HINTING_SLIGHT: + case RENDERER_PREFERENCES_HINTING_SLIGHT: return SkPaint::kSlight_Hinting; - case content::RENDERER_PREFERENCES_HINTING_MEDIUM: + case RENDERER_PREFERENCES_HINTING_MEDIUM: return SkPaint::kNormal_Hinting; - case content::RENDERER_PREFERENCES_HINTING_FULL: + case RENDERER_PREFERENCES_HINTING_FULL: return SkPaint::kFull_Hinting; default: NOTREACHED(); @@ -47,15 +49,15 @@ static SkPaint::Hinting RendererPreferencesToSkiaHinting( } static SkFontHost::LCDOrder RendererPreferencesToSkiaLCDOrder( - content::RendererPreferencesSubpixelRenderingEnum subpixel) { + RendererPreferencesSubpixelRenderingEnum subpixel) { switch (subpixel) { - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: return SkFontHost::kRGB_LCDOrder; - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: return SkFontHost::kBGR_LCDOrder; default: NOTREACHED(); @@ -65,15 +67,15 @@ static SkFontHost::LCDOrder RendererPreferencesToSkiaLCDOrder( static SkFontHost::LCDOrientation RendererPreferencesToSkiaLCDOrientation( - content::RendererPreferencesSubpixelRenderingEnum subpixel) { + RendererPreferencesSubpixelRenderingEnum subpixel) { switch (subpixel) { - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: return SkFontHost::kHorizontal_LCDOrientation; - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: - case content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: + case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: return SkFontHost::kVertical_LCDOrientation; default: NOTREACHED(); @@ -82,23 +84,23 @@ static SkFontHost::LCDOrientation } static bool RendererPreferencesToAntiAliasFlag( - const content::RendererPreferences& prefs) { + const RendererPreferences& prefs) { return prefs.should_antialias_text; } static bool RendererPreferencesToSubpixelRenderingFlag( - const content::RendererPreferences& prefs) { + const RendererPreferences& prefs) { if (prefs.subpixel_rendering != - content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT && + RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT && prefs.subpixel_rendering != - content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE) { + RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE) { return true; } return false; } void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() { - const content::RendererPreferences& prefs = renderer_preferences_; + const RendererPreferences& prefs = renderer_preferences_; WebFontRendering::setHinting(RendererPreferencesToSkiaHinting(prefs)); WebFontRendering::setAutoHint(prefs.use_autohinter); WebFontRendering::setUseBitmaps(prefs.use_bitmaps); @@ -111,3 +113,5 @@ void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() { RendererPreferencesToSubpixelRenderingFlag(prefs)); WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); } + +} // namespace content diff --git a/content/renderer/render_view_mouse_lock_dispatcher.cc b/content/renderer/render_view_mouse_lock_dispatcher.cc index 15366c4..bafdea8 100644 --- a/content/renderer/render_view_mouse_lock_dispatcher.cc +++ b/content/renderer/render_view_mouse_lock_dispatcher.cc @@ -10,9 +10,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" +namespace content { + RenderViewMouseLockDispatcher::RenderViewMouseLockDispatcher( RenderViewImpl* render_view_impl) - : content::RenderViewObserver(render_view_impl), + : RenderViewObserver(render_view_impl), render_view_impl_(render_view_impl) { } @@ -60,3 +62,5 @@ void RenderViewMouseLockDispatcher::OnMsgLockMouseACK(bool succeeded) { if (succeeded && render_view_impl_->webwidget()) render_view_impl_->webwidget()->mouseCaptureLost(); } + +} // namespace content diff --git a/content/renderer/render_view_mouse_lock_dispatcher.h b/content/renderer/render_view_mouse_lock_dispatcher.h index 4e77c7a..5a5455f 100644 --- a/content/renderer/render_view_mouse_lock_dispatcher.h +++ b/content/renderer/render_view_mouse_lock_dispatcher.h @@ -10,11 +10,12 @@ #include "content/public/renderer/render_view_observer.h" #include "content/renderer/mouse_lock_dispatcher.h" +namespace content { class RenderViewImpl; // RenderViewMouseLockDispatcher is owned by RenderViewImpl. class RenderViewMouseLockDispatcher : public MouseLockDispatcher, - public content::RenderViewObserver { + public RenderViewObserver { public: explicit RenderViewMouseLockDispatcher(RenderViewImpl* render_view_impl); virtual ~RenderViewMouseLockDispatcher(); @@ -34,4 +35,6 @@ class RenderViewMouseLockDispatcher : public MouseLockDispatcher, DISALLOW_COPY_AND_ASSIGN(RenderViewMouseLockDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_VIEW_MOUSE_LOCK_DISPATCHER_H_ diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 406b531..4313973 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -35,9 +35,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/skia/include/core/SkShader.h" #include "ui/base/ui_base_switches.h" -#include "ui/gfx/point.h" #include "ui/gfx/rect_conversions.h" -#include "ui/gfx/size.h" #include "ui/gfx/size_conversions.h" #include "ui/gfx/skia_util.h" #include "ui/gl/gl_switches.h" @@ -72,7 +70,8 @@ using WebKit::WebTextDirection; using WebKit::WebTouchEvent; using WebKit::WebVector; using WebKit::WebWidget; -using content::RenderThread; + +namespace content { static const float kStandardDPI = 160; @@ -265,7 +264,7 @@ bool RenderWidget::Send(IPC::Message* message) { // Don't send any messages after the browser has told us to close, and filter // most outgoing messages while swapped out. if ((is_swapped_out_ && - !content::SwappedOutMessages::CanSendWhileSwappedOut(message)) || + !SwappedOutMessages::CanSendWhileSwappedOut(message)) || closing_) { delete message; return false; @@ -1868,8 +1867,7 @@ void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; } -bool RenderWidget::GetGpuRenderingStats( - content::GpuRenderingStats* stats) const { +bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const { GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); if (!gpu_channel) return false; @@ -1897,3 +1895,5 @@ bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { return false; } + +} // namespace content diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 5777bd9..3e25bc2 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -7,7 +7,6 @@ #include <deque> #include <map> -#include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -30,7 +29,6 @@ #include "ui/base/range/range.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" -#include "ui/gfx/size.h" #include "ui/surface/transport_dib.h" #include "webkit/glue/webcursor.h" @@ -44,16 +42,6 @@ class SyncMessage; namespace WebKit { class WebMouseEvent; class WebTouchEvent; -class WebWidget; -} - -namespace content { -struct GpuRenderingStats; -class RenderWidgetTest; -} - -namespace gfx { -class Point; } namespace skia { @@ -74,6 +62,10 @@ class PluginInstance; } // namespace ppapi } // namespace webkit +namespace content { +struct GpuRenderingStats; +class RenderWidgetTest; + // RenderWidget provides a communication bridge between a WebWidget and // a RenderWidgetHost, the latter of which lives in a different process. class CONTENT_EXPORT RenderWidget @@ -166,7 +158,7 @@ class CONTENT_EXPORT RenderWidget // GPU rendering, e.g. count of texture uploads performed, time spent // uploading. // This call is relatively expensive as it blocks on the GPU process - bool GetGpuRenderingStats(content::GpuRenderingStats*) const; + bool GetGpuRenderingStats(GpuRenderingStats*) const; // Callback for use with BeginSmoothScroll. typedef base::Callback<void()> SmoothScrollCompletionCallback; @@ -197,7 +189,7 @@ class CONTENT_EXPORT RenderWidget // without ref-counting is an error. friend class base::RefCounted<RenderWidget>; // For unit tests. - friend class content::RenderWidgetTest; + friend class RenderWidgetTest; enum ResizeAck { SEND_RESIZE_ACK, @@ -373,7 +365,6 @@ class CONTENT_EXPORT RenderWidget const ui::Range& range, const std::vector<gfx::Rect>& character_bounds); - // Override point to obtain that the current input method state and caret // position. virtual ui::TextInputType GetTextInputType(); @@ -618,4 +609,6 @@ class CONTENT_EXPORT RenderWidget DISALLOW_COPY_AND_ASSIGN(RenderWidget); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ diff --git a/content/renderer/render_widget_fullscreen.cc b/content/renderer/render_widget_fullscreen.cc index 9ccbd0e..d6d1887 100644 --- a/content/renderer/render_widget_fullscreen.cc +++ b/content/renderer/render_widget_fullscreen.cc @@ -9,6 +9,8 @@ using WebKit::WebWidget; +namespace content { + // static RenderWidgetFullscreen* RenderWidgetFullscreen::Create(int32 opener_id) { DCHECK_NE(MSG_ROUTING_NONE, opener_id); @@ -51,3 +53,5 @@ void RenderWidgetFullscreen::Init(int32 opener_id) { new ViewHostMsg_CreateFullscreenWidget( opener_id, &routing_id_, &surface_id_)); } + +} // namespace content diff --git a/content/renderer/render_widget_fullscreen.h b/content/renderer/render_widget_fullscreen.h index cb53266..fa2e1a6 100644 --- a/content/renderer/render_widget_fullscreen.h +++ b/content/renderer/render_widget_fullscreen.h @@ -9,6 +9,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" +namespace content { + // TODO(boliu): Override non-supported methods with no-op? eg setWindowRect(). class RenderWidgetFullscreen : public RenderWidget { public: @@ -27,4 +29,6 @@ class RenderWidgetFullscreen : public RenderWidget { void Init(int32 opener_id); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_H_ diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index 08f8d64..98518061 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -43,6 +43,8 @@ using WebKit::WebVector; using WebKit::WebWidget; using WebKit::WGC3Dintptr; +namespace content { + namespace { // See third_party/WebKit/Source/WebCore/dom/WheelEvent.h. @@ -435,7 +437,7 @@ void RenderWidgetFullscreenPepper::DidChangeCursor( webkit::ppapi::PluginDelegate::PlatformContext3D* RenderWidgetFullscreenPepper::CreateContext3D() { #ifdef ENABLE_GPU - return new content::PlatformContext3DImpl(this); + return new PlatformContext3DImpl(this); #else return NULL; #endif @@ -443,7 +445,7 @@ RenderWidgetFullscreenPepper::CreateContext3D() { void RenderWidgetFullscreenPepper::ReparentContext( webkit::ppapi::PluginDelegate::PlatformContext3D* context) { - static_cast<content::PlatformContext3DImpl*>(context)->SetParentContext(this); + static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this); } MouseLockDispatcher* RenderWidgetFullscreenPepper::GetMouseLockDispatcher() { @@ -542,7 +544,7 @@ void RenderWidgetFullscreenPepper::CreateContext() { attributes, true /* bind generates resources */, active_url_, - content::CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT); + CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT); if (!context_) return; @@ -680,3 +682,5 @@ RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { return NULL; return context_; } + +} // namespace content diff --git a/content/renderer/render_widget_fullscreen_pepper.h b/content/renderer/render_widget_fullscreen_pepper.h index d3fd06d..d6414a2 100644 --- a/content/renderer/render_widget_fullscreen_pepper.h +++ b/content/renderer/render_widget_fullscreen_pepper.h @@ -25,13 +25,15 @@ class PluginInstance; } // namespace ppapi } // namespace webkit +namespace content { + // A RenderWidget that hosts a fullscreen pepper plugin. This provides a // FullscreenContainer that the plugin instance can callback into to e.g. // invalidate rects. class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, public webkit::ppapi::FullscreenContainer, - public content::PepperParentContextProvider, + public PepperParentContextProvider, public WebGraphicsContext3DSwapBuffersClient { public: static RenderWidgetFullscreenPepper* Create( @@ -127,4 +129,6 @@ class RenderWidgetFullscreenPepper : DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ diff --git a/content/renderer/renderer_accessibility.h b/content/renderer/renderer_accessibility.h index 8e55ef8..f6075a7 100644 --- a/content/renderer/renderer_accessibility.h +++ b/content/renderer/renderer_accessibility.h @@ -9,14 +9,13 @@ #include "content/public/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotification.h" -class RenderViewImpl; - namespace WebKit { class WebAccessibilityObject; class WebDocument; }; namespace content { +class RenderViewImpl; // The browser process implement native accessibility APIs, allowing // assistive technology (e.g., screen readers, magnifiers) to access and diff --git a/content/renderer/renderer_accessibility_browsertest.cc b/content/renderer/renderer_accessibility_browsertest.cc index f244074..54cb951 100644 --- a/content/renderer/renderer_accessibility_browsertest.cc +++ b/content/renderer/renderer_accessibility_browsertest.cc @@ -12,9 +12,9 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" -using content::AccessibilityNodeData; +namespace content { -class RendererAccessibilityTest : public content::RenderViewTest { +class RendererAccessibilityTest : public RenderViewTest { public: RendererAccessibilityTest() {} @@ -23,7 +23,7 @@ class RendererAccessibilityTest : public content::RenderViewTest { } virtual void SetUp() { - content::RenderViewTest::SetUp(); + RenderViewTest::SetUp(); sink_ = &render_thread_->sink(); } @@ -188,3 +188,5 @@ TEST_F(RendererAccessibilityTest, EditableTextModeFocusNotifications) { EXPECT_EQ(notification.id, 1); } } + +} // namespace content diff --git a/content/renderer/renderer_accessibility_complete.h b/content/renderer/renderer_accessibility_complete.h index 32981d7..ebae664 100644 --- a/content/renderer/renderer_accessibility_complete.h +++ b/content/renderer/renderer_accessibility_complete.h @@ -14,8 +14,6 @@ #include "content/renderer/renderer_accessibility.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotification.h" -class RenderViewImpl; - namespace WebKit { class WebAccessibilityObject; class WebDocument; @@ -23,6 +21,7 @@ class WebNode; }; namespace content { +class RenderViewImpl; // This is the subclass of RendererAccessibility that implements // complete accessibility support for assistive technology (as opposed to diff --git a/content/renderer/renderer_clipboard_client.cc b/content/renderer/renderer_clipboard_client.cc index d04628e..9c0a30f 100644 --- a/content/renderer/renderer_clipboard_client.cc +++ b/content/renderer/renderer_clipboard_client.cc @@ -6,11 +6,6 @@ #include "content/renderer/renderer_clipboard_client.h" -#include "build/build_config.h" - -#include <string> -#include <vector> - #include "base/shared_memory.h" #include "base/string16.h" #include "content/common/clipboard_messages.h" @@ -20,6 +15,8 @@ #include "ui/gfx/size.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" +namespace content { + namespace { class RendererClipboardWriteContext : @@ -185,3 +182,5 @@ webkit_glue::ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { return new RendererClipboardWriteContext; } + +} // namespace content diff --git a/content/renderer/renderer_clipboard_client.h b/content/renderer/renderer_clipboard_client.h index ff2451e..8e7df78 100644 --- a/content/renderer/renderer_clipboard_client.h +++ b/content/renderer/renderer_clipboard_client.h @@ -8,6 +8,8 @@ #include "base/compiler_specific.h" #include "webkit/glue/clipboard_client.h" +namespace content { + // An implementation of ClipboardClient that gets and sends data over IPC. class RendererClipboardClient : public webkit_glue::ClipboardClient { public: @@ -39,4 +41,6 @@ class RendererClipboardClient : public webkit_glue::ClipboardClient { virtual WriteContext* CreateWriteContext() OVERRIDE; }; +} // namespace content + #endif // CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_ diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index 4a7deaa..16367c3 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -42,6 +42,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #endif // OS_MACOSX +namespace content { + namespace { #if defined(OS_MACOSX) @@ -122,7 +124,7 @@ class RendererMessageLoopObserver : public MessageLoop::TaskObserver { }; // mainline routine for running as the Renderer process -int RendererMain(const content::MainFunctionParams& parameters) { +int RendererMain(const MainFunctionParams& parameters) { TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); const CommandLine& parsed_command_line = parameters.command_line; @@ -154,7 +156,7 @@ int RendererMain(const content::MainFunctionParams& parameters) { webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager = webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance(); - content::GetContentClient()->renderer()->RegisterPPAPIInterfaceFactories( + GetContentClient()->renderer()->RegisterPPAPIInterfaceFactories( factory_manager); base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); @@ -224,7 +226,7 @@ int RendererMain(const content::MainFunctionParams& parameters) { RenderProcessImpl render_process; new RenderThreadImpl(); #endif - new content::BrowserPluginManagerImpl(); + new BrowserPluginManagerImpl(); platform.RunSandboxTests(); @@ -244,3 +246,5 @@ int RendererMain(const content::MainFunctionParams& parameters) { TRACE_EVENT_END_ETW("RendererMain", 0, ""); return 0; } + +} // namespace content diff --git a/content/renderer/renderer_webapplicationcachehost_impl.cc b/content/renderer/renderer_webapplicationcachehost_impl.cc index ba1e5ea..08b571b 100644 --- a/content/renderer/renderer_webapplicationcachehost_impl.cc +++ b/content/renderer/renderer_webapplicationcachehost_impl.cc @@ -14,6 +14,8 @@ using appcache::AppCacheBackend; using WebKit::WebApplicationCacheHostClient; using WebKit::WebConsoleMessage; +namespace content { + RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl( RenderViewImpl* render_view, WebApplicationCacheHostClient* client, @@ -54,3 +56,5 @@ RenderViewImpl* RendererWebApplicationCacheHostImpl::GetRenderView() { return static_cast<RenderViewImpl*> (RenderThreadImpl::current()->ResolveRoute(routing_id_)); } + +} // namespace content diff --git a/content/renderer/renderer_webapplicationcachehost_impl.h b/content/renderer/renderer_webapplicationcachehost_impl.h index f742bbb..07d5e22 100644 --- a/content/renderer/renderer_webapplicationcachehost_impl.h +++ b/content/renderer/renderer_webapplicationcachehost_impl.h @@ -7,6 +7,7 @@ #include "webkit/appcache/web_application_cache_host_impl.h" +namespace content { class RenderViewImpl; class RendererWebApplicationCacheHostImpl @@ -29,4 +30,6 @@ class RendererWebApplicationCacheHostImpl int routing_id_; }; +} // namespace content + #endif // CONTENT_RENDERER_RENDERER_WEBAPPLICATIONCACHEHOST_IMPL_H_ diff --git a/content/renderer/renderer_webcolorchooser_impl.cc b/content/renderer/renderer_webcolorchooser_impl.cc index da38f8d..337ec7e 100644 --- a/content/renderer/renderer_webcolorchooser_impl.cc +++ b/content/renderer/renderer_webcolorchooser_impl.cc @@ -7,6 +7,8 @@ #include "content/common/view_messages.h" #include "content/renderer/render_view_impl.h" +namespace content { + static int GenerateColorChooserIdentifier() { static int next = 0; return ++next; @@ -15,7 +17,7 @@ static int GenerateColorChooserIdentifier() { RendererWebColorChooserImpl::RendererWebColorChooserImpl( RenderViewImpl* render_view, WebKit::WebColorChooserClient* client) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), identifier_(GenerateColorChooserIdentifier()), client_(client) { } @@ -62,3 +64,5 @@ void RendererWebColorChooserImpl::OnDidEndColorChooser(int color_chooser_id) { return; client_->didEndChooser(); } + +} // namespace content diff --git a/content/renderer/renderer_webcolorchooser_impl.h b/content/renderer/renderer_webcolorchooser_impl.h index b32bc9e..c45ec0d 100644 --- a/content/renderer/renderer_webcolorchooser_impl.h +++ b/content/renderer/renderer_webcolorchooser_impl.h @@ -15,10 +15,11 @@ namespace WebKit { class WebFrame; } +namespace content { class RenderViewImpl; class RendererWebColorChooserImpl : public WebKit::WebColorChooser, - public content::RenderViewObserver { + public RenderViewObserver { public: explicit RendererWebColorChooserImpl(RenderViewImpl* sender, WebKit::WebColorChooserClient*); @@ -44,4 +45,6 @@ class RendererWebColorChooserImpl : public WebKit::WebColorChooser, DISALLOW_COPY_AND_ASSIGN(RendererWebColorChooserImpl); }; +} // namespace content + #endif // CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ diff --git a/content/renderer/renderer_webcookiejar_impl.cc b/content/renderer/renderer_webcookiejar_impl.cc index 2a83ac0..0b6cd8e 100644 --- a/content/renderer/renderer_webcookiejar_impl.cc +++ b/content/renderer/renderer_webcookiejar_impl.cc @@ -16,12 +16,14 @@ using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; +namespace content { + void RendererWebCookieJarImpl::setCookie( const WebURL& url, const WebURL& first_party_for_cookies, const WebString& value) { std::string value_utf8; UTF16ToUTF8(value.data(), value.length(), &value_utf8); - if (!content::GetContentClient()->renderer()->HandleSetCookieRequest( + if (!GetContentClient()->renderer()->HandleSetCookieRequest( sender_, url, first_party_for_cookies, value_utf8)) { sender_->Send(new ViewHostMsg_SetCookie( MSG_ROUTING_NONE, url, first_party_for_cookies, value_utf8)); @@ -32,7 +34,7 @@ WebString RendererWebCookieJarImpl::cookies( const WebURL& url, const WebURL& first_party_for_cookies) { std::string value_utf8; - if (!content::GetContentClient()->renderer()->HandleGetCookieRequest( + if (!GetContentClient()->renderer()->HandleGetCookieRequest( sender_, url, first_party_for_cookies, &value_utf8)) { // NOTE: This may pump events (see RenderThread::Send). sender_->Send(new ViewHostMsg_GetCookies( @@ -85,3 +87,5 @@ bool RendererWebCookieJarImpl::cookiesEnabled( url, first_party_for_cookies, &cookies_enabled)); return cookies_enabled; } + +} // namespace content diff --git a/content/renderer/renderer_webcookiejar_impl.h b/content/renderer/renderer_webcookiejar_impl.h index 121df41..9464d2b 100644 --- a/content/renderer/renderer_webcookiejar_impl.h +++ b/content/renderer/renderer_webcookiejar_impl.h @@ -9,6 +9,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCookieJar.h" +namespace content { class RenderViewImpl; class RendererWebCookieJarImpl : public WebKit::WebCookieJar { @@ -38,4 +39,6 @@ class RendererWebCookieJarImpl : public WebKit::WebCookieJar { RenderViewImpl* sender_; }; +} // namespace content + #endif // CONTENT_RENDERER_RENDERER_WEBCOOKIEJAR_IMPL_H_ diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index b2b4386..b3a6312 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -30,7 +30,6 @@ #include "content/renderer/media/media_stream_dependency_factory.h" #include "content/renderer/media/renderer_webaudiodevice_impl.h" #include "content/renderer/render_thread_impl.h" -#include "content/renderer/render_view_impl.h" #include "content/renderer/renderer_clipboard_client.h" #include "content/renderer/websharedworkerrepository_impl.h" #include "googleurl/src/gurl.h" @@ -76,7 +75,6 @@ #include "base/file_descriptor_posix.h" #endif -using content::RenderThread; using WebKit::WebAudioDevice; using WebKit::WebBlobRegistry; using WebKit::WebFileInfo; @@ -96,6 +94,8 @@ using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; +namespace content { + static bool g_sandbox_enabled = true; //------------------------------------------------------------------------------ @@ -243,13 +243,12 @@ bool RendererWebKitPlatformSupportImpl::sandboxEnabled() { unsigned long long RendererWebKitPlatformSupportImpl::visitedLinkHash( const char* canonical_url, size_t length) { - return content::GetContentClient()->renderer()->VisitedLinkHash( - canonical_url, length); + return GetContentClient()->renderer()->VisitedLinkHash(canonical_url, length); } bool RendererWebKitPlatformSupportImpl::isLinkVisited( unsigned long long link_hash) { - return content::GetContentClient()->renderer()->IsLinkVisited(link_hash); + return GetContentClient()->renderer()->IsLinkVisited(link_hash); } WebKit::WebMessagePortChannel* @@ -264,7 +263,7 @@ void RendererWebKitPlatformSupportImpl::prefetchHostName( std::string hostname_utf8; UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); - content::GetContentClient()->renderer()->PrefetchHostName( + GetContentClient()->renderer()->PrefetchHostName( hostname_utf8.data(), hostname_utf8.length()); } @@ -488,7 +487,7 @@ RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( return; } - content::GetFontFamilyForCharacters( + GetFontFamilyForCharacters( characters, num_characters, preferred_locale, @@ -499,7 +498,7 @@ RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( void RendererWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike( const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) { - content::GetRenderStyleForStrike(family, sizeAndStyle, out); + GetRenderStyleForStrike(family, sizeAndStyle, out); } #endif @@ -545,11 +544,11 @@ RendererWebKitPlatformSupportImpl::sharedWorkerRepository() { bool RendererWebKitPlatformSupportImpl::canAccelerate2dCanvas() { RenderThreadImpl* thread = RenderThreadImpl::current(); GpuChannelHost* host = thread->EstablishGpuChannelSync( - content::CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); + CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); if (!host) return false; - const content::GPUInfo& gpu_info = host->gpu_info(); + const GPUInfo& gpu_info = host->gpu_info(); if (gpu_info.can_lose_context || gpu_info.software_rendering) return false; @@ -653,7 +652,7 @@ WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() { void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { if (!gamepad_shared_memory_reader_.get()) - gamepad_shared_memory_reader_.reset(new content::GamepadSharedMemoryReader); + gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); gamepad_shared_memory_reader_->SampleGamepads(gamepads); } @@ -741,7 +740,7 @@ bool RendererWebKitPlatformSupportImpl::canHyphenate( // Create a hyphenator object and attach it to the render thread so it can // receive a dictionary file opened by a browser. if (!hyphenator_.get()) { - hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue)); + hyphenator_.reset(new Hyphenator(base::kInvalidPlatformFileValue)); if (!hyphenator_.get()) return false; return hyphenator_->Attach(RenderThreadImpl::current(), locale); @@ -760,3 +759,5 @@ size_t RendererWebKitPlatformSupportImpl::computeLastHyphenLocation( return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), before_index); } + +} // namespace content diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index 8033b9a..6a22272 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -12,21 +12,20 @@ #include "content/common/webkitplatformsupport_impl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" -class RendererClipboardClient; class WebSharedWorkerRepositoryImpl; class WebFileSystemImpl; -namespace content { -class GamepadSharedMemoryReader; -class Hyphenator; -} - namespace webkit_glue { class WebClipboardImpl; } +namespace content { +class GamepadSharedMemoryReader; +class Hyphenator; +class RendererClipboardClient; + class CONTENT_EXPORT RendererWebKitPlatformSupportImpl - : public content::WebKitPlatformSupportImpl { + : public WebKitPlatformSupportImpl { public: RendererWebKitPlatformSupportImpl(); virtual ~RendererWebKitPlatformSupportImpl(); @@ -139,9 +138,11 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl scoped_ptr<WebKit::WebBlobRegistry> blob_registry_; - scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; + scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_; scoped_ptr<content::Hyphenator> hyphenator_; }; +} // namespace content + #endif // CONTENT_RENDERER_RENDERER_WEBKITPLATFORMSUPPORT_IMPL_H_ diff --git a/content/renderer/speech_recognition_dispatcher.cc b/content/renderer/speech_recognition_dispatcher.cc index 8be6688..04495eb 100644 --- a/content/renderer/speech_recognition_dispatcher.cc +++ b/content/renderer/speech_recognition_dispatcher.cc @@ -15,8 +15,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h" -using content::SpeechRecognitionError; -using content::SpeechRecognitionResult; using WebKit::WebVector; using WebKit::WebString; using WebKit::WebSpeechGrammar; @@ -25,9 +23,11 @@ using WebKit::WebSpeechRecognitionResult; using WebKit::WebSpeechRecognitionParams; using WebKit::WebSpeechRecognizerClient; +namespace content { + SpeechRecognitionDispatcher::SpeechRecognitionDispatcher( RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), recognizer_client_(NULL), next_id_(1) { } @@ -63,8 +63,7 @@ void SpeechRecognitionDispatcher::start( for (size_t i = 0; i < params.grammars().size(); ++i) { const WebSpeechGrammar& grammar = params.grammars()[i]; msg_params.grammars.push_back( - content::SpeechRecognitionGrammar(grammar.src().spec(), - grammar.weight())); + SpeechRecognitionGrammar(grammar.src().spec(), grammar.weight())); } msg_params.language = UTF16ToUTF8(params.language()); msg_params.max_hypotheses = static_cast<uint32>(params.maxAlternatives()); @@ -118,25 +117,25 @@ void SpeechRecognitionDispatcher::OnAudioEnded(int request_id) { } static WebSpeechRecognizerClient::ErrorCode WebKitErrorCode( - content::SpeechRecognitionErrorCode e) { + SpeechRecognitionErrorCode e) { switch (e) { - case content::SPEECH_RECOGNITION_ERROR_NONE: + case SPEECH_RECOGNITION_ERROR_NONE: NOTREACHED(); return WebSpeechRecognizerClient::OtherError; - case content::SPEECH_RECOGNITION_ERROR_ABORTED: + case SPEECH_RECOGNITION_ERROR_ABORTED: return WebSpeechRecognizerClient::AbortedError; - case content::SPEECH_RECOGNITION_ERROR_AUDIO: + case SPEECH_RECOGNITION_ERROR_AUDIO: return WebSpeechRecognizerClient::AudioCaptureError; - case content::SPEECH_RECOGNITION_ERROR_NETWORK: + case SPEECH_RECOGNITION_ERROR_NETWORK: return WebSpeechRecognizerClient::NetworkError; - case content::SPEECH_RECOGNITION_ERROR_NOT_ALLOWED: + case SPEECH_RECOGNITION_ERROR_NOT_ALLOWED: return WebSpeechRecognizerClient::NotAllowedError; - case content::SPEECH_RECOGNITION_ERROR_NO_SPEECH: + case SPEECH_RECOGNITION_ERROR_NO_SPEECH: return WebSpeechRecognizerClient::NoSpeechError; - case content::SPEECH_RECOGNITION_ERROR_NO_MATCH: + case SPEECH_RECOGNITION_ERROR_NO_MATCH: NOTREACHED(); return WebSpeechRecognizerClient::OtherError; - case content::SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR: + case SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR: return WebSpeechRecognizerClient::BadGrammarError; } NOTREACHED(); @@ -145,7 +144,7 @@ static WebSpeechRecognizerClient::ErrorCode WebKitErrorCode( void SpeechRecognitionDispatcher::OnErrorOccurred( int request_id, const SpeechRecognitionError& error) { - if (error.code == content::SPEECH_RECOGNITION_ERROR_NO_MATCH) { + if (error.code == SPEECH_RECOGNITION_ERROR_NO_MATCH) { recognizer_client_->didReceiveNoMatch(GetHandleFromID(request_id), WebSpeechRecognitionResult()); } else { @@ -213,3 +212,5 @@ const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( DCHECK(iter != handle_map_.end()); return iter->second; } + +} // namespace content diff --git a/content/renderer/speech_recognition_dispatcher.h b/content/renderer/speech_recognition_dispatcher.h index 9725d50..6218b3f 100644 --- a/content/renderer/speech_recognition_dispatcher.h +++ b/content/renderer/speech_recognition_dispatcher.h @@ -13,17 +13,15 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognitionHandle.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechRecognizer.h" -class RenderViewImpl; - namespace content { +class RenderViewImpl; struct SpeechRecognitionError; struct SpeechRecognitionResult; -} // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for // scripted JS speech APIs. It's the complement of // SpeechRecognitionDispatcherHost (owned by RenderViewHost). -class SpeechRecognitionDispatcher : public content::RenderViewObserver, +class SpeechRecognitionDispatcher : public RenderViewObserver, public WebKit::WebSpeechRecognizer { public: explicit SpeechRecognitionDispatcher(RenderViewImpl* render_view); @@ -47,11 +45,9 @@ class SpeechRecognitionDispatcher : public content::RenderViewObserver, void OnSoundStarted(int request_id); void OnSoundEnded(int request_id); void OnAudioEnded(int request_id); - void OnErrorOccurred(int request_id, - const content::SpeechRecognitionError& error); + void OnErrorOccurred(int request_id, const SpeechRecognitionError& error); void OnRecognitionEnded(int request_id); - void OnResultRetrieved(int request_id, - const content::SpeechRecognitionResult& result); + void OnResultRetrieved(int request_id, const SpeechRecognitionResult& result); int GetOrCreateIDForHandle(const WebKit::WebSpeechRecognitionHandle& handle); bool HandleExists(const WebKit::WebSpeechRecognitionHandle& handle); @@ -67,4 +63,6 @@ class SpeechRecognitionDispatcher : public content::RenderViewObserver, DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher); }; +} // namespace content + #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ diff --git a/content/renderer/text_input_client_observer.cc b/content/renderer/text_input_client_observer.cc index cbb64b6..772e2f4 100644 --- a/content/renderer/text_input_client_observer.cc +++ b/content/renderer/text_input_client_observer.cc @@ -7,7 +7,6 @@ #include "base/memory/scoped_ptr.h" #include "content/common/text_input_client_messages.h" #include "content/renderer/render_view_impl.h" -#include "ipc/ipc_message_macros.h" #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebSubstringUtil.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" @@ -16,8 +15,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/gfx/rect.h" +namespace content { + TextInputClientObserver::TextInputClientObserver(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), render_view_impl_(render_view) { } @@ -72,3 +73,5 @@ void TextInputClientObserver::OnStringForRange(ui::Range range) { NOTIMPLEMENTED(); #endif } + +} // namespace content diff --git a/content/renderer/text_input_client_observer.h b/content/renderer/text_input_client_observer.h index c0d6b46e..d3312ff 100644 --- a/content/renderer/text_input_client_observer.h +++ b/content/renderer/text_input_client_observer.h @@ -11,16 +11,18 @@ #include "ui/base/range/range.h" #include "ui/gfx/point.h" -class RenderViewImpl; - namespace WebKit { class WebView; } +namespace content { + +class RenderViewImpl; + // This is the renderer-side message filter that generates the replies for the // messages sent by the TextInputClientMac. See // content/browser/renderer_host/text_input_client_mac.h for more information. -class TextInputClientObserver : public content::RenderViewObserver { +class TextInputClientObserver : public RenderViewObserver { public: explicit TextInputClientObserver(RenderViewImpl* render_view); virtual ~TextInputClientObserver(); @@ -42,4 +44,6 @@ class TextInputClientObserver : public content::RenderViewObserver { DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); }; +} // namespace content + #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ diff --git a/content/renderer/web_intents_host.cc b/content/renderer/web_intents_host.cc index e8876ce..46aecfe 100644 --- a/content/renderer/web_intents_host.cc +++ b/content/renderer/web_intents_host.cc @@ -10,7 +10,6 @@ #include "content/common/intents_messages.h" #include "content/public/renderer/v8_value_converter.h" #include "content/renderer/render_view_impl.h" -#include "ipc/ipc_message.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeliveredIntentClient.h" @@ -38,6 +37,8 @@ using WebKit::WebString; using WebKit::WebSerializedScriptValue; using WebKit::WebVector; +namespace content { + namespace { // Reads reply value, either from the data field, or the data_file field. @@ -85,7 +86,7 @@ class DeliveredIntentClientImpl : public WebDeliveredIntentClient { }; WebIntentsHost::WebIntentsHost(RenderViewImpl* render_view) - : content::RenderViewObserver(render_view), + : RenderViewObserver(render_view), id_counter_(0) { } @@ -237,8 +238,8 @@ WebIntent WebIntentsHost::CreateWebIntent( } case webkit_glue::WebIntentData::MIME_TYPE: { - scoped_ptr<content::V8ValueConverter> converter( - content::V8ValueConverter::create()); + scoped_ptr<V8ValueConverter> converter( + V8ValueConverter::create()); v8::Handle<v8::Value> valV8 = converter->ToV8Value( &intent_data.mime_data, v8::Context::GetCurrent()); @@ -253,3 +254,5 @@ WebIntent WebIntentsHost::CreateWebIntent( NOTREACHED(); return WebIntent(); } + +} // namespace content diff --git a/content/renderer/web_intents_host.h b/content/renderer/web_intents_host.h index c3d4022..efc37b3 100644 --- a/content/renderer/web_intents_host.h +++ b/content/renderer/web_intents_host.h @@ -16,8 +16,6 @@ #include "webkit/glue/web_intent_data.h" #include "webkit/glue/web_intent_reply_data.h" -class RenderViewImpl; - namespace WebKit { class WebDeliveredIntentClient; class WebIntentRequest; @@ -28,10 +26,13 @@ namespace webkit_glue { struct WebIntentData; } +namespace content { +class RenderViewImpl; + // WebIntentsHost is a delegate for Web Intents messages. It is the // renderer-side handler for IPC messages delivering the intent payload data // and preparing it for access by the service page. -class WebIntentsHost : public content::RenderViewObserver { +class WebIntentsHost : public RenderViewObserver { public: // |render_view| must not be NULL. explicit WebIntentsHost(RenderViewImpl* render_view); @@ -97,4 +98,6 @@ class WebIntentsHost : public content::RenderViewObserver { DISALLOW_COPY_AND_ASSIGN(WebIntentsHost); }; +} // namespace content + #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_ diff --git a/content/renderer/web_intents_host_browsertest.cc b/content/renderer/web_intents_host_browsertest.cc index 36a85f6..9215f67 100644 --- a/content/renderer/web_intents_host_browsertest.cc +++ b/content/renderer/web_intents_host_browsertest.cc @@ -14,7 +14,9 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h" #include "webkit/glue/web_intent_data.h" -class WebIntentsHostTest : public content::RenderViewTest { +namespace content { + +class WebIntentsHostTest : public RenderViewTest { protected: RenderViewImpl* view() { return static_cast<RenderViewImpl*>(view_); } WebIntentsHost* web_intents_host() { return view()->intents_host_; } @@ -33,8 +35,7 @@ class WebIntentsHostTest : public content::RenderViewTest { v8::Local<v8::Context> ctx = GetMainFrame()->mainWorldScriptContext(); v8::Context::Scope cscope(ctx); v8::Handle<v8::Value> v8_val = serialized_data.deserialize(); - scoped_ptr<content::V8ValueConverter> converter( - content::V8ValueConverter::create()); + scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); base::Value* reply = converter->FromV8Value(v8_val, ctx); EXPECT_TRUE(reply->IsType(base::Value::TYPE_DICTIONARY)); base::DictionaryValue* dict = NULL; @@ -118,3 +119,5 @@ TEST_F(WebIntentsHostTest, TestVector) { v2->GetStringASCII(std::string("key2"), &val2); EXPECT_EQ("val2", val2); } + +} // namespace content diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index e76d421..8c23272 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -72,6 +72,8 @@ using WebKit::WebInputEvent; using WebKit::WebString; using WebKit::WebView; +namespace content { + namespace { class ScopedLogLevel { @@ -458,7 +460,7 @@ void WebPluginDelegateProxy::DidManualLoadFail() { } bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { - content::GetContentClient()->SetActiveURL(page_url_); + GetContentClient()->SetActiveURL(page_url_); bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) @@ -555,8 +557,8 @@ static void CopyTransportDIBHandleForMessage( #elif defined(OS_WIN) // On Windows we need to duplicate the handle for the plugin process. *handle_out = NULL; - content::BrokerDuplicateHandle(handle_in, peer_pid, handle_out, - FILE_MAP_READ | FILE_MAP_WRITE, 0); + BrokerDuplicateHandle(handle_in, peer_pid, handle_out, + FILE_MAP_READ | FILE_MAP_WRITE, 0); DCHECK(*handle_out != NULL); #else // Don't need to do anything special for other platforms. @@ -1255,7 +1257,7 @@ void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, const gfx::Rect& rect) { // Lazily load the sad plugin image. if (!sad_plugin_) - sad_plugin_ = content::GetContentClient()->renderer()->GetSadPluginBitmap(); + sad_plugin_ = GetContentClient()->renderer()->GetSadPluginBitmap(); if (sad_plugin_) webkit::PaintSadPlugin(native_context, plugin_rect_, *sad_plugin_); } @@ -1532,3 +1534,5 @@ void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, plugin_->URLRedirectResponse(allow, resource_id); } + +} // namespace content diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h index 085b0e1..7bfef6c 100644 --- a/content/renderer/webplugin_delegate_proxy.h +++ b/content/renderer/webplugin_delegate_proxy.h @@ -30,7 +30,6 @@ struct NPObject; class NPObjectStub; class PluginChannelHost; struct PluginHostMsg_URLRequest_Params; -class RenderViewImpl; class SkBitmap; namespace base { @@ -47,6 +46,9 @@ class WebPlugin; } } +namespace content { +class RenderViewImpl; + // An implementation of WebPluginDelegate that proxies all calls to // the plugin process. class WebPluginDelegateProxy @@ -327,4 +329,6 @@ class WebPluginDelegateProxy DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); }; +} // namespace content + #endif // CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc index 685f81d4..55c8a8e 100644 --- a/content/test/webrtc_audio_device_test.cc +++ b/content/test/webrtc_audio_device_test.cc @@ -45,6 +45,8 @@ using testing::InvokeWithoutArgs; using testing::Return; using testing::StrEq; +namespace content { + // This class is a mock of the child process singleton which is needed // to be able to create a RenderThread object. class WebRTCMockRenderProcess : public RenderProcess { @@ -72,26 +74,23 @@ class WebRTCMockRenderProcess : public RenderProcess { // duration of the test. class ReplaceContentClientRenderer { public: - explicit ReplaceContentClientRenderer( - content::ContentRendererClient* new_renderer) { - saved_renderer_ = content::GetContentClient()->renderer(); - content::GetContentClient()->set_renderer_for_testing(new_renderer); + explicit ReplaceContentClientRenderer(ContentRendererClient* new_renderer) { + saved_renderer_ = GetContentClient()->renderer(); + GetContentClient()->set_renderer_for_testing(new_renderer); } ~ReplaceContentClientRenderer() { // Restore the original renderer. - content::GetContentClient()->set_renderer_for_testing(saved_renderer_); + GetContentClient()->set_renderer_for_testing(saved_renderer_); } private: - content::ContentRendererClient* saved_renderer_; + ContentRendererClient* saved_renderer_; DISALLOW_COPY_AND_ASSIGN(ReplaceContentClientRenderer); }; -namespace { - -class MockResourceContext : public content::ResourceContext { +class MockRTCResourceContext : public ResourceContext { public: - MockResourceContext() : test_request_context_(NULL) {} - virtual ~MockResourceContext() {} + MockRTCResourceContext() : test_request_context_(NULL) {} + virtual ~MockRTCResourceContext() {} void set_request_context(net::URLRequestContext* request_context) { test_request_context_ = request_context; @@ -108,15 +107,13 @@ class MockResourceContext : public content::ResourceContext { private: net::URLRequestContext* test_request_context_; - DISALLOW_COPY_AND_ASSIGN(MockResourceContext); + DISALLOW_COPY_AND_ASSIGN(MockRTCResourceContext); }; ACTION_P(QuitMessageLoop, loop_or_proxy) { loop_or_proxy->PostTask(FROM_HERE, MessageLoop::QuitClosure()); } -} // namespace - WebRTCAudioDeviceTest::WebRTCAudioDeviceTest() : render_thread_(NULL), audio_util_callback_(NULL), has_input_devices_(false), has_output_devices_(false) { @@ -132,8 +129,8 @@ void WebRTCAudioDeviceTest::SetUp() { saved_content_renderer_.reset( new ReplaceContentClientRenderer(&content_renderer_client_)); mock_process_.reset(new WebRTCMockRenderProcess()); - ui_thread_.reset(new content::TestBrowserThread(content::BrowserThread::UI, - MessageLoop::current())); + ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, + MessageLoop::current())); // Create our own AudioManager and MediaStreamManager. audio_manager_.reset(media::AudioManager::Create()); @@ -141,7 +138,7 @@ void WebRTCAudioDeviceTest::SetUp() { new media_stream::MediaStreamManager(audio_manager_.get())); // Construct the resource context on the UI thread. - resource_context_.reset(new MockResourceContext); + resource_context_.reset(new MockRTCResourceContext); static const char kThreadName[] = "RenderThread"; ChildProcess::current()->io_message_loop()->PostTask(FROM_HERE, @@ -205,13 +202,13 @@ void WebRTCAudioDeviceTest::InitializeIOThread(const char* thread_name) { #endif // Set the current thread as the IO thread. - io_thread_.reset(new content::TestBrowserThread(content::BrowserThread::IO, - MessageLoop::current())); + io_thread_.reset(new TestBrowserThread(BrowserThread::IO, + MessageLoop::current())); // Populate our resource context. test_request_context_.reset(new TestURLRequestContext()); - MockResourceContext* resource_context = - static_cast<MockResourceContext*>(resource_context_.get()); + MockRTCResourceContext* resource_context = + static_cast<MockRTCResourceContext*>(resource_context_.get()); resource_context->set_request_context(test_request_context_.get()); media_observer_.reset(new MockMediaObserver()); @@ -233,7 +230,7 @@ void WebRTCAudioDeviceTest::UninitializeIOThread() { } void WebRTCAudioDeviceTest::CreateChannel(const char* name) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); audio_render_host_ = new AudioRendererHost( audio_manager_.get(), media_observer_.get()); audio_render_host_->OnChannelConnected(base::GetCurrentProcId()); @@ -250,7 +247,7 @@ void WebRTCAudioDeviceTest::CreateChannel(const char* name) { } void WebRTCAudioDeviceTest::DestroyChannel() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); audio_render_host_->OnChannelClosing(); audio_render_host_->OnFilterRemoved(); audio_input_renderer_host_->OnChannelClosing(); @@ -351,7 +348,7 @@ void WebRTCAudioDeviceTest::WaitForMessageLoopCompletion( std::string WebRTCAudioDeviceTest::GetTestDataPath( const FilePath::StringType& file_name) { FilePath path; - EXPECT_TRUE(PathService::Get(content::DIR_TEST_DATA, &path)); + EXPECT_TRUE(PathService::Get(DIR_TEST_DATA, &path)); path = path.Append(file_name); EXPECT_TRUE(file_util::PathExists(path)); #ifdef OS_WIN @@ -375,3 +372,5 @@ int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, int len) { return network_->ReceivedRTCPPacket(channel, data, len); } + +} // namespace content diff --git a/content/test/webrtc_audio_device_test.h b/content/test/webrtc_audio_device_test.h index 0525c06..791ebf5 100644 --- a/content/test/webrtc_audio_device_test.h +++ b/content/test/webrtc_audio_device_test.h @@ -20,15 +20,6 @@ class AudioInputRendererHost; class AudioRendererHost; -class RenderThreadImpl; -class WebRTCMockRenderProcess; - -namespace content { -class ContentRendererClient; -class MockResourceContext; -class ResourceContext; -class TestBrowserThread; -} namespace media { class AudioManager; @@ -54,6 +45,14 @@ class ScopedCOMInitializer; } #endif +namespace content { +class ContentRendererClient; +class MockResourceContext; +class RenderThreadImpl; +class ResourceContext; +class TestBrowserThread; +class WebRTCMockRenderProcess; + // Scoped class for WebRTC interfaces. Fetches the wrapped interface // in the constructor via WebRTC's GetInterface mechanism and then releases // the reference in the destructor. @@ -211,4 +210,6 @@ class WebRTCTransportImpl : public webrtc::Transport { webrtc::VoENetwork* network_; }; +} // namespace content + #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ diff --git a/webkit/plugins/ppapi/fullscreen_container.h b/webkit/plugins/ppapi/fullscreen_container.h index 284386b..04d7ea2 100644 --- a/webkit/plugins/ppapi/fullscreen_container.h +++ b/webkit/plugins/ppapi/fullscreen_container.h @@ -7,7 +7,10 @@ #include "webkit/plugins/ppapi/plugin_delegate.h" +// TODO(yzshen): this is a layering violation. http://crbug.com/156865 +namespace content { class MouseLockDispatcher; +} namespace WebKit { struct WebCursorInfo; @@ -42,7 +45,7 @@ class FullscreenContainer { virtual void ReparentContext(PluginDelegate::PlatformContext3D*) = 0; // The returned object is owned by FullscreenContainer. - virtual MouseLockDispatcher* GetMouseLockDispatcher() = 0; + virtual content::MouseLockDispatcher* GetMouseLockDispatcher() = 0; protected: virtual ~FullscreenContainer() {} |