diff options
63 files changed, 319 insertions, 261 deletions
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc index 99f8247..8c22dc4 100644 --- a/content/browser/browser_main.cc +++ b/content/browser/browser_main.cc @@ -7,12 +7,13 @@ #include "base/debug/trace_event.h" #include "content/public/browser/browser_main_runner.h" +namespace content { + // Main routine for running as the Browser process. -int BrowserMain(const content::MainFunctionParams& parameters) { +int BrowserMain(const MainFunctionParams& parameters) { TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); - scoped_ptr<content::BrowserMainRunner> main_runner_( - content::BrowserMainRunner::Create()); + scoped_ptr<BrowserMainRunner> main_runner_(BrowserMainRunner::Create()); int exit_code = main_runner_->Initialize(parameters); if (exit_code >= 0) @@ -26,3 +27,5 @@ int BrowserMain(const content::MainFunctionParams& parameters) { return exit_code; } + +} // namespace content diff --git a/content/browser/browser_main.h b/content/browser/browser_main.h index 1f4ad4e..5934778 100644 --- a/content/browser/browser_main.h +++ b/content/browser/browser_main.h @@ -14,8 +14,8 @@ struct MainFunctionParams; bool ExitedMainMessageLoop(); -} // namespace content - CONTENT_EXPORT int BrowserMain(const content::MainFunctionParams& parameters); +} // namespace content + #endif // CONTENT_BROWSER_BROWSER_MAIN_H_ diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index 080e775..491e5b6 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h @@ -12,7 +12,6 @@ class CommandLine; class HighResolutionTimerManager; class MessageLoop; -class SystemMessageWindowWin; namespace base { class SystemMonitor; @@ -34,6 +33,7 @@ class BrowserThreadImpl; class MediaStreamManager; class ResourceDispatcherHostImpl; class SpeechRecognitionManagerImpl; +class SystemMessageWindowWin; class WebKitThread; struct MainFunctionParams; @@ -48,7 +48,7 @@ class DeviceMonitorMac; // All functions are to be called only on the UI thread unless otherwise noted. class BrowserMainLoop { public: - explicit BrowserMainLoop(const content::MainFunctionParams& parameters); + explicit BrowserMainLoop(const MainFunctionParams& parameters); virtual ~BrowserMainLoop(); void Init(); @@ -85,7 +85,7 @@ class BrowserMainLoop { void MainMessageLoopRun(); // Members initialized on construction --------------------------------------- - const content::MainFunctionParams& parameters_; + const MainFunctionParams& parameters_; const CommandLine& parsed_command_line_; int result_code_; diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc index 319a59f..a58e566 100644 --- a/content/browser/browser_main_runner.cc +++ b/content/browser/browser_main_runner.cc @@ -29,12 +29,9 @@ bool g_exited_main_message_loop = false; -using content::ChildProcess; -using content::NotificationServiceImpl; - -namespace { +namespace content { -class BrowserMainRunnerImpl : public content::BrowserMainRunner { +class BrowserMainRunnerImpl : public BrowserMainRunner { public: BrowserMainRunnerImpl() : is_initialized_(false), @@ -47,7 +44,7 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { Shutdown(); } - virtual int Initialize(const content::MainFunctionParams& parameters) + virtual int Initialize(const MainFunctionParams& parameters) OVERRIDE { is_initialized_ = true; @@ -70,7 +67,7 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { notification_service_.reset(new NotificationServiceImpl); - main_loop_.reset(new content::BrowserMainLoop(parameters)); + main_loop_.reset(new BrowserMainLoop(parameters)); main_loop_->Init(); @@ -99,10 +96,9 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { #endif // OS_WIN #if defined(OS_ANDROID) - content::SurfaceTexturePeer::InitInstance( - new content::SurfaceTexturePeerBrowserImpl( - parameters.command_line.HasSwitch( - switches::kMediaPlayerInRenderProcess))); + SurfaceTexturePeer::InitInstance(new SurfaceTexturePeerBrowserImpl( + parameters.command_line.HasSwitch( + switches::kMediaPlayerInRenderProcess))); #endif main_loop_->CreateThreads(); @@ -154,7 +150,7 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { bool created_threads_; scoped_ptr<NotificationServiceImpl> notification_service_; - scoped_ptr<content::BrowserMainLoop> main_loop_; + scoped_ptr<BrowserMainLoop> main_loop_; #if defined(OS_WIN) scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; #endif @@ -162,10 +158,6 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); }; -} // namespace - -namespace content { - // static BrowserMainRunner* BrowserMainRunner::Create() { return new BrowserMainRunnerImpl(); diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc index 2585844..5120e3b 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc @@ -10,11 +10,11 @@ #include "content/public/common/url_constants.h" #include "googleurl/src/gurl.h" -using content::BrowserURLHandler; +namespace content { // Handles rewriting view-source URLs for what we'll actually load. static bool HandleViewSource(GURL* url, - content::BrowserContext* browser_context) { + BrowserContext* browser_context) { if (url->SchemeIs(chrome::kViewSourceScheme)) { // Load the inner URL instead. *url = GURL(url->path()); @@ -46,8 +46,7 @@ static bool HandleViewSource(GURL* url, } // Turns a non view-source URL into the corresponding view-source URL. -static bool ReverseViewSource(GURL* url, - content::BrowserContext* browser_context) { +static bool ReverseViewSource(GURL* url, BrowserContext* browser_context) { // No action necessary if the URL is already view-source: if (url->SchemeIs(chrome::kViewSourceScheme)) return false; @@ -61,8 +60,7 @@ static bool ReverseViewSource(GURL* url, return true; } -static bool HandleDebugUrl(GURL* url, - content::BrowserContext* browser_context) { +static bool HandleDebugUrl(GURL* url, BrowserContext* browser_context) { // Circumvent processing URLs that the renderer process will handle. return *url == GURL(chrome::kChromeUICrashURL) || *url == GURL(chrome::kChromeUIHangURL) || @@ -89,7 +87,7 @@ BrowserURLHandlerImpl* BrowserURLHandlerImpl::GetInstance() { BrowserURLHandlerImpl::BrowserURLHandlerImpl() { AddHandlerPair(&HandleDebugUrl, BrowserURLHandlerImpl::null_handler()); - content::GetContentClient()->browser()->BrowserURLHandlerCreated(this); + GetContentClient()->browser()->BrowserURLHandlerCreated(this); // view-source: AddHandlerPair(&HandleViewSource, &ReverseViewSource); @@ -105,7 +103,7 @@ void BrowserURLHandlerImpl::AddHandlerPair(URLHandler handler, void BrowserURLHandlerImpl::RewriteURLIfNecessary( GURL* url, - content::BrowserContext* browser_context, + BrowserContext* browser_context, bool* reverse_on_redirect) { for (size_t i = 0; i < url_handlers_.size(); ++i) { URLHandler handler = *url_handlers_[i].first; @@ -117,7 +115,7 @@ void BrowserURLHandlerImpl::RewriteURLIfNecessary( } bool BrowserURLHandlerImpl::ReverseURLRewrite( - GURL* url, const GURL& original, content::BrowserContext* browser_context) { + GURL* url, const GURL& original, BrowserContext* browser_context) { for (size_t i = 0; i < url_handlers_.size(); ++i) { URLHandler reverse_rewriter = *url_handlers_[i].second; if (reverse_rewriter) { @@ -133,3 +131,5 @@ bool BrowserURLHandlerImpl::ReverseURLRewrite( } return false; } + +} // namespace content diff --git a/content/browser/browser_url_handler_impl.h b/content/browser/browser_url_handler_impl.h index 3ab559c..d0a1504 100644 --- a/content/browser/browser_url_handler_impl.h +++ b/content/browser/browser_url_handler_impl.h @@ -16,16 +16,15 @@ class GURL; namespace content { class BrowserContext; -} -class CONTENT_EXPORT BrowserURLHandlerImpl : public content::BrowserURLHandler { +class CONTENT_EXPORT BrowserURLHandlerImpl : public BrowserURLHandler { public: // Returns the singleton instance. static BrowserURLHandlerImpl* GetInstance(); // BrowserURLHandler implementation: virtual void RewriteURLIfNecessary(GURL* url, - content::BrowserContext* browser_context, + BrowserContext* browser_context, bool* reverse_on_redirect) OVERRIDE; // Add the specified handler pair to the list of URL handlers. virtual void AddHandlerPair(URLHandler handler, @@ -33,7 +32,7 @@ class CONTENT_EXPORT BrowserURLHandlerImpl : public content::BrowserURLHandler { // Reverses the rewriting that was done for |original| using the new |url|. bool ReverseURLRewrite(GURL* url, const GURL& original, - content::BrowserContext* browser_context); + BrowserContext* browser_context); private: // This object is a singleton: @@ -51,4 +50,6 @@ class CONTENT_EXPORT BrowserURLHandlerImpl : public content::BrowserURLHandler { DISALLOW_COPY_AND_ASSIGN(BrowserURLHandlerImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_BROWSER_URL_HANDLER_IMPL_H_ diff --git a/content/browser/browser_url_handler_impl_unittest.cc b/content/browser/browser_url_handler_impl_unittest.cc index de2228e..9759178 100644 --- a/content/browser/browser_url_handler_impl_unittest.cc +++ b/content/browser/browser_url_handler_impl_unittest.cc @@ -7,11 +7,13 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class BrowserURLHandlerImplTest : public testing::Test { }; // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar". -static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) { +static bool FooRewriter(GURL* url, BrowserContext* browser_context) { if (url->scheme() == "foo") { *url = GURL("bar://bar"); return true; @@ -20,7 +22,7 @@ static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) { } // Test URL rewriter that rewrites all "bar://" URLs to "foo://foo". -static bool BarRewriter(GURL* url, content::BrowserContext* browser_context) { +static bool BarRewriter(GURL* url, BrowserContext* browser_context) { if (url->scheme() == "bar") { *url = GURL("foo://foo"); return true; @@ -29,7 +31,7 @@ static bool BarRewriter(GURL* url, content::BrowserContext* browser_context) { } TEST_F(BrowserURLHandlerImplTest, BasicRewriteAndReverse) { - content::TestBrowserContext browser_context; + TestBrowserContext browser_context; BrowserURLHandlerImpl handler; handler.AddHandlerPair(FooRewriter, BarRewriter); @@ -58,7 +60,7 @@ TEST_F(BrowserURLHandlerImplTest, BasicRewriteAndReverse) { } TEST_F(BrowserURLHandlerImplTest, NullHandlerReverse) { - content::TestBrowserContext browser_context; + TestBrowserContext browser_context; BrowserURLHandlerImpl handler; GURL url("bar://foo"); @@ -76,3 +78,5 @@ TEST_F(BrowserURLHandlerImplTest, NullHandlerReverse) { ASSERT_TRUE(reversed); ASSERT_EQ("foo://foo", url.spec()); } + +} // namespace content diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc index 04fa657..d10ea20 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc @@ -12,9 +12,9 @@ #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" -using content::SiteInstance; +namespace content { -BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) +BrowsingInstance::BrowsingInstance(BrowserContext* browser_context) : browser_context_(browser_context) { } @@ -83,3 +83,5 @@ BrowsingInstance::~BrowsingInstance() { // us are gone. DCHECK(site_instance_map_.empty()); } + +} // namespace content diff --git a/content/browser/browsing_instance.h b/content/browser/browsing_instance.h index 43dbd83..7a4b1a6 100644 --- a/content/browser/browsing_instance.h +++ b/content/browser/browsing_instance.h @@ -12,11 +12,10 @@ #include "content/public/browser/browser_context.h" class GURL; -class SiteInstanceImpl; namespace content { class SiteInstance; -} +class SiteInstanceImpl; /////////////////////////////////////////////////////////////////////////////// // @@ -56,10 +55,10 @@ class CONTENT_EXPORT BrowsingInstance : public base::RefCounted<BrowsingInstance> { protected: // Create a new BrowsingInstance. - explicit BrowsingInstance(content::BrowserContext* context); + explicit BrowsingInstance(BrowserContext* context); // Get the browser context to which this BrowsingInstance belongs. - content::BrowserContext* browser_context() const { return browser_context_; } + BrowserContext* browser_context() const { return browser_context_; } // Returns whether this BrowsingInstance has registered a SiteInstance for // the site of the given URL. @@ -68,20 +67,20 @@ class CONTENT_EXPORT BrowsingInstance // Get the SiteInstance responsible for rendering the given URL. Should // create a new one if necessary, but should not create more than one // SiteInstance per site. - content::SiteInstance* GetSiteInstanceForURL(const GURL& url); + SiteInstance* GetSiteInstanceForURL(const GURL& url); // Adds the given SiteInstance to our map, to ensure that we do not create // another SiteInstance for the same site. - void RegisterSiteInstance(content::SiteInstance* site_instance); + void RegisterSiteInstance(SiteInstance* site_instance); // Removes the given SiteInstance from our map, after all references to it // have been deleted. This means it is safe to create a new SiteInstance // if the user later visits a page from this site, within this // BrowsingInstance. - void UnregisterSiteInstance(content::SiteInstance* site_instance); + void UnregisterSiteInstance(SiteInstance* site_instance); friend class SiteInstanceImpl; - friend class content::SiteInstance; + friend class SiteInstance; friend class base::RefCounted<BrowsingInstance>; @@ -90,11 +89,11 @@ class CONTENT_EXPORT BrowsingInstance private: // Map of site to SiteInstance, to ensure we only have one SiteInstance per - typedef base::hash_map<std::string, content::SiteInstance*> SiteInstanceMap; + typedef base::hash_map<std::string, SiteInstance*> SiteInstanceMap; // Common browser context to which all SiteInstances in this BrowsingInstance // must belong. - content::BrowserContext* const browser_context_; + BrowserContext* const browser_context_; // Map of site to SiteInstance, to ensure we only have one SiteInstance per // site. The site string should be the possibly_invalid_spec() of a GURL @@ -106,4 +105,6 @@ class CONTENT_EXPORT BrowsingInstance DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); }; +} // namespace content + #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ diff --git a/content/browser/cert_store_impl.cc b/content/browser/cert_store_impl.cc index e17e33a..5a171f7 100644 --- a/content/browser/cert_store_impl.cc +++ b/content/browser/cert_store_impl.cc @@ -26,8 +26,10 @@ struct MatchSecond { T value; }; +namespace content { + // static -content::CertStore* content::CertStore::GetInstance() { +CertStore* CertStore::GetInstance() { return CertStoreImpl::GetInstance(); } @@ -37,11 +39,11 @@ CertStoreImpl* CertStoreImpl::GetInstance() { } CertStoreImpl::CertStoreImpl() : next_cert_id_(1) { - if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { + if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { RegisterForNotification(); } else { - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, base::Bind(&CertStoreImpl::RegisterForNotification, base::Unretained(this))); } @@ -57,10 +59,10 @@ void CertStoreImpl::RegisterForNotification() { // removed from cache, and remove the cert when we know it // is not used anymore. - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, + NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, + NotificationService::AllBrowserContextsAndSources()); } int CertStoreImpl::StoreCert(net::X509Certificate* cert, int process_id) { @@ -168,12 +170,13 @@ void CertStoreImpl::RemoveCertsForRenderProcesHost(int process_id) { } void CertStoreImpl::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED || - type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED); - content::RenderProcessHost* rph = - content::Source<content::RenderProcessHost>(source).ptr(); + const NotificationSource& source, + const NotificationDetails& details) { + DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED || + type == NOTIFICATION_RENDERER_PROCESS_CLOSED); + RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); DCHECK(rph); RemoveCertsForRenderProcesHost(rph->GetID()); } + +} // namespace content diff --git a/content/browser/cert_store_impl.h b/content/browser/cert_store_impl.h index aa683c0..5c13fa3 100644 --- a/content/browser/cert_store_impl.h +++ b/content/browser/cert_store_impl.h @@ -14,8 +14,10 @@ #include "content/public/browser/notification_registrar.h" #include "net/base/x509_certificate.h" -class CertStoreImpl : public content::CertStore, - public content::NotificationObserver { +namespace content { + +class CertStoreImpl : public CertStore, + public NotificationObserver { public: // Returns the singleton instance of the CertStore. static CertStoreImpl* GetInstance(); @@ -26,10 +28,10 @@ class CertStoreImpl : public content::CertStore, virtual bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert) OVERRIDE; - // content::NotificationObserver implementation. + // NotificationObserver implementation. virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; protected: CertStoreImpl(); virtual ~CertStoreImpl(); @@ -52,7 +54,7 @@ class CertStoreImpl : public content::CertStore, ReverseCertMap; // Is only used on the UI Thread. - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; IDMap process_id_to_cert_id_; IDMap cert_id_to_process_id_; @@ -69,4 +71,6 @@ class CertStoreImpl : public content::CertStore, DISALLOW_COPY_AND_ASSIGN(CertStoreImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_CERT_STORE_IMPL_H_ diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc index 5d119e9..2cd2f51 100644 --- a/content/browser/child_process_security_policy_browsertest.cc +++ b/content/browser/child_process_security_policy_browsertest.cc @@ -16,8 +16,10 @@ #include "content/test/content_browser_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class ChildProcessSecurityPolicyInProcessBrowserTest - : public content::ContentBrowserTest { + : public ContentBrowserTest { public: virtual void SetUp() { EXPECT_EQ( @@ -39,19 +41,21 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, DISABLED_ #else IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { #endif - GURL url = content::GetTestUrl("", "simple_page.html"); + GURL url = GetTestUrl("", "simple_page.html"); - content::NavigateToURL(shell(), url); + NavigateToURL(shell(), url); EXPECT_EQ( ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), 1U); - content::WebContents* web_contents = shell()->web_contents(); + WebContents* web_contents = shell()->web_contents(); base::KillProcess(web_contents->GetRenderProcessHost()->GetHandle(), - content::RESULT_CODE_KILLED, true); + RESULT_CODE_KILLED, true); web_contents->GetController().Reload(true); EXPECT_EQ( 1U, ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size()); } + +} // namespace content diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index c2678ae..2c625c9 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -19,8 +19,7 @@ #include "net/url_request/url_request.h" #include "webkit/fileapi/isolated_context.h" -using content::ChildProcessSecurityPolicy; -using content::SiteInstance; +namespace content { namespace { @@ -168,7 +167,7 @@ class ChildProcessSecurityPolicyImpl::SecurityState { } bool has_web_ui_bindings() const { - return enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI; + return enabled_bindings_ & BINDINGS_POLICY_WEB_UI; } bool can_read_raw_cookies() const { @@ -425,7 +424,7 @@ void ChildProcessSecurityPolicyImpl::GrantWebUIBindings(int child_id) { if (state == security_state_.end()) return; - state->second->GrantBindings(content::BINDINGS_POLICY_WEB_UI); + state->second->GrantBindings(BINDINGS_POLICY_WEB_UI); // Web UI bindings need the ability to request chrome: URLs. state->second->GrantScheme(chrome::kChromeUIScheme); @@ -488,7 +487,7 @@ bool ChildProcessSecurityPolicyImpl::CanRequestURL( return false; } - if (!content::GetContentClient()->browser()->IsHandledURL(url) && + if (!GetContentClient()->browser()->IsHandledURL(url) && !net::URLRequest::IsHandledURL(url)) { return true; // This URL request is destined for ShellExecute. } @@ -629,3 +628,5 @@ bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystem( return false; return state->second->HasPermissionsForFileSystem(filesystem_id, permission); } + +} // namespace content diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h index b6898c4..79963b9 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h @@ -19,8 +19,10 @@ class FilePath; class GURL; +namespace content { + class CONTENT_EXPORT ChildProcessSecurityPolicyImpl - : NON_EXPORTED_BASE(public content::ChildProcessSecurityPolicy) { + : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) { public: // Object can only be created through GetInstance() so the constructor is // private. @@ -207,4 +209,6 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index 1be5a0b..0cd3a3f 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -14,13 +14,14 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { namespace { const int kRendererID = 42; const int kWorkerRendererID = kRendererID + 1; class ChildProcessSecurityPolicyTestBrowserClient - : public content::TestContentBrowserClient { + : public TestContentBrowserClient { public: ChildProcessSecurityPolicyTestBrowserClient() {} @@ -48,8 +49,8 @@ class ChildProcessSecurityPolicyTest : public testing::Test { } virtual void SetUp() { - old_browser_client_ = content::GetContentClient()->browser(); - content::GetContentClient()->set_browser_for_testing(&test_browser_client_); + old_browser_client_ = GetContentClient()->browser(); + GetContentClient()->set_browser_for_testing(&test_browser_client_); // Claim to always handle chrome:// URLs because the CPSP's notion of // allowing WebUI bindings is hard-wired to this particular scheme. @@ -58,7 +59,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { virtual void TearDown() { test_browser_client_.ClearSchemes(); - content::GetContentClient()->set_browser_for_testing(old_browser_client_); + GetContentClient()->set_browser_for_testing(old_browser_client_); } protected: @@ -68,7 +69,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { private: ChildProcessSecurityPolicyTestBrowserClient test_browser_client_; - content::ContentBrowserClient* old_browser_client_; + ContentBrowserClient* old_browser_client_; }; TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { @@ -490,3 +491,5 @@ TEST_F(ChildProcessSecurityPolicyTest, RemoveRace) { EXPECT_FALSE(p->CanReadFile(kRendererID, file)); EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); } + +} // namespace content diff --git a/content/browser/cross_site_request_manager.cc b/content/browser/cross_site_request_manager.cc index a4c2c32..2fa38b1 100644 --- a/content/browser/cross_site_request_manager.cc +++ b/content/browser/cross_site_request_manager.cc @@ -6,6 +6,8 @@ #include "base/memory/singleton.h" +namespace content { + bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id, int render_view_id) { base::AutoLock lock(lock_); @@ -36,3 +38,5 @@ CrossSiteRequestManager::~CrossSiteRequestManager() {} CrossSiteRequestManager* CrossSiteRequestManager::GetInstance() { return Singleton<CrossSiteRequestManager>::get(); } + +} // namespace content diff --git a/content/browser/cross_site_request_manager.h b/content/browser/cross_site_request_manager.h index cecfc93..5b0f210c 100644 --- a/content/browser/cross_site_request_manager.h +++ b/content/browser/cross_site_request_manager.h @@ -13,6 +13,8 @@ template <typename T> struct DefaultSingletonTraits; +namespace content { + // CrossSiteRequestManager is used to handle bookkeeping for cross-site // requests and responses between the UI and IO threads. Such requests involve // a transition from one RenderViewHost to another within WebContentsImpl, and @@ -56,4 +58,6 @@ class CrossSiteRequestManager { DISALLOW_COPY_AND_ASSIGN(CrossSiteRequestManager); }; +} // namespace content + #endif // CONTENT_BROWSER_CROSS_SITE_REQUEST_MANAGER_H_ diff --git a/content/browser/database_browsertest.cc b/content/browser/database_browsertest.cc index eb380a4..1b7d165 100644 --- a/content/browser/database_browsertest.cc +++ b/content/browser/database_browsertest.cc @@ -27,7 +27,7 @@ class DatabaseTest : public ContentBrowserTest { const std::string& script, const std::string& result) { std::string data; - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( + ASSERT_TRUE(ExecuteJavaScriptAndExtractString( shell->web_contents()->GetRenderViewHost(), L"", ASCIIToWide(script), &data)); ASSERT_EQ(data, result); @@ -62,7 +62,7 @@ class DatabaseTest : public ContentBrowserTest { bool HasTable(Shell* shell) { std::string data; - CHECK(content::ExecuteJavaScriptAndExtractString( + CHECK(ExecuteJavaScriptAndExtractString( shell->web_contents()->GetRenderViewHost(), L"", ASCIIToWide("getRecords()"), &data)); return data != "getRecords error: [object SQLError]"; diff --git a/content/browser/device_monitor_linux.cc b/content/browser/device_monitor_linux.cc index 2560dd3..8a734b9 100644 --- a/content/browser/device_monitor_linux.cc +++ b/content/browser/device_monitor_linux.cc @@ -53,7 +53,7 @@ void DeviceMonitorLinux::Initialize() { std::vector<UdevLinux::UdevMonitorFilter> filters; for (size_t i = 0; i < arraysize(kSubsystemMap); ++i) { - filters.push_back(content::UdevLinux::UdevMonitorFilter( + filters.push_back(UdevLinux::UdevMonitorFilter( kSubsystemMap[i].subsystem, kSubsystemMap[i].devtype)); } udev_.reset(new UdevLinux(filters, diff --git a/content/browser/download/base_file_win.cc b/content/browser/download/base_file_win.cc index b1c0dcd..4714439 100644 --- a/content/browser/download/base_file_win.cc +++ b/content/browser/download/base_file_win.cc @@ -215,7 +215,7 @@ DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE; - HRESULT hr = win_util::ScanAndSaveDownloadedFile(full_path_, source_url_); + HRESULT hr = ScanAndSaveDownloadedFile(full_path_, source_url_); // If the download file is missing after the call, then treat this as an // interrupted download. diff --git a/content/browser/download/download_stats.h b/content/browser/download/download_stats.h index 3bd4740..492a200 100644 --- a/content/browser/download/download_stats.h +++ b/content/browser/download/download_stats.h @@ -64,7 +64,7 @@ enum DownloadCountTypes { APPEND_TO_DETACHED_FILE_COUNT, // Counts the number of instances where the downloaded file is missing after a - // successful invocation of win_util::ScanAndSaveDownloadedFile(). + // successful invocation of ScanAndSaveDownloadedFile(). FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT, DOWNLOAD_COUNT_TYPES_LAST_ENTRY diff --git a/content/browser/encrypted_media_browsertest.cc b/content/browser/encrypted_media_browsertest.cc index cb47fd8..b2cf7b0 100644 --- a/content/browser/encrypted_media_browsertest.cc +++ b/content/browser/encrypted_media_browsertest.cc @@ -36,10 +36,10 @@ static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; +namespace content { -class EncryptedMediaTest - : public testing::WithParamInterface<const char*>, - public content::ContentBrowserTest { +class EncryptedMediaTest : public testing::WithParamInterface<const char*>, + public ContentBrowserTest { public: void TestSimplePlayback(const char* encrypted_media, const char* media_type, const char* key_system, const string16 expectation) { @@ -64,18 +64,18 @@ class EncryptedMediaTest GURL player_gurl = test_server()->GetURL(base::StringPrintf( "files/media/%s?keysystem=%s&mediafile=%s&mediatype=%s", html_page, key_system, media_file, media_type)); - content::TitleWatcher title_watcher(shell()->web_contents(), expectation); + TitleWatcher title_watcher(shell()->web_contents(), expectation); title_watcher.AlsoWaitForTitle(kError); title_watcher.AlsoWaitForTitle(kFailed); - content::NavigateToURL(shell(), player_gurl); + NavigateToURL(shell(), player_gurl); string16 final_title = title_watcher.WaitAndGetTitle(); EXPECT_EQ(expectation, final_title); if (final_title == kFailed) { std::string fail_message; - EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString( + EXPECT_TRUE(ExecuteJavaScriptAndExtractString( shell()->web_contents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(failMessage);", &fail_message)); LOG(INFO) << "Test failed: " << fail_message; @@ -171,3 +171,5 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameChangeVideo) { const string16 kExpected = ASCIIToUTF16("ENDED"); ASSERT_NO_FATAL_FAILURE(TestFrameSizeChange(GetParam(), kExpected)); } + +} // namespace content diff --git a/content/browser/histogram_controller.cc b/content/browser/histogram_controller.cc index 0db9aa3..228e67f 100644 --- a/content/browser/histogram_controller.cc +++ b/content/browser/histogram_controller.cc @@ -71,7 +71,7 @@ void HistogramController::GetHistogramDataFromChildProcesses( int pending_processes = 0; for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { - content::ProcessType type = iter.GetData().type; + ProcessType type = iter.GetData().type; if (type != PROCESS_TYPE_PLUGIN && type != PROCESS_TYPE_GPU) continue; ++pending_processes; diff --git a/content/browser/histogram_internals_request_job.cc b/content/browser/histogram_internals_request_job.cc index ad59f2a..08e2629 100644 --- a/content/browser/histogram_internals_request_job.cc +++ b/content/browser/histogram_internals_request_job.cc @@ -34,7 +34,7 @@ void AboutHistogram(std::string* data, const std::string& path) { // (in official builds). base::StatisticsRecorder::CollectHistogramStats("Browser"); #endif - content::HistogramSynchronizer::FetchHistograms(); + HistogramSynchronizer::FetchHistograms(); std::string unescaped_query; std::string unescaped_title("About Histograms"); diff --git a/content/browser/histogram_message_filter.h b/content/browser/histogram_message_filter.h index a1405e2..2801696 100644 --- a/content/browser/histogram_message_filter.h +++ b/content/browser/histogram_message_filter.h @@ -18,10 +18,10 @@ class HistogramMessageFilter : public BrowserMessageFilter { public: HistogramMessageFilter(); - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; diff --git a/content/browser/histogram_synchronizer.cc b/content/browser/histogram_synchronizer.cc index bb90b07..2fd3fea 100644 --- a/content/browser/histogram_synchronizer.cc +++ b/content/browser/histogram_synchronizer.cc @@ -165,7 +165,7 @@ HistogramSynchronizer::HistogramSynchronizer() callback_thread_(NULL), last_used_sequence_number_(kNeverUsableSequenceNumber), async_sequence_number_(kNeverUsableSequenceNumber) { - content::HistogramController::GetInstance()->Register(this); + HistogramController::GetInstance()->Register(this); } HistogramSynchronizer::~HistogramSynchronizer() { @@ -239,8 +239,7 @@ void HistogramSynchronizer::RegisterAndNotifyAllProcesses( RequestContext::Register(callback, sequence_number); // Get histogram data from renderer and browser child processes. - content::HistogramController::GetInstance()->GetHistogramData( - sequence_number); + HistogramController::GetInstance()->GetHistogramData(sequence_number); // Post a task that would be called after waiting for wait_time. This acts // as a watchdog, to cancel the requests for non-responsive processes. diff --git a/content/browser/histogram_synchronizer.h b/content/browser/histogram_synchronizer.h index 13f0acb..0968abd 100644 --- a/content/browser/histogram_synchronizer.h +++ b/content/browser/histogram_synchronizer.h @@ -49,7 +49,7 @@ namespace content { // outstanding sequence number, the pickled data is accepted into the browser, // but there is no impact on the counters. -class HistogramSynchronizer : public content::HistogramSubscriber { +class HistogramSynchronizer : public HistogramSubscriber { public: enum ProcessHistogramRequester { UNKNOWN, diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc index 72bd65b..66a03d6 100644 --- a/content/browser/host_zoom_map_impl.cc +++ b/content/browser/host_zoom_map_impl.cc @@ -23,9 +23,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebView; -using content::BrowserThread; -using content::RenderProcessHost; -using content::RenderViewHost; static const char* kHostZoomMapKeyName = "content_host_zoom_map"; @@ -41,13 +38,11 @@ HostZoomMap* HostZoomMap::GetForBrowserContext(BrowserContext* context) { return rv; } -} // namespace content - HostZoomMapImpl::HostZoomMapImpl() : default_zoom_level_(0.0) { registrar_.Add( - this, content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, - content::NotificationService::AllSources()); + this, NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, + NotificationService::AllSources()); } void HostZoomMapImpl::CopyFrom(HostZoomMap* copy_interface) { @@ -77,7 +72,7 @@ void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) { { base::AutoLock auto_lock(lock_); - if (content::ZoomValuesEqual(level, default_zoom_level_)) + if (ZoomValuesEqual(level, default_zoom_level_)) host_zoom_levels_.erase(host); else host_zoom_levels_[host] = level; @@ -94,10 +89,10 @@ void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) { } } - content::NotificationService::current()->Notify( - content::NOTIFICATION_ZOOM_LEVEL_CHANGED, - content::Source<HostZoomMap>(this), - content::Details<const std::string>(&host)); + NotificationService::current()->Notify( + NOTIFICATION_ZOOM_LEVEL_CHANGED, + Source<HostZoomMap>(this), + Details<const std::string>(&host)); } double HostZoomMapImpl::GetDefaultZoomLevel() const { @@ -150,23 +145,21 @@ void HostZoomMapImpl::SetTemporaryZoomLevel(int render_process_id, } std::string host; - content::NotificationService::current()->Notify( - content::NOTIFICATION_ZOOM_LEVEL_CHANGED, - content::Source<HostZoomMap>(this), - content::Details<const std::string>(&host)); + NotificationService::current()->Notify( + NOTIFICATION_ZOOM_LEVEL_CHANGED, + Source<HostZoomMap>(this), + Details<const std::string>(&host)); } -void HostZoomMapImpl::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { +void HostZoomMapImpl::Observe(int type, + const NotificationSource& source, + const NotificationDetails& details) { switch (type) { - case content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: { + case NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: { base::AutoLock auto_lock(lock_); - int render_view_id = - content::Source<RenderViewHost>(source)->GetRoutingID(); + int render_view_id = Source<RenderViewHost>(source)->GetRoutingID(); int render_process_id = - content::Source<RenderViewHost>(source)->GetProcess()->GetID(); + Source<RenderViewHost>(source)->GetProcess()->GetID(); for (size_t i = 0; i < temporary_zoom_levels_.size(); ++i) { if (temporary_zoom_levels_[i].render_process_id == render_process_id && @@ -184,3 +177,5 @@ void HostZoomMapImpl::Observe( HostZoomMapImpl::~HostZoomMapImpl() { } + +} // namespace content diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h index 7c6e68ca..7840188 100644 --- a/content/browser/host_zoom_map_impl.h +++ b/content/browser/host_zoom_map_impl.h @@ -17,12 +17,13 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +namespace content { + // HostZoomMap needs to be deleted on the UI thread because it listens // to notifications on there (and holds a NotificationRegistrar). -class CONTENT_EXPORT HostZoomMapImpl - : public NON_EXPORTED_BASE(content::HostZoomMap), - public content::NotificationObserver, - public base::SupportsUserData::Data { +class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), + public NotificationObserver, + public base::SupportsUserData::Data { public: HostZoomMapImpl(); virtual ~HostZoomMapImpl(); @@ -50,10 +51,10 @@ class CONTENT_EXPORT HostZoomMapImpl int render_view_id, double level); - // content::NotificationObserver implementation. + // NotificationObserver implementation. virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; private: typedef std::map<std::string, double> HostZoomLevels; @@ -76,9 +77,11 @@ class CONTENT_EXPORT HostZoomMapImpl // |temporary_zoom_levels_| to guarantee thread safety. mutable base::Lock lock_; - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ diff --git a/content/browser/host_zoom_map_impl_unittest.cc b/content/browser/host_zoom_map_impl_unittest.cc index 48a08cc..9f51369 100644 --- a/content/browser/host_zoom_map_impl_unittest.cc +++ b/content/browser/host_zoom_map_impl_unittest.cc @@ -10,14 +10,16 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class HostZoomMapTest : public testing::Test { public: - HostZoomMapTest() : ui_thread_(content::BrowserThread::UI, &message_loop_) { + HostZoomMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) { } protected: MessageLoop message_loop_; - content::TestBrowserThread ui_thread_; + TestBrowserThread ui_thread_; }; TEST_F(HostZoomMapTest, GetSetZoomLevel) { @@ -29,3 +31,5 @@ TEST_F(HostZoomMapTest, GetSetZoomLevel) { EXPECT_DOUBLE_EQ(host_zoom_map.GetZoomLevel("normal.com"), 0); EXPECT_DOUBLE_EQ(host_zoom_map.GetZoomLevel("zoomed.com"), zoomed); } + +} // namespace content diff --git a/content/browser/mach_broker_mac.cc b/content/browser/mach_broker_mac.cc index 01007a0..5662449 100644 --- a/content/browser/mach_broker_mac.cc +++ b/content/browser/mach_broker_mac.cc @@ -21,7 +21,7 @@ #include "content/public/browser/notification_types.h" #include "content/public/common/content_switches.h" -using content::BrowserThread; +namespace content { namespace { // Prints a string representation of a Mach error code. @@ -173,25 +173,23 @@ mach_port_t MachBroker::TaskForPid(base::ProcessHandle pid) const { } void MachBroker::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { // TODO(rohitrao): These notifications do not always carry the proper PIDs, // especially when the renderer is already gone or has crashed. Find a better // way to listen for child process deaths. http://crbug.com/55734 base::ProcessHandle handle = 0; switch (type) { - case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: - handle = - content::Details<content::RenderProcessHost::RendererClosedDetails>( - details)->handle; + case NOTIFICATION_RENDERER_PROCESS_CLOSED: + handle = Details<RenderProcessHost::RendererClosedDetails>( + details)->handle; break; - case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: - handle = content::Source<content::RenderProcessHost>(source)-> - GetHandle(); + case NOTIFICATION_RENDERER_PROCESS_TERMINATED: + handle = Source<RenderProcessHost>(source)->GetHandle(); break; - case content::NOTIFICATION_CHILD_PROCESS_CRASHED: - case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: - handle = content::Details<content::ChildProcessData>(details)->handle; + case NOTIFICATION_CHILD_PROCESS_CRASHED: + case NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: + handle = Details<ChildProcessData>(details)->handle; break; default: NOTREACHED() << "Unexpected notification"; @@ -216,12 +214,14 @@ MachBroker::MachBroker() : listener_thread_started_(false) { MachBroker::~MachBroker() {} void MachBroker::RegisterNotifications() { - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_CRASHED, - content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, - content::NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, + NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, + NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_CRASHED, + NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, + NotificationService::AllBrowserContextsAndSources()); } + +} // namespace content diff --git a/content/browser/mach_broker_mac.h b/content/browser/mach_broker_mac.h index 088edd0..de83d44 100644 --- a/content/browser/mach_broker_mac.h +++ b/content/browser/mach_broker_mac.h @@ -17,6 +17,8 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +namespace content { + // On OS X, the mach_port_t of a process is required to collect metrics about // the process. Running |task_for_pid()| is only allowed for privileged code. // However, a process has port rights to all its subprocesses, so let the @@ -32,7 +34,7 @@ // Since this data arrives over a separate channel, it is not available // immediately after a child process has been started. class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, - public content::NotificationObserver { + public NotificationObserver { public: // Returns the global MachBroker. static MachBroker* GetInstance(); @@ -80,10 +82,10 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, // Implement |ProcessMetrics::PortProvider|. virtual mach_port_t TaskForPid(base::ProcessHandle process) const OVERRIDE; - // Implement |content::NotificationObserver|. + // Implement |NotificationObserver|. virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; private: friend class MachBrokerTest; friend struct DefaultSingletonTraits<MachBroker>; @@ -99,7 +101,7 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, // Used to register for notifications received by NotificationObserver. // Accessed only on the UI thread. - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; // Stores mach info for every process in the broker. typedef std::map<base::ProcessHandle, MachInfo> MachMap; @@ -111,4 +113,6 @@ class CONTENT_EXPORT MachBroker : public base::ProcessMetrics::PortProvider, DISALLOW_COPY_AND_ASSIGN(MachBroker); }; +} // namespace content + #endif // CONTENT_BROWSER_MACH_BROKER_MAC_H_ diff --git a/content/browser/mach_broker_mac_unittest.cc b/content/browser/mach_broker_mac_unittest.cc index 9572dca..7bd88a5 100644 --- a/content/browser/mach_broker_mac_unittest.cc +++ b/content/browser/mach_broker_mac_unittest.cc @@ -7,6 +7,8 @@ #include "base/synchronization/lock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class MachBrokerTest : public testing::Test { public: // Helper function to acquire/release locks and call |PlaceholderForPid()|. @@ -58,3 +60,5 @@ TEST_F(MachBrokerTest, FinalizeUnknownPid) { FinalizePid(1u, MachBroker::MachInfo().SetTask(100u)); EXPECT_EQ(0u, broker_.TaskForPid(1u)); } + +} // namespace content diff --git a/content/browser/mime_registry_message_filter.cc b/content/browser/mime_registry_message_filter.cc index ef7e994..e29e1fa 100644 --- a/content/browser/mime_registry_message_filter.cc +++ b/content/browser/mime_registry_message_filter.cc @@ -7,7 +7,7 @@ #include "content/common/mime_registry_messages.h" #include "net/base/mime_util.h" -using content::BrowserThread; +namespace content { MimeRegistryMessageFilter::MimeRegistryMessageFilter() { } @@ -51,3 +51,5 @@ void MimeRegistryMessageFilter::OnGetPreferredExtensionForMimeType( const std::string& mime_type, FilePath::StringType* extension) { net::GetPreferredExtensionForMimeType(mime_type, extension); } + +} // namespace content diff --git a/content/browser/mime_registry_message_filter.h b/content/browser/mime_registry_message_filter.h index 3b27d6b..085e5d2 100644 --- a/content/browser/mime_registry_message_filter.h +++ b/content/browser/mime_registry_message_filter.h @@ -8,13 +8,15 @@ #include "base/file_path.h" #include "content/public/browser/browser_message_filter.h" -class MimeRegistryMessageFilter : public content::BrowserMessageFilter { +namespace content { + +class MimeRegistryMessageFilter : public BrowserMessageFilter { public: MimeRegistryMessageFilter(); virtual void OverrideThreadForMessage( const IPC::Message& message, - content::BrowserThread::ID* thread) OVERRIDE; + BrowserThread::ID* thread) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -29,4 +31,6 @@ class MimeRegistryMessageFilter : public content::BrowserMessageFilter { FilePath::StringType* extension); }; +} // namespace content + #endif // CONTENT_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_ diff --git a/content/browser/plugin_data_remover_impl_browsertest.cc b/content/browser/plugin_data_remover_impl_browsertest.cc index 4ca35c5..101987d 100644 --- a/content/browser/plugin_data_remover_impl_browsertest.cc +++ b/content/browser/plugin_data_remover_impl_browsertest.cc @@ -52,7 +52,7 @@ IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { base::WaitableEvent* event = plugin_data_remover.StartRemoving(base::Time()); watcher.StartWatching(event, this); - content::RunMessageLoop(); + RunMessageLoop(); } } // namespace content diff --git a/content/browser/power_save_blocker_mac.cc b/content/browser/power_save_blocker_mac.cc index c6244c2..d405690 100644 --- a/content/browser/power_save_blocker_mac.cc +++ b/content/browser/power_save_blocker_mac.cc @@ -14,6 +14,7 @@ #include "base/threading/thread.h" #include "content/public/browser/browser_thread.h" +namespace content { namespace { // Power management cannot be done on the UI thread. IOPMAssertionCreate does a @@ -36,8 +37,6 @@ base::LazyInstance<base::Thread, PowerSaveBlockerLazyInstanceTraits> } // namespace -namespace content { - class PowerSaveBlocker::Delegate : public base::RefCountedThreadSafe<PowerSaveBlocker::Delegate> { public: diff --git a/content/browser/power_save_blocker_win.cc b/content/browser/power_save_blocker_win.cc index b333a3b..ab3e408 100644 --- a/content/browser/power_save_blocker_win.cc +++ b/content/browser/power_save_blocker_win.cc @@ -12,6 +12,7 @@ #include "base/win/windows_version.h" #include "content/public/browser/browser_thread.h" +namespace content { namespace { int g_blocker_count[2]; @@ -79,7 +80,7 @@ void DeletePowerRequest(POWER_REQUEST_TYPE type, HANDLE handle) { DCHECK(success); } -void ApplySimpleBlock(content::PowerSaveBlocker::PowerSaveBlockerType type, +void ApplySimpleBlock(PowerSaveBlocker::PowerSaveBlockerType type, int delta) { g_blocker_count[type] += delta; DCHECK_GE(g_blocker_count[type], 0); @@ -88,7 +89,7 @@ void ApplySimpleBlock(content::PowerSaveBlocker::PowerSaveBlockerType type, return; DWORD this_flag = 0; - if (type == content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) + if (type == PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) this_flag |= ES_SYSTEM_REQUIRED; else this_flag |= ES_DISPLAY_REQUIRED; @@ -106,8 +107,6 @@ void ApplySimpleBlock(content::PowerSaveBlocker::PowerSaveBlockerType type, } // namespace. -namespace content { - class PowerSaveBlocker::Delegate : public base::RefCountedThreadSafe<PowerSaveBlocker::Delegate> { public: diff --git a/content/browser/profiler_controller_impl.cc b/content/browser/profiler_controller_impl.cc index a850cfd..fcf61ea 100644 --- a/content/browser/profiler_controller_impl.cc +++ b/content/browser/profiler_controller_impl.cc @@ -13,12 +13,9 @@ #include "content/public/browser/profiler_subscriber.h" #include "content/public/browser/render_process_host.h" -using content::BrowserChildProcessHostIterator; -using content::BrowserThread; - namespace content { -content::ProfilerController* content::ProfilerController::GetInstance() { +ProfilerController* ProfilerController::GetInstance() { return ProfilerControllerImpl::GetInstance(); } @@ -43,7 +40,7 @@ void ProfilerControllerImpl::OnPendingProcesses(int sequence_number, void ProfilerControllerImpl::OnProfilerDataCollected( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type) { + ProcessType process_type) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, diff --git a/content/browser/profiler_controller_impl.h b/content/browser/profiler_controller_impl.h index 5cde124..efce32a 100644 --- a/content/browser/profiler_controller_impl.h +++ b/content/browser/profiler_controller_impl.h @@ -39,7 +39,7 @@ class ProfilerControllerImpl : public ProfilerController { void OnProfilerDataCollected( int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, - content::ProcessType process_type); + ProcessType process_type); // ProfilerController implementation: virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; diff --git a/content/browser/profiler_message_filter.h b/content/browser/profiler_message_filter.h index 59f84ae..99d7327 100644 --- a/content/browser/profiler_message_filter.h +++ b/content/browser/profiler_message_filter.h @@ -21,10 +21,10 @@ class ProfilerMessageFilter : public BrowserMessageFilter { public: explicit ProfilerMessageFilter(ProcessType process_type); - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 4e2f615..7d3cf04 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h @@ -27,7 +27,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "webkit/glue/window_open_disposition.h" -class ChildProcessSecurityPolicyImpl; class SkBitmap; class ViewMsg_Navigate; struct AccessibilityHostMsg_NotificationParams; @@ -50,9 +49,7 @@ struct SelectedFileInfo; namespace content { -#if defined(OS_ANDROID) -class MediaPlayerManagerAndroid; -#endif +class ChildProcessSecurityPolicyImpl; class PowerSaveBlocker; class RenderViewHostObserver; class RenderWidgetHostDelegate; @@ -64,6 +61,10 @@ struct FileChooserParams; struct Referrer; struct ShowDesktopNotificationHostMsgParams; +#if defined(OS_ANDROID) +class MediaPlayerManagerAndroid; +#endif + // NotificationObserver used to listen for EXECUTE_JAVASCRIPT_RESULT // notifications. class ExecuteNotificationObserver : public NotificationObserver { diff --git a/content/browser/resolve_proxy_msg_helper.cc b/content/browser/resolve_proxy_msg_helper.cc index 56b4047..52d0987 100644 --- a/content/browser/resolve_proxy_msg_helper.cc +++ b/content/browser/resolve_proxy_msg_helper.cc @@ -12,6 +12,8 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" +namespace content { + ResolveProxyMsgHelper::ResolveProxyMsgHelper( net::URLRequestContextGetter* getter) : context_getter_(getter), @@ -97,3 +99,5 @@ void ResolveProxyMsgHelper::StartPendingRequest() { if (result != net::ERR_IO_PENDING) OnResolveProxyCompleted(result); } + +} // namespace content diff --git a/content/browser/resolve_proxy_msg_helper.h b/content/browser/resolve_proxy_msg_helper.h index ebdbdaa..8dd45eb 100644 --- a/content/browser/resolve_proxy_msg_helper.h +++ b/content/browser/resolve_proxy_msg_helper.h @@ -19,6 +19,8 @@ namespace net { class URLRequestContextGetter; } +namespace content { + // Responds to ChildProcessHostMsg_ResolveProxy, kicking off a ProxyResolve // request on the IO thread using the specified proxy service. Completion is // notified through the delegate. If multiple requests are started at the same @@ -29,14 +31,13 @@ class URLRequestContextGetter; // the stored IPC::Message pointers for pending requests. // // This object is expected to live on the IO thread. -class CONTENT_EXPORT ResolveProxyMsgHelper - : public content::BrowserMessageFilter { +class CONTENT_EXPORT ResolveProxyMsgHelper : public BrowserMessageFilter { public: explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter); // Constructor used by unittests. explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); - // content::BrowserMessageFilter implementation + // BrowserMessageFilter implementation virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -81,4 +82,6 @@ class CONTENT_EXPORT ResolveProxyMsgHelper net::ProxyService* proxy_service_; }; +} // namespace content + #endif // CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ diff --git a/content/browser/resolve_proxy_msg_helper_unittest.cc b/content/browser/resolve_proxy_msg_helper_unittest.cc index 7e8470a..512e611 100644 --- a/content/browser/resolve_proxy_msg_helper_unittest.cc +++ b/content/browser/resolve_proxy_msg_helper_unittest.cc @@ -13,8 +13,7 @@ #include "net/proxy/proxy_service.h" #include "testing/gtest/include/gtest/gtest.h" -using content::BrowserThread; -using content::BrowserThreadImpl; +namespace content { // This ProxyConfigService always returns "http://pac" as the PAC url to use. class MockProxyConfigService : public net::ProxyConfigService { @@ -235,3 +234,5 @@ TEST_F(ResolveProxyMsgHelperTest, CancelPendingRequests) { // It should also be the case that msg1, msg2, msg3 were deleted by the // cancellation. (Else will show up as a leak in Valgrind). } + +} // namespace content diff --git a/content/browser/resource_context_impl.cc b/content/browser/resource_context_impl.cc index 1ebcbce..7958566 100644 --- a/content/browser/resource_context_impl.cc +++ b/content/browser/resource_context_impl.cc @@ -36,7 +36,6 @@ static const char* kHostZoomMapKeyName = "content_host_zoom_map"; using appcache::AppCacheService; using base::UserDataAdapter; -using content::BrowserThread; using fileapi::FileSystemContext; using webkit_blob::BlobStorageController; using webkit_database::DatabaseTracker; diff --git a/content/browser/safe_util_win.cc b/content/browser/safe_util_win.cc index cc32022..f17c346 100644 --- a/content/browser/safe_util_win.cc +++ b/content/browser/safe_util_win.cc @@ -16,6 +16,7 @@ #include "googleurl/src/gurl.h" #include "ui/base/win/shell.h" +namespace content { namespace { // This GUID is associated with any 'don't ask me again' settings that the @@ -56,8 +57,6 @@ bool SetInternetZoneIdentifierDirectly(const FilePath& full_path) { } -namespace win_util { - // This function implementation is based on the attachment execution // services functionally deployed with IE6 or Service pack 2. This // functionality is exposed in the IAttachmentExecute COM interface. @@ -153,4 +152,4 @@ HRESULT ScanAndSaveDownloadedFile(const FilePath& full_path, return attachment_services->Save(); } -} // namespace win_util +} // namespace content diff --git a/content/browser/safe_util_win.h b/content/browser/safe_util_win.h index 41acfd5..a8cb077 100644 --- a/content/browser/safe_util_win.h +++ b/content/browser/safe_util_win.h @@ -11,7 +11,7 @@ class FilePath; class GURL; -namespace win_util { +namespace content { // Open or run a downloaded file via the Windows shell, possibly showing first // a consent dialog if the the file is deemed dangerous. This function is an @@ -68,6 +68,6 @@ bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, // |source_url|: the source URL for the download. HRESULT ScanAndSaveDownloadedFile(const FilePath& full_path, const GURL& source_url); -} // namespace win_util +} // namespace content #endif // CONTENT_COMMON_SAFE_UTIL_WIN_H_ diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc index 59a2aac..0ee7a11 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc @@ -18,12 +18,7 @@ #include "content/public/common/url_constants.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" -using content::BrowserContext; -using content::RenderProcessHost; -using content::RenderProcessHostImpl; -using content::SiteInstance; -using content::StoragePartitionImpl; -using content::WebUIControllerFactory; +namespace content { static bool IsURLSameAsAnySiteInstance(const GURL& url) { if (!url.is_valid()) @@ -50,12 +45,12 @@ SiteInstanceImpl::SiteInstanceImpl(BrowsingInstance* browsing_instance) has_site_(false) { DCHECK(browsing_instance); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, + NotificationService::AllBrowserContextsAndSources()); } SiteInstanceImpl::~SiteInstanceImpl() { - content::GetContentClient()->browser()->SiteInstanceDeleting(this); + GetContentClient()->browser()->SiteInstanceDeleting(this); // Now that no one is referencing us, we can safely remove ourselves from // the BrowsingInstance. Any future visits to a page from this site @@ -75,7 +70,7 @@ bool SiteInstanceImpl::HasProcess() const { // If we would use process-per-site for this site, also check if there is an // existing process that we would use if GetProcess() were called. - content::BrowserContext* browser_context = + BrowserContext* browser_context = browsing_instance_->browser_context(); if (has_site_ && RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context, site_) && @@ -138,7 +133,7 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() { process_, site_); } - content::GetContentClient()->browser()->SiteInstanceGotProcess(this); + GetContentClient()->browser()->SiteInstanceGotProcess(this); if (has_site_) LockToOrigin(); @@ -309,15 +304,15 @@ bool SiteInstance::IsSameWebSite(BrowserContext* browser_context, /*static*/ GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context, const GURL& url) { - return content::GetContentClient()->browser()-> + return GetContentClient()->browser()-> GetEffectiveURL(browser_context, url); } void SiteInstanceImpl::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); - RenderProcessHost* rph = content::Source<RenderProcessHost>(source).ptr(); + const NotificationSource& source, + const NotificationDetails& details) { + DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED); + RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); if (rph == process_) process_ = NULL; } @@ -330,3 +325,5 @@ void SiteInstanceImpl::LockToOrigin() { policy->LockToOrigin(process_->GetID(), site_); } } + +} // namespace content diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h index 9647f36..10b92cf 100644 --- a/content/browser/site_instance_impl.h +++ b/content/browser/site_instance_impl.h @@ -14,19 +14,18 @@ namespace content { class RenderProcessHostFactory; -} -class CONTENT_EXPORT SiteInstanceImpl : public content::SiteInstance, - public content::NotificationObserver { +class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, + public NotificationObserver { public: - // content::SiteInstance interface overrides. + // SiteInstance interface overrides. virtual int32 GetId() OVERRIDE; virtual bool HasProcess() const OVERRIDE; - virtual content::RenderProcessHost* GetProcess() OVERRIDE; + virtual RenderProcessHost* GetProcess() OVERRIDE; virtual const GURL& GetSiteURL() const OVERRIDE; virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; - virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; + virtual BrowserContext* GetBrowserContext() const OVERRIDE; // Set the web site that this SiteInstance is rendering pages for. // This includes the scheme and registered domain, but not the port. If the @@ -50,18 +49,17 @@ class CONTENT_EXPORT SiteInstanceImpl : public content::SiteInstance, // The factory must outlive the SiteInstance; ownership is not transferred. It // may be NULL, in which case the default BrowserRenderProcessHost will be // created (this is the behavior if you don't call this function). - void set_render_process_host_factory( - content::RenderProcessHostFactory* rph_factory) { + void set_render_process_host_factory(RenderProcessHostFactory* rph_factory) { render_process_host_factory_ = rph_factory; } // Returns the site for the given URL, which includes only the scheme and // registered domain. Returns an empty GURL if the URL has no host. - static GURL GetSiteForURL(content::BrowserContext* context, const GURL& url); + static GURL GetSiteForURL(BrowserContext* context, const GURL& url); protected: friend class BrowsingInstance; - friend class content::SiteInstance; + friend class SiteInstance; // Virtual to allow tests to extend it. virtual ~SiteInstanceImpl(); @@ -73,13 +71,13 @@ class CONTENT_EXPORT SiteInstanceImpl : public content::SiteInstance, private: // Get the effective URL for the given actual URL. - static GURL GetEffectiveURL(content::BrowserContext* browser_context, + static GURL GetEffectiveURL(BrowserContext* browser_context, const GURL& url); - // content::NotificationObserver implementation. + // NotificationObserver implementation. virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; // Used to restrict a process' origin access rights. void LockToOrigin(); @@ -90,20 +88,20 @@ class CONTENT_EXPORT SiteInstanceImpl : public content::SiteInstance, // A unique ID for this SiteInstance. int32 id_; - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; // BrowsingInstance to which this SiteInstance belongs. scoped_refptr<BrowsingInstance> browsing_instance_; // Factory for new RenderProcessHosts, not owned by this class. NULL indiactes // that the default BrowserRenderProcessHost should be created. - const content::RenderProcessHostFactory* render_process_host_factory_; + const RenderProcessHostFactory* render_process_host_factory_; // Current RenderProcessHost that is rendering pages for this SiteInstance. // This pointer will only change once the RenderProcessHost is destructed. It // will still remain the same even if the process crashes, since in that // scenario the RenderProcessHost remains the same. - content::RenderProcessHost* process_; + RenderProcessHost* process_; // The web site that this SiteInstance is rendering pages for. GURL site_; @@ -114,4 +112,6 @@ class CONTENT_EXPORT SiteInstanceImpl : public content::SiteInstance, DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 77fb923..f4ec250 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -32,7 +32,6 @@ #include "webkit/fileapi/file_system_url_request_job_factory.h" using appcache::AppCacheService; -using content::BrowserThread; using fileapi::FileSystemContext; using webkit_blob::BlobStorageController; diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc index 7f9a799..d2a7808 100644 --- a/content/browser/system_message_window_win.cc +++ b/content/browser/system_message_window_win.cc @@ -12,6 +12,8 @@ #include "base/system_monitor/system_monitor.h" #include "base/win/wrapped_window_proc.h" +namespace content { + namespace { const wchar_t kWindowClassName[] = L"Chrome_SystemMessageWindow"; @@ -149,3 +151,5 @@ LRESULT CALLBACK SystemMessageWindowWin::WndProc(HWND hwnd, UINT message, return ::DefWindowProc(hwnd, message, wparam, lparam); } + +} // namespace content diff --git a/content/browser/system_message_window_win.h b/content/browser/system_message_window_win.h index d4120c9..b29bad5 100644 --- a/content/browser/system_message_window_win.h +++ b/content/browser/system_message_window_win.h @@ -11,6 +11,8 @@ #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" +namespace content { + class CONTENT_EXPORT SystemMessageWindowWin { public: SystemMessageWindowWin(); @@ -44,4 +46,6 @@ class CONTENT_EXPORT SystemMessageWindowWin { DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin); }; +} // namespace content + #endif // CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ diff --git a/content/browser/system_message_window_win_unittest.cc b/content/browser/system_message_window_win_unittest.cc index 1c03de5..5053fa5 100644 --- a/content/browser/system_message_window_win_unittest.cc +++ b/content/browser/system_message_window_win_unittest.cc @@ -14,6 +14,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class SystemMessageWindowWinTest : public testing::Test { public: virtual ~SystemMessageWindowWinTest() { } @@ -39,3 +41,5 @@ TEST_F(SystemMessageWindowWinTest, RandomMessage) { window_.OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); message_loop_.RunAllPending(); } + +} // namespace content diff --git a/content/browser/trace_controller_impl.cc b/content/browser/trace_controller_impl.cc index 8b3a610..01542e3 100644 --- a/content/browser/trace_controller_impl.cc +++ b/content/browser/trace_controller_impl.cc @@ -23,7 +23,7 @@ namespace { base::LazyInstance<TraceControllerImpl>::Leaky g_controller = LAZY_INSTANCE_INITIALIZER; -class AutoStopTraceSubscriberStdio : public content::TraceSubscriberStdio { +class AutoStopTraceSubscriberStdio : public TraceSubscriberStdio { public: AutoStopTraceSubscriberStdio(const FilePath& file_path) : TraceSubscriberStdio(file_path) {} diff --git a/content/browser/trace_controller_impl.h b/content/browser/trace_controller_impl.h index 915f6a9..2144b54 100644 --- a/content/browser/trace_controller_impl.h +++ b/content/browser/trace_controller_impl.h @@ -14,9 +14,9 @@ #include "content/public/browser/trace_controller.h" class CommandLine; -class TraceMessageFilter; namespace content { +class TraceMessageFilter; class TraceControllerImpl : public TraceController { public: @@ -56,7 +56,7 @@ class TraceControllerImpl : public TraceController { typedef std::set<scoped_refptr<TraceMessageFilter> > FilterMap; friend struct base::DefaultLazyInstanceTraits<TraceControllerImpl>; - friend class ::TraceMessageFilter; + friend class TraceMessageFilter; TraceControllerImpl(); virtual ~TraceControllerImpl(); diff --git a/content/browser/trace_message_filter.cc b/content/browser/trace_message_filter.cc index 17dbee7..65bc842 100644 --- a/content/browser/trace_message_filter.cc +++ b/content/browser/trace_message_filter.cc @@ -7,9 +7,7 @@ #include "content/browser/trace_controller_impl.h" #include "content/common/child_process_messages.h" -using content::BrowserMessageFilter; -using content::BrowserThread; -using content::TraceControllerImpl; +namespace content { TraceMessageFilter::TraceMessageFilter() : has_child_(false), @@ -126,3 +124,4 @@ void TraceMessageFilter::OnTraceBufferPercentFullReply(float percent_full) { } } +} // namespace content diff --git a/content/browser/trace_message_filter.h b/content/browser/trace_message_filter.h index 4eece06..08f4ada 100644 --- a/content/browser/trace_message_filter.h +++ b/content/browser/trace_message_filter.h @@ -10,17 +10,19 @@ #include "content/public/browser/browser_message_filter.h" +namespace content { + // This class sends and receives trace messages on the browser process. // See also: trace_controller.h // See also: child_trace_message_filter.h -class TraceMessageFilter : public content::BrowserMessageFilter { +class TraceMessageFilter : public BrowserMessageFilter { public: TraceMessageFilter(); - // content::BrowserMessageFilter override. + // BrowserMessageFilter override. virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; - // content::BrowserMessageFilter implementation. + // BrowserMessageFilter implementation. virtual void OnChannelClosing() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -55,5 +57,6 @@ class TraceMessageFilter : public content::BrowserMessageFilter { DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter); }; -#endif // CONTENT_BROWSER_TRACE_MESSAGE_FILTER_H_ +} // namespace content +#endif // CONTENT_BROWSER_TRACE_MESSAGE_FILTER_H_ diff --git a/content/browser/trace_subscriber_stdio.h b/content/browser/trace_subscriber_stdio.h index eb63a05..da44ed9 100644 --- a/content/browser/trace_subscriber_stdio.h +++ b/content/browser/trace_subscriber_stdio.h @@ -18,7 +18,7 @@ class TraceSubscriberStdioImpl; // Stdio implementation of TraceSubscriber. Use this to write traces to a file. class CONTENT_EXPORT TraceSubscriberStdio - : NON_EXPORTED_BASE(public content::TraceSubscriber) { + : NON_EXPORTED_BASE(public TraceSubscriber) { public: // Creates or overwrites the specified file. Check IsValid() for success. explicit TraceSubscriberStdio(const FilePath& path); diff --git a/content/browser/trace_subscriber_stdio_unittest.cc b/content/browser/trace_subscriber_stdio_unittest.cc index c358ac8..22429e8 100644 --- a/content/browser/trace_subscriber_stdio_unittest.cc +++ b/content/browser/trace_subscriber_stdio_unittest.cc @@ -9,6 +9,8 @@ #include "content/public/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class TraceSubscriberStdioTest : public ::testing::Test {}; TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) { @@ -16,7 +18,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) { ASSERT_TRUE(trace_dir.CreateUniqueTempDir()); FilePath trace_file(trace_dir.path().AppendASCII("trace.txt")); { - content::TraceSubscriberStdio subscriber(trace_file); + TraceSubscriberStdio subscriber(trace_file); std::string foo("foo"); subscriber.OnTraceDataCollected( @@ -28,8 +30,10 @@ TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) { subscriber.OnEndTracingComplete(); } - content::BrowserThread::GetBlockingPool()->FlushForTesting(); + BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); EXPECT_EQ("[foo,bar]", result); } + +} // namespace content diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc index 6be899b..927f397 100644 --- a/content/browser/user_metrics.cc +++ b/content/browser/user_metrics.cc @@ -9,11 +9,9 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +namespace content { namespace { -using content::BrowserThread; -using content::UserMetricsAction; - // Forward declare because of circular dependency. void CallRecordOnUI(const std::string& action); @@ -26,10 +24,10 @@ void Record(const char *action) { return; } - content::NotificationService::current()->Notify( - content::NOTIFICATION_USER_ACTION, - content::NotificationService::AllSources(), - content::Details<const char*>(&action)); + NotificationService::current()->Notify( + NOTIFICATION_USER_ACTION, + NotificationService::AllSources(), + Details<const char*>(&action)); } void CallRecordOnUI(const std::string& action) { @@ -38,8 +36,6 @@ void CallRecordOnUI(const std::string& action) { } // namespace -namespace content { - void RecordAction(const UserMetricsAction& action) { Record(action.str_); } diff --git a/content/public/browser/site_instance.h b/content/public/browser/site_instance.h index ec1a072..8883973 100644 --- a/content/public/browser/site_instance.h +++ b/content/public/browser/site_instance.h @@ -10,10 +10,9 @@ #include "content/common/content_export.h" #include "googleurl/src/gurl.h" -class BrowsingInstance; - namespace content { class BrowserContext; +class BrowsingInstance; class RenderProcessHost; /////////////////////////////////////////////////////////////////////////////// diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index cd9af61..dde5a1d 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc @@ -16,8 +16,6 @@ #include "base/system_monitor/system_monitor.h" #endif -extern int BrowserMain(const content::MainFunctionParams&); - namespace { #if defined(OS_POSIX) @@ -39,6 +37,8 @@ static void DumpStackTraceSignalHandler(int signal) { namespace content { +extern int BrowserMain(const content::MainFunctionParams&); + BrowserTestBase::BrowserTestBase() { #if defined(OS_MACOSX) base::mac::SetOverrideAmIBundled(true); |