diff options
41 files changed, 319 insertions, 387 deletions
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index ddd225d..b6f14ce 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h @@ -13,6 +13,7 @@ class BrowserOnlineStateObserver; class CommandLine; class HighResolutionTimerManager; class MessageLoop; +class SystemMessageWindowWin; namespace base { class SystemMonitor; @@ -40,7 +41,6 @@ class BrowserMainParts; class BrowserShutdownImpl; class BrowserThreadImpl; class ResourceDispatcherHostImpl; -class SystemMessageWindowWin; class WebKitThread; struct MainFunctionParams; diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc index 3fa9afea..061c7d4 100644 --- a/content/browser/browser_main_runner.cc +++ b/content/browser/browser_main_runner.cc @@ -29,11 +29,11 @@ bool g_exited_main_message_loop = false; -namespace content { +using content::ChildProcess; namespace { -class BrowserMainRunnerImpl : public BrowserMainRunner { +class BrowserMainRunnerImpl : public content::BrowserMainRunner { public: BrowserMainRunnerImpl() : is_initialized_(false), @@ -46,7 +46,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { Shutdown(); } - virtual int Initialize(const MainFunctionParams& parameters) + virtual int Initialize(const content::MainFunctionParams& parameters) OVERRIDE { is_initialized_ = true; @@ -69,7 +69,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { notification_service_.reset(new NotificationServiceImpl); - main_loop_.reset(new BrowserMainLoop(parameters)); + main_loop_.reset(new content::BrowserMainLoop(parameters)); main_loop_->Init(); @@ -98,8 +98,8 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { #endif // OS_WIN #if defined(OS_ANDROID) - SurfaceTexturePeer::InitInstance( - new SurfaceTexturePeerBrowserImpl( + content::SurfaceTexturePeer::InitInstance( + new content::SurfaceTexturePeerBrowserImpl( parameters.command_line.HasSwitch( switches::kMediaPlayerInRenderProcess))); #endif @@ -153,7 +153,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { bool created_threads_; scoped_ptr<NotificationServiceImpl> notification_service_; - scoped_ptr<BrowserMainLoop> main_loop_; + scoped_ptr<content::BrowserMainLoop> main_loop_; #if defined(OS_WIN) scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; #endif @@ -163,6 +163,8 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { } // 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 46ed715..2585844 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc @@ -10,12 +10,11 @@ #include "content/public/common/url_constants.h" #include "googleurl/src/gurl.h" -namespace content { - -namespace { +using content::BrowserURLHandler; // Handles rewriting view-source URLs for what we'll actually load. -bool HandleViewSource(GURL* url, BrowserContext* browser_context) { +static bool HandleViewSource(GURL* url, + content::BrowserContext* browser_context) { if (url->SchemeIs(chrome::kViewSourceScheme)) { // Load the inner URL instead. *url = GURL(url->path()); @@ -47,7 +46,8 @@ bool HandleViewSource(GURL* url, BrowserContext* browser_context) { } // Turns a non view-source URL into the corresponding view-source URL. -bool ReverseViewSource(GURL* url, BrowserContext* browser_context) { +static bool ReverseViewSource(GURL* url, + content::BrowserContext* browser_context) { // No action necessary if the URL is already view-source: if (url->SchemeIs(chrome::kViewSourceScheme)) return false; @@ -61,7 +61,8 @@ bool ReverseViewSource(GURL* url, BrowserContext* browser_context) { return true; } -bool HandleDebugUrl(GURL* url, BrowserContext* browser_context) { +static bool HandleDebugUrl(GURL* url, + content::BrowserContext* browser_context) { // Circumvent processing URLs that the renderer process will handle. return *url == GURL(chrome::kChromeUICrashURL) || *url == GURL(chrome::kChromeUIHangURL) || @@ -69,8 +70,6 @@ bool HandleDebugUrl(GURL* url, BrowserContext* browser_context) { *url == GURL(chrome::kChromeUIShorthangURL); } -} // namespace - // static BrowserURLHandler* BrowserURLHandler::GetInstance() { return BrowserURLHandlerImpl::GetInstance(); @@ -90,7 +89,7 @@ BrowserURLHandlerImpl* BrowserURLHandlerImpl::GetInstance() { BrowserURLHandlerImpl::BrowserURLHandlerImpl() { AddHandlerPair(&HandleDebugUrl, BrowserURLHandlerImpl::null_handler()); - GetContentClient()->browser()->BrowserURLHandlerCreated(this); + content::GetContentClient()->browser()->BrowserURLHandlerCreated(this); // view-source: AddHandlerPair(&HandleViewSource, &ReverseViewSource); @@ -106,7 +105,7 @@ void BrowserURLHandlerImpl::AddHandlerPair(URLHandler handler, void BrowserURLHandlerImpl::RewriteURLIfNecessary( GURL* url, - BrowserContext* browser_context, + content::BrowserContext* browser_context, bool* reverse_on_redirect) { for (size_t i = 0; i < url_handlers_.size(); ++i) { URLHandler handler = *url_handlers_[i].first; @@ -117,9 +116,8 @@ void BrowserURLHandlerImpl::RewriteURLIfNecessary( } } -bool BrowserURLHandlerImpl::ReverseURLRewrite(GURL* url, - const GURL& original, - BrowserContext* browser_context) { +bool BrowserURLHandlerImpl::ReverseURLRewrite( + GURL* url, const GURL& original, content::BrowserContext* browser_context) { for (size_t i = 0; i < url_handlers_.size(); ++i) { URLHandler reverse_rewriter = *url_handlers_[i].second; if (reverse_rewriter) { @@ -135,5 +133,3 @@ bool BrowserURLHandlerImpl::ReverseURLRewrite(GURL* url, } return false; } - -} // namespace content diff --git a/content/browser/browser_url_handler_impl.h b/content/browser/browser_url_handler_impl.h index 8b7fce9..3ab559c 100644 --- a/content/browser/browser_url_handler_impl.h +++ b/content/browser/browser_url_handler_impl.h @@ -16,24 +16,24 @@ class GURL; namespace content { class BrowserContext; +} -class CONTENT_EXPORT BrowserURLHandlerImpl : public BrowserURLHandler { +class CONTENT_EXPORT BrowserURLHandlerImpl : public content::BrowserURLHandler { public: // Returns the singleton instance. static BrowserURLHandlerImpl* GetInstance(); // BrowserURLHandler implementation: virtual void RewriteURLIfNecessary(GURL* url, - BrowserContext* browser_context, + content::BrowserContext* browser_context, bool* reverse_on_redirect) OVERRIDE; // Add the specified handler pair to the list of URL handlers. virtual void AddHandlerPair(URLHandler handler, URLHandler reverse_handler) OVERRIDE; // Reverses the rewriting that was done for |original| using the new |url|. - bool ReverseURLRewrite(GURL* url, - const GURL& original, - BrowserContext* browser_context); + bool ReverseURLRewrite(GURL* url, const GURL& original, + content::BrowserContext* browser_context); private: // This object is a singleton: @@ -51,6 +51,4 @@ class CONTENT_EXPORT BrowserURLHandlerImpl : public 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 de90aac..de2228e 100644 --- a/content/browser/browser_url_handler_impl_unittest.cc +++ b/content/browser/browser_url_handler_impl_unittest.cc @@ -7,12 +7,11 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { - -namespace { +class BrowserURLHandlerImplTest : public testing::Test { +}; // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar". -bool FooRewriter(GURL* url, BrowserContext* browser_context) { +static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) { if (url->scheme() == "foo") { *url = GURL("bar://bar"); return true; @@ -21,7 +20,7 @@ bool FooRewriter(GURL* url, BrowserContext* browser_context) { } // Test URL rewriter that rewrites all "bar://" URLs to "foo://foo". -bool BarRewriter(GURL* url, BrowserContext* browser_context) { +static bool BarRewriter(GURL* url, content::BrowserContext* browser_context) { if (url->scheme() == "bar") { *url = GURL("foo://foo"); return true; @@ -29,10 +28,8 @@ bool BarRewriter(GURL* url, BrowserContext* browser_context) { return false; } -} // namespace - -TEST(BrowserURLHandlerImplTest, BasicRewriteAndReverse) { - TestBrowserContext browser_context; +TEST_F(BrowserURLHandlerImplTest, BasicRewriteAndReverse) { + content::TestBrowserContext browser_context; BrowserURLHandlerImpl handler; handler.AddHandlerPair(FooRewriter, BarRewriter); @@ -60,8 +57,8 @@ TEST(BrowserURLHandlerImplTest, BasicRewriteAndReverse) { ASSERT_EQ(saved_url, url); } -TEST(BrowserURLHandlerImplTest, NullHandlerReverse) { - TestBrowserContext browser_context; +TEST_F(BrowserURLHandlerImplTest, NullHandlerReverse) { + content::TestBrowserContext browser_context; BrowserURLHandlerImpl handler; GURL url("bar://foo"); @@ -79,5 +76,3 @@ TEST(BrowserURLHandlerImplTest, NullHandlerReverse) { ASSERT_TRUE(reversed); ASSERT_EQ("foo://foo", url.spec()); } - -} // namespace content diff --git a/content/browser/cert_store_impl.cc b/content/browser/cert_store_impl.cc index 877c1e4..e17e33a 100644 --- a/content/browser/cert_store_impl.cc +++ b/content/browser/cert_store_impl.cc @@ -15,10 +15,6 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" -namespace content { - -namespace { - template <typename T> struct MatchSecond { explicit MatchSecond(const T& t) : value(t) {} @@ -30,10 +26,8 @@ struct MatchSecond { T value; }; -} // namespace - // static -CertStore* CertStore::GetInstance() { +content::CertStore* content::CertStore::GetInstance() { return CertStoreImpl::GetInstance(); } @@ -43,10 +37,11 @@ CertStoreImpl* CertStoreImpl::GetInstance() { } CertStoreImpl::CertStoreImpl() : next_cert_id_(1) { - if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { + if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { RegisterForNotification(); } else { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, base::Bind(&CertStoreImpl::RegisterForNotification, base::Unretained(this))); } @@ -62,10 +57,10 @@ void CertStoreImpl::RegisterForNotification() { // removed from cache, and remove the cert when we know it // is not used anymore. - registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, - NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, - NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, + content::NotificationService::AllBrowserContextsAndSources()); + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, + content::NotificationService::AllBrowserContextsAndSources()); } int CertStoreImpl::StoreCert(net::X509Certificate* cert, int process_id) { @@ -173,13 +168,12 @@ void CertStoreImpl::RemoveCertsForRenderProcesHost(int process_id) { } void CertStoreImpl::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED || - type == NOTIFICATION_RENDERER_PROCESS_CLOSED); - RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); + 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(); DCHECK(rph); RemoveCertsForRenderProcesHost(rph->GetID()); } - -} // namespace content diff --git a/content/browser/cert_store_impl.h b/content/browser/cert_store_impl.h index 5c13fa3..aa683c0 100644 --- a/content/browser/cert_store_impl.h +++ b/content/browser/cert_store_impl.h @@ -14,10 +14,8 @@ #include "content/public/browser/notification_registrar.h" #include "net/base/x509_certificate.h" -namespace content { - -class CertStoreImpl : public CertStore, - public NotificationObserver { +class CertStoreImpl : public content::CertStore, + public content::NotificationObserver { public: // Returns the singleton instance of the CertStore. static CertStoreImpl* GetInstance(); @@ -28,10 +26,10 @@ class CertStoreImpl : public CertStore, virtual bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert) OVERRIDE; - // NotificationObserver implementation. + // content::NotificationObserver implementation. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; protected: CertStoreImpl(); virtual ~CertStoreImpl(); @@ -54,7 +52,7 @@ class CertStoreImpl : public CertStore, ReverseCertMap; // Is only used on the UI Thread. - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; IDMap process_id_to_cert_id_; IDMap cert_id_to_process_id_; @@ -71,6 +69,4 @@ class CertStoreImpl : public 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 a6c8d59..5d119e9 100644 --- a/content/browser/child_process_security_policy_browsertest.cc +++ b/content/browser/child_process_security_policy_browsertest.cc @@ -16,19 +16,17 @@ #include "content/test/content_browser_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { - class ChildProcessSecurityPolicyInProcessBrowserTest - : public ContentBrowserTest { + : public content::ContentBrowserTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() { EXPECT_EQ( ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), 0U); ContentBrowserTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() { EXPECT_EQ( ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), 0U); @@ -41,21 +39,19 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, DISABLED_ #else IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { #endif - GURL url = GetTestUrl("", "simple_page.html"); + GURL url = content::GetTestUrl("", "simple_page.html"); - NavigateToURL(shell(), url); + content::NavigateToURL(shell(), url); EXPECT_EQ( ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), 1U); - WebContents* web_contents = shell()->web_contents(); + content::WebContents* web_contents = shell()->web_contents(); base::KillProcess(web_contents->GetRenderProcessHost()->GetHandle(), - RESULT_CODE_KILLED, true); + content::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 2c625c9..c2678ae 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -19,7 +19,8 @@ #include "net/url_request/url_request.h" #include "webkit/fileapi/isolated_context.h" -namespace content { +using content::ChildProcessSecurityPolicy; +using content::SiteInstance; namespace { @@ -167,7 +168,7 @@ class ChildProcessSecurityPolicyImpl::SecurityState { } bool has_web_ui_bindings() const { - return enabled_bindings_ & BINDINGS_POLICY_WEB_UI; + return enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI; } bool can_read_raw_cookies() const { @@ -424,7 +425,7 @@ void ChildProcessSecurityPolicyImpl::GrantWebUIBindings(int child_id) { if (state == security_state_.end()) return; - state->second->GrantBindings(BINDINGS_POLICY_WEB_UI); + state->second->GrantBindings(content::BINDINGS_POLICY_WEB_UI); // Web UI bindings need the ability to request chrome: URLs. state->second->GrantScheme(chrome::kChromeUIScheme); @@ -487,7 +488,7 @@ bool ChildProcessSecurityPolicyImpl::CanRequestURL( return false; } - if (!GetContentClient()->browser()->IsHandledURL(url) && + if (!content::GetContentClient()->browser()->IsHandledURL(url) && !net::URLRequest::IsHandledURL(url)) { return true; // This URL request is destined for ShellExecute. } @@ -628,5 +629,3 @@ 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 d4b7287..b6898c4 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h @@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ #define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ + #include <map> #include <set> #include <string> @@ -18,10 +19,8 @@ class FilePath; class GURL; -namespace content { - class CONTENT_EXPORT ChildProcessSecurityPolicyImpl - : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) { + : NON_EXPORTED_BASE(public content::ChildProcessSecurityPolicy) { public: // Object can only be created through GetInstance() so the constructor is // private. @@ -208,6 +207,4 @@ 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 bcd2c99..1be5a0b 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -14,15 +14,13 @@ #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 TestContentBrowserClient { + : public content::TestContentBrowserClient { public: ChildProcessSecurityPolicyTestBrowserClient() {} @@ -50,8 +48,8 @@ class ChildProcessSecurityPolicyTest : public testing::Test { } virtual void SetUp() { - old_browser_client_ = GetContentClient()->browser(); - GetContentClient()->set_browser_for_testing(&test_browser_client_); + old_browser_client_ = content::GetContentClient()->browser(); + content::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. @@ -60,7 +58,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { virtual void TearDown() { test_browser_client_.ClearSchemes(); - GetContentClient()->set_browser_for_testing(old_browser_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); } protected: @@ -70,7 +68,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { private: ChildProcessSecurityPolicyTestBrowserClient test_browser_client_; - ContentBrowserClient* old_browser_client_; + content::ContentBrowserClient* old_browser_client_; }; TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { @@ -492,5 +490,3 @@ 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 2fa38b1..a4c2c32 100644 --- a/content/browser/cross_site_request_manager.cc +++ b/content/browser/cross_site_request_manager.cc @@ -6,8 +6,6 @@ #include "base/memory/singleton.h" -namespace content { - bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id, int render_view_id) { base::AutoLock lock(lock_); @@ -38,5 +36,3 @@ 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 5b0f210c..cecfc93 100644 --- a/content/browser/cross_site_request_manager.h +++ b/content/browser/cross_site_request_manager.h @@ -13,8 +13,6 @@ 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 @@ -58,6 +56,4 @@ class CrossSiteRequestManager { DISALLOW_COPY_AND_ASSIGN(CrossSiteRequestManager); }; -} // namespace content - #endif // CONTENT_BROWSER_CROSS_SITE_REQUEST_MANAGER_H_ diff --git a/content/browser/encrypted_media_browsertest.cc b/content/browser/encrypted_media_browsertest.cc index d95333b..812fd87 100644 --- a/content/browser/encrypted_media_browsertest.cc +++ b/content/browser/encrypted_media_browsertest.cc @@ -18,23 +18,24 @@ #include "googleurl/src/gurl.h" #include "webkit/media/crypto/key_systems.h" -namespace content { - // Platform-specific filename relative to the chrome executable. #if defined(OS_WIN) -const wchar_t kLibraryName[] = L"clearkeycdmplugin.dll"; +static const wchar_t kLibraryName[] = L"clearkeycdmplugin.dll"; #elif defined(OS_MACOSX) -const char kLibraryName[] = "clearkeycdmplugin.plugin"; +static const char kLibraryName[] = "clearkeycdmplugin.plugin"; #elif defined(OS_POSIX) -const char kLibraryName[] = "libclearkeycdmplugin.so"; +static const char kLibraryName[] = "libclearkeycdmplugin.so"; #endif // Available key systems. -const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; -const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; +static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; +static const char kExternalClearKeyKeySystem[] = + "org.chromium.externalclearkey"; + -class EncryptedMediaTest : public testing::WithParamInterface<const char*>, - public ContentBrowserTest { +class EncryptedMediaTest + : public testing::WithParamInterface<const char*>, + public content::ContentBrowserTest { public: void TestSimplePlayback(const char* encrypted_video, const char* key_system, const string16 expectation) { @@ -58,18 +59,18 @@ class EncryptedMediaTest : public testing::WithParamInterface<const char*>, GURL player_gurl = test_server()->GetURL(base::StringPrintf( "files/media/%s?keysystem=%s&mediafile=%s", html_page, key_system, media_file)); - TitleWatcher title_watcher(shell()->web_contents(), expectation); + content::TitleWatcher title_watcher(shell()->web_contents(), expectation); title_watcher.AlsoWaitForTitle(kError); title_watcher.AlsoWaitForTitle(kFailed); - NavigateToURL(shell(), player_gurl); + content::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(ExecuteJavaScriptAndExtractString( + EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString( shell()->web_contents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(failMessage);", &fail_message)); LOG(INFO) << "Test failed: " << fail_message; @@ -129,5 +130,3 @@ INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest, INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest, ::testing::Values(kExternalClearKeyKeySystem)); #endif - -} // namespace content diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 12e0fb0..ba51bda 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -34,7 +34,6 @@ #include "webkit/fileapi/local_file_system_operation.h" #include "webkit/fileapi/sandbox_mount_point_provider.h" -using content::ChildProcessSecurityPolicyImpl; using fileapi::FileSystemFileUtil; using fileapi::FileSystemMountPointProvider; using fileapi::FileSystemOperation; diff --git a/content/browser/host_zoom_map_impl_unittest.cc b/content/browser/host_zoom_map_impl_unittest.cc index 9f51369..48a08cc 100644 --- a/content/browser/host_zoom_map_impl_unittest.cc +++ b/content/browser/host_zoom_map_impl_unittest.cc @@ -10,16 +10,14 @@ #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_(BrowserThread::UI, &message_loop_) { + HostZoomMapTest() : ui_thread_(content::BrowserThread::UI, &message_loop_) { } protected: MessageLoop message_loop_; - TestBrowserThread ui_thread_; + content::TestBrowserThread ui_thread_; }; TEST_F(HostZoomMapTest, GetSetZoomLevel) { @@ -31,5 +29,3 @@ 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 a520a19..01007a0 100644 --- a/content/browser/mach_broker_mac.cc +++ b/content/browser/mach_broker_mac.cc @@ -21,15 +21,13 @@ #include "content/public/browser/notification_types.h" #include "content/public/common/content_switches.h" -namespace content { +using content::BrowserThread; namespace { - // Prints a string representation of a Mach error code. std::string MachErrorCode(kern_return_t err) { return base::StringPrintf("0x%x %s", err, mach_error_string(err)); } - } // namespace class MachListenerThreadDelegate : public base::PlatformThread::Delegate { @@ -175,24 +173,25 @@ mach_port_t MachBroker::TaskForPid(base::ProcessHandle pid) const { } void MachBroker::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::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 NOTIFICATION_RENDERER_PROCESS_CLOSED: + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: handle = - Details<RenderProcessHost::RendererClosedDetails>( + content::Details<content::RenderProcessHost::RendererClosedDetails>( details)->handle; break; - case NOTIFICATION_RENDERER_PROCESS_TERMINATED: - handle = Source<RenderProcessHost>(source)->GetHandle(); + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: + handle = content::Source<content::RenderProcessHost>(source)-> + GetHandle(); break; - case NOTIFICATION_CHILD_PROCESS_CRASHED: - case NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: - handle = Details<ChildProcessData>(details)->handle; + case content::NOTIFICATION_CHILD_PROCESS_CRASHED: + case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: + handle = content::Details<content::ChildProcessData>(details)->handle; break; default: NOTREACHED() << "Unexpected notification"; @@ -217,14 +216,12 @@ MachBroker::MachBroker() : listener_thread_started_(false) { MachBroker::~MachBroker() {} void MachBroker::RegisterNotifications() { - 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()); + 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()); } - -} // namespace content diff --git a/content/browser/mach_broker_mac_unittest.cc b/content/browser/mach_broker_mac_unittest.cc index 7bd88a5..9572dca 100644 --- a/content/browser/mach_broker_mac_unittest.cc +++ b/content/browser/mach_broker_mac_unittest.cc @@ -7,8 +7,6 @@ #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()|. @@ -60,5 +58,3 @@ TEST_F(MachBrokerTest, FinalizeUnknownPid) { FinalizePid(1u, MachBroker::MachInfo().SetTask(100u)); EXPECT_EQ(0u, broker_.TaskForPid(1u)); } - -} // namespace content diff --git a/content/browser/media_browsertest.cc b/content/browser/media_browsertest.cc index 41f3ac3..20c1a57 100644 --- a/content/browser/media_browsertest.cc +++ b/content/browser/media_browsertest.cc @@ -15,14 +15,13 @@ #include "content/test/content_browser_test_utils.h" #include "googleurl/src/gurl.h" -namespace content { - // Tests playback and seeking of an audio or video file over file or http based // on a test parameter. Test starts with playback, then, after X seconds or the // ended event fires, seeks near end of file; see player.html for details. The // test completes when either the last 'ended' or an 'error' event fires. -class MediaTest : public testing::WithParamInterface<bool>, - public ContentBrowserTest { +class MediaTest + : public testing::WithParamInterface<bool>, + public content::ContentBrowserTest { public: // Play specified audio over http:// or file:// depending on |http| setting. void PlayAudio(const char* media_file, bool http) { @@ -49,9 +48,9 @@ class MediaTest : public testing::WithParamInterface<bool>, base::StringPrintf("files/media/player.html?%s=%s", tag, media_file)); } - FilePath test_file_path = GetTestFilePath("media", "player.html"); + FilePath test_file_path = content::GetTestFilePath("media", "player.html"); std::string query = base::StringPrintf("%s=%s", tag, media_file); - return GetFileUrlWithQuery(test_file_path, query); + return content::GetFileUrlWithQuery(test_file_path, query); } void PlayMedia(const char* tag, const char* media_file, bool http) { @@ -64,11 +63,11 @@ class MediaTest : public testing::WithParamInterface<bool>, const string16 kEnded = ASCIIToUTF16("ENDED"); const string16 kError = ASCIIToUTF16("ERROR"); const string16 kFailed = ASCIIToUTF16("FAILED"); - TitleWatcher title_watcher(shell()->web_contents(), kEnded); + content::TitleWatcher title_watcher(shell()->web_contents(), kEnded); title_watcher.AlsoWaitForTitle(kFailed); title_watcher.AlsoWaitForTitle(kError); - NavigateToURL(shell(), player_gurl); + content::NavigateToURL(shell(), player_gurl); string16 final_title = title_watcher.WaitAndGetTitle(); EXPECT_EQ(kEnded, final_title); @@ -193,5 +192,3 @@ IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { RunLayoutTest("video-no-autoplay.html"); } - -} // namespace content diff --git a/content/browser/mime_registry_message_filter.cc b/content/browser/mime_registry_message_filter.cc index e29e1fa..ef7e994 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" -namespace content { +using content::BrowserThread; MimeRegistryMessageFilter::MimeRegistryMessageFilter() { } @@ -51,5 +51,3 @@ 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 dffdb2c..3b27d6b 100644 --- a/content/browser/mime_registry_message_filter.h +++ b/content/browser/mime_registry_message_filter.h @@ -8,14 +8,13 @@ #include "base/file_path.h" #include "content/public/browser/browser_message_filter.h" -namespace content { - -class MimeRegistryMessageFilter : public BrowserMessageFilter { +class MimeRegistryMessageFilter : public content::BrowserMessageFilter { public: MimeRegistryMessageFilter(); - virtual void OverrideThreadForMessage(const IPC::Message& message, - BrowserThread::ID* thread) OVERRIDE; + virtual void OverrideThreadForMessage( + const IPC::Message& message, + content::BrowserThread::ID* thread) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -30,6 +29,4 @@ class MimeRegistryMessageFilter : public BrowserMessageFilter { FilePath::StringType* extension); }; -} // namespace content - #endif // CONTENT_BROWSER_MIME_REGISTRY_MESSAGE_FILTER_H_ diff --git a/content/browser/notification_service_impl.cc b/content/browser/notification_service_impl.cc index 01e4211..2c6fa06 100644 --- a/content/browser/notification_service_impl.cc +++ b/content/browser/notification_service_impl.cc @@ -9,8 +9,6 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_types.h" -namespace content { - static base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> > lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; @@ -20,18 +18,18 @@ NotificationServiceImpl* NotificationServiceImpl::current() { } // static -NotificationService* NotificationService::current() { +content::NotificationService* content::NotificationService::current() { return NotificationServiceImpl::current(); } // static -NotificationService* NotificationService::Create() { +content::NotificationService* content::NotificationService::Create() { return new NotificationServiceImpl; } // static bool NotificationServiceImpl::HasKey(const NotificationSourceMap& map, - const NotificationSource& source) { + const content::NotificationSource& source) { return map.find(source.map_key()) != map.end(); } @@ -40,9 +38,10 @@ NotificationServiceImpl::NotificationServiceImpl() { lazy_tls_ptr.Pointer()->Set(this); } -void NotificationServiceImpl::AddObserver(NotificationObserver* observer, - int type, - const NotificationSource& source) { +void NotificationServiceImpl::AddObserver( + content::NotificationObserver* observer, + int type, + const content::NotificationSource& source) { // We have gotten some crashes where the observer pointer is NULL. The problem // is that this happens when we actually execute a notification, so have no // way of knowing who the bad observer was. We want to know when this happens @@ -64,9 +63,10 @@ void NotificationServiceImpl::AddObserver(NotificationObserver* observer, #endif } -void NotificationServiceImpl::RemoveObserver(NotificationObserver* observer, - int type, - const NotificationSource& source) { +void NotificationServiceImpl::RemoveObserver( + content::NotificationObserver* observer, + int type, + const content::NotificationSource& source) { // This is a very serious bug. An object is most likely being deleted on // the wrong thread, and as a result another thread's NotificationServiceImpl // has its deleted pointer in its map. A garbge object will be called in the @@ -89,41 +89,42 @@ void NotificationServiceImpl::RemoveObserver(NotificationObserver* observer, } } -void NotificationServiceImpl::Notify(int type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type > NOTIFICATION_ALL) << +void NotificationServiceImpl::Notify( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + DCHECK(type > content::NOTIFICATION_ALL) << "Allowed for observing, but not posting."; // There's no particular reason for the order in which the different // classes of observers get notified here. // Notify observers of all types and all sources - if (HasKey(observers_[NOTIFICATION_ALL], AllSources()) && + if (HasKey(observers_[content::NOTIFICATION_ALL], AllSources()) && source != AllSources()) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NOTIFICATION_ALL][AllSources().map_key()], + FOR_EACH_OBSERVER(content::NotificationObserver, + *observers_[content::NOTIFICATION_ALL][AllSources().map_key()], Observe(type, source, details)); } // Notify observers of all types and the given source - if (HasKey(observers_[NOTIFICATION_ALL], source)) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NOTIFICATION_ALL][source.map_key()], + if (HasKey(observers_[content::NOTIFICATION_ALL], source)) { + FOR_EACH_OBSERVER(content::NotificationObserver, + *observers_[content::NOTIFICATION_ALL][source.map_key()], Observe(type, source, details)); } // Notify observers of the given type and all sources if (HasKey(observers_[type], AllSources()) && source != AllSources()) { - FOR_EACH_OBSERVER(NotificationObserver, + FOR_EACH_OBSERVER(content::NotificationObserver, *observers_[type][AllSources().map_key()], Observe(type, source, details)); } // Notify observers of the given type and the given source if (HasKey(observers_[type], source)) { - FOR_EACH_OBSERVER(NotificationObserver, + FOR_EACH_OBSERVER(content::NotificationObserver, *observers_[type][source.map_key()], Observe(type, source, details)); } @@ -151,5 +152,3 @@ NotificationServiceImpl::~NotificationServiceImpl() { delete it->second; } } - -} // namespace content diff --git a/content/browser/notification_service_impl.h b/content/browser/notification_service_impl.h index 591284f..e7c135d 100644 --- a/content/browser/notification_service_impl.h +++ b/content/browser/notification_service_impl.h @@ -14,8 +14,10 @@ namespace content { class NotificationObserver; class NotificationRegistrar; +} -class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { +class CONTENT_EXPORT NotificationServiceImpl + : public content::NotificationService { public: static NotificationServiceImpl* current(); @@ -24,15 +26,15 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { NotificationServiceImpl(); virtual ~NotificationServiceImpl(); - // NotificationService: + // content::NotificationService virtual void Notify(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; private: - friend class NotificationRegistrar; + friend class content::NotificationRegistrar; - typedef ObserverList<NotificationObserver> NotificationObserverList; + typedef ObserverList<content::NotificationObserver> NotificationObserverList; typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap; typedef std::map<int, NotificationSourceMap> NotificationObserverMap; typedef std::map<int, int> NotificationObserverCount; @@ -40,7 +42,7 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { // Convenience function to determine whether a source has a // NotificationObserverList in the given map; static bool HasKey(const NotificationSourceMap& map, - const NotificationSource& source); + const content::NotificationSource& source); // NOTE: Rather than using this directly, you should use a // NotificationRegistrar. @@ -49,7 +51,7 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { // notification is posted. Observer is a pointer to an object subclassing // NotificationObserver to be notified when an event matching the other two // parameters is posted to this service. Type is the type of events to be - // notified about (or NOTIFICATION_ALL to receive events of all + // notified about (or content::NOTIFICATION_ALL to receive events of all // types). // Source is a NotificationSource object (created using // "Source<classname>(pointer)"), if this observer only wants to @@ -61,9 +63,8 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { // it must be removed for each of those combinations of type and source later. // // The caller retains ownership of the object pointed to by observer. - void AddObserver(NotificationObserver* observer, - int type, - const NotificationSource& source); + void AddObserver(content::NotificationObserver* observer, + int type, const content::NotificationSource& source); // NOTE: Rather than using this directly, you should use a // NotificationRegistrar. @@ -71,9 +72,8 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { // Removes the object pointed to by observer from receiving notifications // that match type and source. If no object matching the parameters is // currently registered, this method is a no-op. - void RemoveObserver(NotificationObserver* observer, - int type, - const NotificationSource& source); + void RemoveObserver(content::NotificationObserver* observer, + int type, const content::NotificationSource& source); // Keeps track of the observers for each type of notification. // Until we get a prohibitively large number of notification types, @@ -89,6 +89,4 @@ class CONTENT_EXPORT NotificationServiceImpl : public NotificationService { DISALLOW_COPY_AND_ASSIGN(NotificationServiceImpl); }; -} // namespace content - #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ diff --git a/content/browser/notification_service_impl_unittest.cc b/content/browser/notification_service_impl_unittest.cc index b63b843..62a0e51 100644 --- a/content/browser/notification_service_impl_unittest.cc +++ b/content/browser/notification_service_impl_unittest.cc @@ -8,34 +8,33 @@ #include "content/public/browser/notification_types.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { - namespace { // Bogus class to act as a NotificationSource for the messages. class TestSource {}; -class TestObserver : public NotificationObserver { - public: +class TestObserver : public content::NotificationObserver { +public: TestObserver() : notification_count_(0) {} int notification_count() { return notification_count_; } - virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE { + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { ++notification_count_; } - private: +private: int notification_count_; }; } // namespace + class NotificationServiceImplTest : public testing::Test { protected: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; }; TEST_F(NotificationServiceImplTest, Basic) { @@ -43,10 +42,10 @@ TEST_F(NotificationServiceImplTest, Basic) { TestSource other_source; // Check the equality operators defined for NotificationSource - EXPECT_TRUE(Source<TestSource>(&test_source) == - Source<TestSource>(&test_source)); - EXPECT_TRUE(Source<TestSource>(&test_source) != - Source<TestSource>(&other_source)); + EXPECT_TRUE(content::Source<TestSource>(&test_source) == + content::Source<TestSource>(&test_source)); + EXPECT_TRUE(content::Source<TestSource>(&test_source) != + content::Source<TestSource>(&other_source)); TestObserver all_types_all_sources; TestObserver idle_all_sources; @@ -54,55 +53,56 @@ TEST_F(NotificationServiceImplTest, Basic) { TestObserver idle_test_source; // Make sure it doesn't freak out when there are no observers. - NotificationService* service = NotificationService::current(); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); - - registrar_.Add(&all_types_all_sources, NOTIFICATION_ALL, - NotificationService::AllSources()); - registrar_.Add(&idle_all_sources, NOTIFICATION_IDLE, - NotificationService::AllSources()); - registrar_.Add(&all_types_test_source, NOTIFICATION_ALL, - Source<TestSource>(&test_source)); - registrar_.Add(&idle_test_source, NOTIFICATION_IDLE, - Source<TestSource>(&test_source)); + content::NotificationService* service = + content::NotificationService::current(); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); + + registrar_.Add(&all_types_all_sources, content::NOTIFICATION_ALL, + content::NotificationService::AllSources()); + registrar_.Add(&idle_all_sources, content::NOTIFICATION_IDLE, + content::NotificationService::AllSources()); + registrar_.Add(&all_types_test_source, content::NOTIFICATION_ALL, + content::Source<TestSource>(&test_source)); + registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source)); EXPECT_EQ(0, all_types_all_sources.notification_count()); EXPECT_EQ(0, idle_all_sources.notification_count()); EXPECT_EQ(0, all_types_test_source.notification_count()); EXPECT_EQ(0, idle_test_source.notification_count()); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(1, all_types_all_sources.notification_count()); EXPECT_EQ(1, idle_all_sources.notification_count()); EXPECT_EQ(1, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFICATION_BUSY, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_BUSY, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(2, all_types_all_sources.notification_count()); EXPECT_EQ(1, idle_all_sources.notification_count()); EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&other_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&other_source), + content::NotificationService::NoDetails()); EXPECT_EQ(3, all_types_all_sources.notification_count()); EXPECT_EQ(2, idle_all_sources.notification_count()); EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFICATION_BUSY, - Source<TestSource>(&other_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_BUSY, + content::Source<TestSource>(&other_source), + content::NotificationService::NoDetails()); EXPECT_EQ(4, all_types_all_sources.notification_count()); EXPECT_EQ(2, idle_all_sources.notification_count()); @@ -110,9 +110,9 @@ TEST_F(NotificationServiceImplTest, Basic) { EXPECT_EQ(1, idle_test_source.notification_count()); // Try send with NULL source. - service->Notify(NOTIFICATION_IDLE, - NotificationService::AllSources(), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::NotificationService::AllSources(), + content::NotificationService::NoDetails()); EXPECT_EQ(5, all_types_all_sources.notification_count()); EXPECT_EQ(3, idle_all_sources.notification_count()); @@ -121,9 +121,9 @@ TEST_F(NotificationServiceImplTest, Basic) { registrar_.RemoveAll(); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(5, all_types_all_sources.notification_count()); EXPECT_EQ(3, idle_all_sources.notification_count()); @@ -136,33 +136,32 @@ TEST_F(NotificationServiceImplTest, MultipleRegistration) { TestObserver idle_test_source; - NotificationService* service = NotificationService::current(); + content::NotificationService* service = + content::NotificationService::current(); - registrar_.Add(&idle_test_source, NOTIFICATION_IDLE, - Source<TestSource>(&test_source)); - registrar_.Add(&idle_test_source, NOTIFICATION_ALL, - Source<TestSource>(&test_source)); + registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source)); + registrar_.Add(&idle_test_source, content::NOTIFICATION_ALL, + content::Source<TestSource>(&test_source)); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(2, idle_test_source.notification_count()); - registrar_.Remove(&idle_test_source, NOTIFICATION_IDLE, - Source<TestSource>(&test_source)); + registrar_.Remove(&idle_test_source, content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source)); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); - registrar_.Remove(&idle_test_source, NOTIFICATION_ALL, - Source<TestSource>(&test_source)); + registrar_.Remove(&idle_test_source, content::NOTIFICATION_ALL, + content::Source<TestSource>(&test_source)); - service->Notify(NOTIFICATION_IDLE, - Source<TestSource>(&test_source), - NotificationService::NoDetails()); + service->Notify(content::NOTIFICATION_IDLE, + content::Source<TestSource>(&test_source), + content::NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); } - -} // namespace content diff --git a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc index a717951..d785c72 100644 --- a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc @@ -24,7 +24,6 @@ #endif using content::BrowserThread; -using content::ChildProcessSecurityPolicyImpl; namespace { diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 802c4ca..c62a70ba 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h @@ -27,6 +27,7 @@ #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; @@ -49,7 +50,6 @@ struct SelectedFileInfo; namespace content { -class ChildProcessSecurityPolicyImpl; #if defined(OS_ANDROID) class MediaPlayerManagerAndroid; #endif diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index f08c1f8..b5cff72 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc @@ -17,7 +17,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" #include "webkit/glue/webdropdata.h" -using content::ChildProcessSecurityPolicyImpl; using content::RenderViewHostImplTestHarness; using content::TestWebContents; diff --git a/content/browser/resolve_proxy_msg_helper.cc b/content/browser/resolve_proxy_msg_helper.cc index 52d0987..56b4047 100644 --- a/content/browser/resolve_proxy_msg_helper.cc +++ b/content/browser/resolve_proxy_msg_helper.cc @@ -12,8 +12,6 @@ #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), @@ -99,5 +97,3 @@ 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 8dd45eb..ebdbdaa 100644 --- a/content/browser/resolve_proxy_msg_helper.h +++ b/content/browser/resolve_proxy_msg_helper.h @@ -19,8 +19,6 @@ 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 @@ -31,13 +29,14 @@ namespace content { // the stored IPC::Message pointers for pending requests. // // This object is expected to live on the IO thread. -class CONTENT_EXPORT ResolveProxyMsgHelper : public BrowserMessageFilter { +class CONTENT_EXPORT ResolveProxyMsgHelper + : public content::BrowserMessageFilter { public: explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter); // Constructor used by unittests. explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); - // BrowserMessageFilter implementation + // content::BrowserMessageFilter implementation virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -82,6 +81,4 @@ class CONTENT_EXPORT ResolveProxyMsgHelper : public BrowserMessageFilter { 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 512e611..7e8470a 100644 --- a/content/browser/resolve_proxy_msg_helper_unittest.cc +++ b/content/browser/resolve_proxy_msg_helper_unittest.cc @@ -13,7 +13,8 @@ #include "net/proxy/proxy_service.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { +using content::BrowserThread; +using content::BrowserThreadImpl; // This ProxyConfigService always returns "http://pac" as the PAC url to use. class MockProxyConfigService : public net::ProxyConfigService { @@ -234,5 +235,3 @@ 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/site_instance_impl.cc b/content/browser/site_instance_impl.cc index 5e3d241..59a2aac 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc @@ -19,7 +19,6 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" using content::BrowserContext; -using content::ChildProcessSecurityPolicyImpl; using content::RenderProcessHost; using content::RenderProcessHostImpl; using content::SiteInstance; diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index ee14b16..21e6914 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -28,7 +28,17 @@ #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { +using content::BrowserContext; +using content::BrowserThread; +using content::BrowserThreadImpl; +using content::MockRenderProcessHost; +using content::MockRenderProcessHostFactory; +using content::NavigationEntry; +using content::NavigationEntryImpl; +using content::SiteInstance; +using content::WebContentsImpl; +using content::WebUI; +using content::WebUIController; namespace { @@ -36,7 +46,8 @@ const char kSameAsAnyInstanceURL[] = "about:internets"; const char kPrivilegedScheme[] = "privileged"; -class SiteInstanceTestWebUIControllerFactory : public WebUIControllerFactory { +class SiteInstanceTestWebUIControllerFactory + : public content::WebUIControllerFactory { public: virtual WebUIController* CreateWebUIControllerForURL( WebUI* web_ui, const GURL& url) const OVERRIDE { @@ -48,11 +59,11 @@ class SiteInstanceTestWebUIControllerFactory : public WebUIControllerFactory { } virtual bool UseWebUIForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return GetContentClient()->HasWebUIScheme(url); + return content::GetContentClient()->HasWebUIScheme(url); } virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return GetContentClient()->HasWebUIScheme(url); + return content::GetContentClient()->HasWebUIScheme(url); } virtual bool IsURLAcceptableForWebUI( BrowserContext* browser_context, @@ -72,17 +83,18 @@ class SiteInstanceTestClient : public TestContentClient { } }; -class SiteInstanceTestBrowserClient : public TestContentBrowserClient { +class SiteInstanceTestBrowserClient : public content::TestContentBrowserClient { public: SiteInstanceTestBrowserClient() : privileged_process_id_(-1) { } - virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE { + virtual content::WebUIControllerFactory* + GetWebUIControllerFactory() OVERRIDE { return &factory_; } - virtual bool IsSuitableHost(RenderProcessHost* process_host, + virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& site_url) OVERRIDE { return (privileged_process_id_ == process_host->GetID()) == site_url.SchemeIs(kPrivilegedScheme); @@ -101,28 +113,28 @@ class SiteInstanceTest : public testing::Test { public: SiteInstanceTest() : ui_thread_(BrowserThread::UI, &message_loop_), - file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, + file_user_blocking_thread_(content::BrowserThread::FILE_USER_BLOCKING, &message_loop_), - io_thread_(BrowserThread::IO, &message_loop_), + io_thread_(content::BrowserThread::IO, &message_loop_), old_client_(NULL), old_browser_client_(NULL) { } virtual void SetUp() { - old_client_ = GetContentClient(); - old_browser_client_ = GetContentClient()->browser(); - SetContentClient(&client_); - GetContentClient()->set_browser_for_testing(&browser_client_); + old_client_ = content::GetContentClient(); + old_browser_client_ = content::GetContentClient()->browser(); + content::SetContentClient(&client_); + content::GetContentClient()->set_browser_for_testing(&browser_client_); url_util::AddStandardScheme(kPrivilegedScheme); url_util::AddStandardScheme(chrome::kChromeUIScheme); } virtual void TearDown() { // Ensure that no RenderProcessHosts are left over after the tests. - EXPECT_TRUE(RenderProcessHost::AllHostsIterator().IsAtEnd()); + EXPECT_TRUE(content::RenderProcessHost::AllHostsIterator().IsAtEnd()); - GetContentClient()->set_browser_for_testing(old_browser_client_); - SetContentClient(old_client_); + content::GetContentClient()->set_browser_for_testing(old_browser_client_); + content::SetContentClient(old_client_); // http://crbug.com/143565 found SiteInstanceTest leaking an // AppCacheDatabase. This happens because some part of the test indirectly @@ -150,14 +162,14 @@ class SiteInstanceTest : public testing::Test { private: MessageLoopForUI message_loop_; - TestBrowserThread ui_thread_; - TestBrowserThread file_user_blocking_thread_; - TestBrowserThread io_thread_; + content::TestBrowserThread ui_thread_; + content::TestBrowserThread file_user_blocking_thread_; + content::TestBrowserThread io_thread_; SiteInstanceTestClient client_; SiteInstanceTestBrowserClient browser_client_; - ContentClient* old_client_; - ContentBrowserClient* old_browser_client_; + content::ContentClient* old_client_; + content::ContentBrowserClient* old_browser_client_; }; // Subclass of BrowsingInstance that updates a counter when deleted and @@ -212,7 +224,7 @@ class TestSiteInstance : public SiteInstanceImpl { TEST_F(SiteInstanceTest, SiteInstanceDestructor) { // The existence of this object will cause WebContentsImpl to create our // test one instead of the real one. - RenderViewHostTestEnabler rvh_test_enabler; + content::RenderViewHostTestEnabler rvh_test_enabler; int site_delete_counter = 0; int browsing_delete_counter = 0; const GURL url("test:foo"); @@ -224,7 +236,8 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) { EXPECT_EQ(0, site_delete_counter); NavigationEntryImpl* e1 = new NavigationEntryImpl( - instance, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); + instance, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Redundantly setting e1's SiteInstance shouldn't affect the ref count. e1->set_site_instance(instance); @@ -232,7 +245,8 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) { // Add a second reference NavigationEntryImpl* e2 = new NavigationEntryImpl( - instance, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); + instance, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Now delete both entries and be sure the SiteInstance goes away. delete e1; @@ -245,7 +259,8 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) { // browsing_instance is now deleted // Ensure that instances are deleted when their RenderViewHosts are gone. - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); instance = TestSiteInstance::CreateTestSiteInstance(browser_context.get(), &site_delete_counter, @@ -284,7 +299,8 @@ TEST_F(SiteInstanceTest, CloneNavigationEntry) { &browsing_delete_counter); NavigationEntryImpl* e1 = new NavigationEntryImpl( - instance1, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); + instance1, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Clone the entry NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1); @@ -311,8 +327,9 @@ TEST_F(SiteInstanceTest, CloneNavigationEntry) { // Test to ensure GetProcess returns and creates processes correctly. TEST_F(SiteInstanceTest, GetProcess) { // Ensure that GetProcess returns a process. - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); - scoped_ptr<RenderProcessHost> host1; + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); + scoped_ptr<content::RenderProcessHost> host1; scoped_refptr<SiteInstanceImpl> instance(static_cast<SiteInstanceImpl*>( SiteInstance::Create(browser_context.get()))); host1.reset(instance->GetProcess()); @@ -321,7 +338,7 @@ TEST_F(SiteInstanceTest, GetProcess) { // Ensure that GetProcess creates a new process. scoped_refptr<SiteInstanceImpl> instance2(static_cast<SiteInstanceImpl*>( SiteInstance::Create(browser_context.get()))); - scoped_ptr<RenderProcessHost> host2(instance2->GetProcess()); + scoped_ptr<content::RenderProcessHost> host2(instance2->GetProcess()); EXPECT_TRUE(host2.get() != NULL); EXPECT_NE(host1.get(), host2.get()); @@ -412,7 +429,8 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSite) { ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( switches::kProcessPerSite)); int delete_counter = 0; - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); TestBrowsingInstance* browsing_instance = new TestBrowsingInstance(browser_context.get(), &delete_counter); @@ -455,8 +473,9 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSite) { // The two SiteInstances for http://google.com should not use the same process // if process-per-site is not enabled. - scoped_ptr<RenderProcessHost> process_a1(site_instance_a1->GetProcess()); - scoped_ptr<RenderProcessHost> process_a2_2( + scoped_ptr<content::RenderProcessHost> process_a1( + site_instance_a1->GetProcess()); + scoped_ptr<content::RenderProcessHost> process_a2_2( site_instance_a2_2->GetProcess()); EXPECT_NE(process_a1.get(), process_a2_2.get()); @@ -486,7 +505,8 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kProcessPerSite); int delete_counter = 0; - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); TestBrowsingInstance* browsing_instance = new TestBrowsingInstance(browser_context.get(), &delete_counter); @@ -495,7 +515,7 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { static_cast<SiteInstanceImpl*>( browsing_instance->GetSiteInstanceForURL(url_a1))); EXPECT_TRUE(site_instance_a1.get() != NULL); - scoped_ptr<RenderProcessHost> process_a1( + scoped_ptr<content::RenderProcessHost> process_a1( site_instance_a1->GetProcess()); // A separate site should create a separate SiteInstance. @@ -531,14 +551,15 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { // A visit to the original site in a new BrowsingInstance (different browser // context) should return a different SiteInstance with a different process. - scoped_ptr<TestBrowserContext> browser_context2(new TestBrowserContext()); + scoped_ptr<content::TestBrowserContext> browser_context2( + new content::TestBrowserContext()); TestBrowsingInstance* browsing_instance3 = new TestBrowsingInstance(browser_context2.get(), &delete_counter); scoped_refptr<SiteInstanceImpl> site_instance_a2_3( static_cast<SiteInstanceImpl*>( browsing_instance3->GetSiteInstanceForURL(url_a2))); EXPECT_TRUE(site_instance_a2_3.get() != NULL); - scoped_ptr<RenderProcessHost> process_a2_3( + scoped_ptr<content::RenderProcessHost> process_a2_3( site_instance_a2_3->GetProcess()); EXPECT_NE(site_instance_a1.get(), site_instance_a2_3.get()); EXPECT_NE(process_a1.get(), process_a2_3.get()); @@ -565,9 +586,10 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { DrainMessageLoops(); } -static SiteInstanceImpl* CreateSiteInstance(BrowserContext* browser_context, - RenderProcessHostFactory* factory, - const GURL& url) { +static SiteInstanceImpl* CreateSiteInstance( + content::BrowserContext* browser_context, + content::RenderProcessHostFactory* factory, + const GURL& url) { SiteInstanceImpl* instance = reinterpret_cast<SiteInstanceImpl*>( SiteInstance::CreateForURL(browser_context, url)); @@ -583,9 +605,10 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { ChildProcessSecurityPolicyImpl::GetInstance(); // Make a bunch of mock renderers so that we hit the limit. - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); std::vector<MockRenderProcessHost*> hosts; - for (size_t i = 0; i < kMaxRendererProcessCount; ++i) + for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) hosts.push_back(new MockRenderProcessHost(browser_context.get())); // Create some extension instances and make sure they share a process. @@ -598,7 +621,7 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { CreateSiteInstance(browser_context.get(), &rph_factory, GURL(kPrivilegedScheme + std::string("://baz/bar")))); - scoped_ptr<RenderProcessHost> extension_host( + scoped_ptr<content::RenderProcessHost> extension_host( extension1_instance->GetProcess()); EXPECT_EQ(extension1_instance->GetProcess(), extension2_instance->GetProcess()); @@ -613,13 +636,14 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { browser_context.get(), &rph_factory, GURL(chrome::kChromeUIScheme + std::string("://history")))); - scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess()); + scoped_ptr<content::RenderProcessHost> dom_host( + webui1_instance->GetProcess()); EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess()); // Make sure none of differing privilege processes are mixed. EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); - for (size_t i = 0; i < kMaxRendererProcessCount; ++i) { + for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); } @@ -632,8 +656,9 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { // Test to ensure that HasWrongProcessForURL behaves properly for different // types of URLs. TEST_F(SiteInstanceTest, HasWrongProcessForURL) { - scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); - scoped_ptr<RenderProcessHost> host; + scoped_ptr<content::TestBrowserContext> browser_context( + new content::TestBrowserContext()); + scoped_ptr<content::RenderProcessHost> host; scoped_refptr<SiteInstanceImpl> instance(static_cast<SiteInstanceImpl*>( SiteInstance::Create(browser_context.get()))); @@ -661,5 +686,3 @@ TEST_F(SiteInstanceTest, HasWrongProcessForURL) { DrainMessageLoops(); } - -} // namespace content diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc index 4a96dfb..7f9a799 100644 --- a/content/browser/system_message_window_win.cc +++ b/content/browser/system_message_window_win.cc @@ -12,10 +12,7 @@ #include "base/system_monitor/system_monitor.h" #include "base/win/wrapped_window_proc.h" -namespace content { - namespace { - const wchar_t kWindowClassName[] = L"Chrome_SystemMessageWindow"; // A static map from a device category guid to base::SystemMonitor::DeviceType. @@ -26,7 +23,6 @@ struct { { KSCATEGORY_AUDIO, base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE }, { KSCATEGORY_VIDEO, base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE }, }; - } // namespace // Manages the device notification handles for SystemMessageWindowWin. @@ -153,5 +149,3 @@ 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 b29bad5..d4120c9 100644 --- a/content/browser/system_message_window_win.h +++ b/content/browser/system_message_window_win.h @@ -11,8 +11,6 @@ #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" -namespace content { - class CONTENT_EXPORT SystemMessageWindowWin { public: SystemMessageWindowWin(); @@ -46,6 +44,4 @@ 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 0d1416d..1c03de5 100644 --- a/content/browser/system_message_window_win_unittest.cc +++ b/content/browser/system_message_window_win_unittest.cc @@ -14,11 +14,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { - class SystemMessageWindowWinTest : public testing::Test { public: - virtual ~SystemMessageWindowWinTest() {} + virtual ~SystemMessageWindowWinTest() { } protected: virtual void SetUp() OVERRIDE { @@ -41,5 +39,3 @@ TEST_F(SystemMessageWindowWinTest, RandomMessage) { window_.OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); message_loop_.RunAllPending(); } - -} // namespace content diff --git a/content/browser/trace_controller_impl.h b/content/browser/trace_controller_impl.h index 2144b54..915f6a9 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 17c9cb0..17dbee7 100644 --- a/content/browser/trace_message_filter.cc +++ b/content/browser/trace_message_filter.cc @@ -7,12 +7,14 @@ #include "content/browser/trace_controller_impl.h" #include "content/common/child_process_messages.h" -namespace content { - -TraceMessageFilter::TraceMessageFilter() - : has_child_(false), - is_awaiting_end_ack_(false), - is_awaiting_buffer_percent_full_ack_(false) { +using content::BrowserMessageFilter; +using content::BrowserThread; +using content::TraceControllerImpl; + +TraceMessageFilter::TraceMessageFilter() : + has_child_(false), + is_awaiting_end_ack_(false), + is_awaiting_buffer_percent_full_ack_(false) { } void TraceMessageFilter::OnFilterAdded(IPC::Channel* channel) { @@ -124,4 +126,3 @@ 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 357e8ee..4eece06 100644 --- a/content/browser/trace_message_filter.h +++ b/content/browser/trace_message_filter.h @@ -10,17 +10,17 @@ #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 BrowserMessageFilter { +class TraceMessageFilter : public content::BrowserMessageFilter { public: TraceMessageFilter(); - // BrowserMessageFilter overrides. + // content::BrowserMessageFilter override. virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; + + // content::BrowserMessageFilter implementation. virtual void OnChannelClosing() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok) OVERRIDE; @@ -55,6 +55,5 @@ class TraceMessageFilter : public BrowserMessageFilter { DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter); }; -} // namespace content - #endif // CONTENT_BROWSER_TRACE_MESSAGE_FILTER_H_ + diff --git a/content/browser/trace_subscriber_stdio_unittest.cc b/content/browser/trace_subscriber_stdio_unittest.cc index 51d913d..c358ac8 100644 --- a/content/browser/trace_subscriber_stdio_unittest.cc +++ b/content/browser/trace_subscriber_stdio_unittest.cc @@ -9,14 +9,14 @@ #include "content/public/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { +class TraceSubscriberStdioTest : public ::testing::Test {}; -TEST(TraceSubscriberStdioTest, CanWriteDataToFile) { +TEST_F(TraceSubscriberStdioTest, CanWriteDataToFile) { ScopedTempDir trace_dir; ASSERT_TRUE(trace_dir.CreateUniqueTempDir()); FilePath trace_file(trace_dir.path().AppendASCII("trace.txt")); { - TraceSubscriberStdio subscriber(trace_file); + content::TraceSubscriberStdio subscriber(trace_file); std::string foo("foo"); subscriber.OnTraceDataCollected( @@ -28,10 +28,8 @@ TEST(TraceSubscriberStdioTest, CanWriteDataToFile) { subscriber.OnEndTracingComplete(); } - BrowserThread::GetBlockingPool()->FlushForTesting(); + content::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/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc index 51fdcad..dbc01dc 100644 --- a/content/browser/webui/web_ui_impl.cc +++ b/content/browser/webui/web_ui_impl.cc @@ -23,7 +23,6 @@ #include "content/public/common/bindings_policy.h" #include "content/public/common/content_client.h" -using content::ChildProcessSecurityPolicyImpl; using content::RenderViewHostImpl; using content::WebContents; using content::WebUIController; diff --git a/content/public/test/test_content_client_initializer.h b/content/public/test/test_content_client_initializer.h index 71e2918b..9bb1ffe 100644 --- a/content/public/test/test_content_client_initializer.h +++ b/content/public/test/test_content_client_initializer.h @@ -8,11 +8,12 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +class NotificationServiceImpl; + namespace content { class ContentClient; class MockRenderProcessHostFactory; -class NotificationServiceImpl; class TestContentBrowserClient; class TestRenderViewHostFactory; |