diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 17:43:21 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 17:43:21 +0000 |
commit | bdcf915f370e489bb9b7934feca5711b3cc6bece (patch) | |
tree | f67a450b1859c8e8565d1b150e7ca9915241938c | |
parent | d346c5e45c83968c9d85c9ee8f792a6f001fa5c8 (diff) | |
download | chromium_src-bdcf915f370e489bb9b7934feca5711b3cc6bece.zip chromium_src-bdcf915f370e489bb9b7934feca5711b3cc6bece.tar.gz chromium_src-bdcf915f370e489bb9b7934feca5711b3cc6bece.tar.bz2 |
Move content_shell and content_browsertests code into the content namespace.
BUG=90448
TBR=jochen
Review URL: https://chromiumcodereview.appspot.com/10809016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147473 0039d316-1c4b-4281-b951-d872f2087c98
20 files changed, 64 insertions, 58 deletions
diff --git a/content/shell/android/shell_library_loader.cc b/content/shell/android/shell_library_loader.cc index 87aa4a3..33414c6 100644 --- a/content/shell/android/shell_library_loader.cc +++ b/content/shell/android/shell_library_loader.cc @@ -32,7 +32,7 @@ JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { arraysize(kRegistrationMethods))) return -1; - content::SetContentMainDelegate(new ShellMainDelegate()); + content::SetContentMainDelegate(new content::ShellMainDelegate()); return JNI_VERSION_1_4; } diff --git a/content/shell/shell.cc b/content/shell/shell.cc index 84b66ee..ab0fcd60 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -89,7 +89,7 @@ Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) { return NULL; } -Shell* Shell::CreateNewWindow(content::BrowserContext* browser_context, +Shell* Shell::CreateNewWindow(BrowserContext* browser_context, const GURL& url, SiteInstance* site_instance, int routing_id, @@ -109,8 +109,8 @@ Shell* Shell::CreateNewWindow(content::BrowserContext* browser_context, void Shell::LoadURL(const GURL& url) { web_contents_->GetController().LoadURL( url, - content::Referrer(), - content::PAGE_TRANSITION_TYPED, + Referrer(), + PAGE_TRANSITION_TYPED, std::string()); web_contents_->Focus(); } diff --git a/content/shell/shell.h b/content/shell/shell.h index 39dfbec..53e473f 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -55,7 +55,7 @@ class Shell : public WebContentsDelegate, // This is called indirectly by the modules that need access resources. static base::StringPiece PlatformResourceProvider(int key); - static Shell* CreateNewWindow(content::BrowserContext* browser_context, + static Shell* CreateNewWindow(BrowserContext* browser_context, const GURL& url, SiteInstance* site_instance, int routing_id, @@ -122,7 +122,7 @@ class Shell : public WebContentsDelegate, gfx::NativeView GetContentView(); - // content::WebContentsDelegate + // WebContentsDelegate virtual void LoadingStateChanged(WebContents* source) OVERRIDE; #if defined(OS_ANDROID) virtual void LoadProgressChanged(double progress) OVERRIDE; @@ -144,7 +144,7 @@ class Shell : public WebContentsDelegate, int32 line_no, const string16& source_id) OVERRIDE; - // content::NotificationObserver + // NotificationObserver virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 5f93fc1..05a4e37 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -25,8 +25,6 @@ #include "base/base_paths_mac.h" #endif -using content::BrowserThread; - namespace content { ShellBrowserContext::ShellBrowserContext() { diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc index 0d35fca..87bf75b 100644 --- a/content/shell/shell_browser_main_parts.cc +++ b/content/shell/shell_browser_main_parts.cc @@ -36,7 +36,7 @@ static GURL GetStartupURL() { } ShellBrowserMainParts::ShellBrowserMainParts( - const content::MainFunctionParams& parameters) + const MainFunctionParams& parameters) : BrowserMainParts(), parameters_(parameters), run_message_loop_(true), diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index ad99d81..ddeb5be 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -34,7 +34,7 @@ ShellContentBrowserClient::~ShellContentBrowserClient() { } BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( - const content::MainFunctionParams& parameters) { + const MainFunctionParams& parameters) { shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); return shell_browser_main_parts_; } diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index 81ff253..ac42a70 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -22,9 +22,9 @@ class ShellContentBrowserClient : public ContentBrowserClient { ShellContentBrowserClient(); virtual ~ShellContentBrowserClient(); - // content::ContentBrowserClient overrides. + // ContentBrowserClient overrides. virtual BrowserMainParts* CreateBrowserMainParts( - const content::MainFunctionParams& parameters) OVERRIDE; + const MainFunctionParams& parameters) OVERRIDE; virtual void RenderViewHostCreated( RenderViewHost* render_view_host) OVERRIDE; virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, diff --git a/content/shell/shell_content_main.cc b/content/shell/shell_content_main.cc index 1f1d35f..7993198 100644 --- a/content/shell/shell_content_main.cc +++ b/content/shell/shell_content_main.cc @@ -10,7 +10,7 @@ #if defined(OS_MACOSX) int ContentMain(int argc, const char** argv) { - ShellMainDelegate delegate; + content::ShellMainDelegate delegate; return content::ContentMain(argc, argv, &delegate); } #endif // OS_MACOSX diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc index a120158..12a9dbf 100644 --- a/content/shell/shell_content_renderer_client.cc +++ b/content/shell/shell_content_renderer_client.cc @@ -26,7 +26,7 @@ void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) return; - new content::LayoutTestController(render_view); + new LayoutTestController(render_view); } } // namespace content diff --git a/content/shell/shell_devtools_delegate.h b/content/shell/shell_devtools_delegate.h index 8640288..569eb3a 100644 --- a/content/shell/shell_devtools_delegate.h +++ b/content/shell/shell_devtools_delegate.h @@ -19,7 +19,7 @@ namespace content { class DevToolsHttpHandler; -class ShellDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { +class ShellDevToolsDelegate : public DevToolsHttpHandlerDelegate { public: ShellDevToolsDelegate(int port, net::URLRequestContextGetter* context_getter); virtual ~ShellDevToolsDelegate(); diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 2bb5425..297820e 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -43,7 +43,7 @@ bool ShellDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { download->OnTargetPathDetermined( download->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); + DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); return true; } @@ -92,7 +92,7 @@ void ShellDownloadManagerDelegate::RestartDownload( // Since we have no download UI, show the user a dialog always. download->OnTargetPathDetermined(suggested_path, DownloadItem::TARGET_DISPOSITION_PROMPT, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); + DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); download_manager_->RestartDownload(download_id); } diff --git a/content/shell/shell_main.cc b/content/shell/shell_main.cc index 62d6ea9..d03831b 100644 --- a/content/shell/shell_main.cc +++ b/content/shell/shell_main.cc @@ -20,7 +20,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { sandbox::SandboxInterfaceInfo sandbox_info = {0}; content::InitializeSandboxInfo(&sandbox_info); - ShellMainDelegate delegate; + content::ShellMainDelegate delegate; return content::ContentMain(instance, &sandbox_info, &delegate); } @@ -32,7 +32,7 @@ int main(int argc, const char** argv) { // delegate types. return ::ContentMain(argc, argv); #else - ShellMainDelegate delegate; + content::ShellMainDelegate delegate; return content::ContentMain(argc, argv, &delegate); #endif // OS_MACOSX } diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc index 35162e8..5d578d5 100644 --- a/content/shell/shell_main_delegate.cc +++ b/content/shell/shell_main_delegate.cc @@ -44,6 +44,8 @@ void InitLogging() { } // namespace +namespace content { + ShellMainDelegate::ShellMainDelegate() { } @@ -62,7 +64,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { #if defined(OS_MACOSX) OverrideFrameworkBundlePath(); #endif - content::SetContentClient(&content_client_); + SetContentClient(&content_client_); return false; } @@ -75,7 +77,7 @@ void ShellMainDelegate::PreSandboxStartup() { int ShellMainDelegate::RunProcess( const std::string& process_type, - const content::MainFunctionParams& main_function_params) { + const MainFunctionParams& main_function_params) { if (!process_type.empty()) return -1; @@ -83,7 +85,7 @@ int ShellMainDelegate::RunProcess( return ShellBrowserMain(main_function_params); #else // If no process type is specified, we are creating the main browser process. - browser_runner_.reset(content::BrowserMainRunner::Create()); + browser_runner_.reset(BrowserMainRunner::Create()); int exit_code = browser_runner_->Initialize(main_function_params); DCHECK(exit_code < 0) << "BrowserRunner::Initialize failed in ShellMainDelegate"; @@ -126,13 +128,14 @@ void ShellMainDelegate::InitializeResourceBundle() { ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); } -content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { - browser_client_.reset(new content::ShellContentBrowserClient); +ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new ShellContentBrowserClient); return browser_client_.get(); } -content::ContentRendererClient* - ShellMainDelegate::CreateContentRendererClient() { - renderer_client_.reset(new content::ShellContentRendererClient); +ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { + renderer_client_.reset(new ShellContentRendererClient); return renderer_client_.get(); } + +} // namespace content diff --git a/content/shell/shell_main_delegate.h b/content/shell/shell_main_delegate.h index 687770b..d98321a 100644 --- a/content/shell/shell_main_delegate.h +++ b/content/shell/shell_main_delegate.h @@ -17,35 +17,35 @@ class ShellContentRendererClient; #if defined(OS_ANDROID) class BrowserMainRunner; #endif -} // namespace content -class ShellMainDelegate : public content::ContentMainDelegate { +class ShellMainDelegate : public ContentMainDelegate { public: ShellMainDelegate(); virtual ~ShellMainDelegate(); - // content::ContentMainDelegate implementation: + // ContentMainDelegate implementation: virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; virtual int RunProcess( const std::string& process_type, - const content::MainFunctionParams& main_function_params) OVERRIDE; - virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; - virtual content::ContentRendererClient* - CreateContentRendererClient() OVERRIDE; + const MainFunctionParams& main_function_params) OVERRIDE; + virtual ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual ContentRendererClient* CreateContentRendererClient() OVERRIDE; private: void InitializeResourceBundle(); - scoped_ptr<content::ShellContentBrowserClient> browser_client_; - scoped_ptr<content::ShellContentRendererClient> renderer_client_; - content::ShellContentClient content_client_; + scoped_ptr<ShellContentBrowserClient> browser_client_; + scoped_ptr<ShellContentRendererClient> renderer_client_; + ShellContentClient content_client_; #if defined(OS_ANDROID) - scoped_ptr<content::BrowserMainRunner> browser_runner_; + scoped_ptr<BrowserMainRunner> browser_runner_; #endif DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); }; +} // namespace content + #endif // CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ diff --git a/content/shell/shell_resource_context.h b/content/shell/shell_resource_context.h index d7b916a..046b89a 100644 --- a/content/shell/shell_resource_context.h +++ b/content/shell/shell_resource_context.h @@ -13,7 +13,7 @@ namespace content { class ShellURLRequestContextGetter; -class ShellResourceContext : public content::ResourceContext { +class ShellResourceContext : public ResourceContext { public: explicit ShellResourceContext(ShellURLRequestContextGetter* getter); virtual ~ShellResourceContext(); diff --git a/content/shell/shell_resource_dispatcher_host_delegate.cc b/content/shell/shell_resource_dispatcher_host_delegate.cc index 4fc145b..20bab2c 100644 --- a/content/shell/shell_resource_dispatcher_host_delegate.cc +++ b/content/shell/shell_resource_dispatcher_host_delegate.cc @@ -21,7 +21,7 @@ bool ShellResourceDispatcherHostDelegate::AcceptAuthRequest( return true; } -content::ResourceDispatcherHostLoginDelegate* +ResourceDispatcherHostLoginDelegate* ShellResourceDispatcherHostDelegate::CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request) { #if !defined(OS_MACOSX) diff --git a/content/shell/shell_resource_dispatcher_host_delegate.h b/content/shell/shell_resource_dispatcher_host_delegate.h index 74f3f93..7b76ded 100644 --- a/content/shell/shell_resource_dispatcher_host_delegate.h +++ b/content/shell/shell_resource_dispatcher_host_delegate.h @@ -11,7 +11,7 @@ namespace content { class ShellResourceDispatcherHostDelegate - : public content::ResourceDispatcherHostDelegate { + : public ResourceDispatcherHostDelegate { public: ShellResourceDispatcherHostDelegate(); virtual ~ShellResourceDispatcherHostDelegate(); @@ -19,7 +19,7 @@ class ShellResourceDispatcherHostDelegate // ResourceDispatcherHostDelegate implementation. virtual bool AcceptAuthRequest(net::URLRequest* request, net::AuthChallengeInfo* auth_info) OVERRIDE; - virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( + virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE; private: diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index a863d65..d3d6163 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -20,6 +20,8 @@ #include "base/mac/scoped_nsautorelease_pool.h" #endif +namespace content { + ContentBrowserTest::ContentBrowserTest() { #if defined(OS_MACOSX) // See comment in InProcessBrowserTest::InProcessBrowserTest(). @@ -36,7 +38,7 @@ ContentBrowserTest::~ContentBrowserTest() { } void ContentBrowserTest::SetUp() { - shell_main_delegate_.reset(new ShellMainDelegate); + shell_main_delegate_.reset(new content::ShellMainDelegate); shell_main_delegate_->PreSandboxStartup(); CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -74,8 +76,8 @@ static void DumpStackTraceSignalHandler(int signal) { #endif // defined(OS_POSIX) void ContentBrowserTest::RunTestOnMainThreadLoop() { - CHECK_EQ(content::Shell::windows().size(), 1u); - shell_ = content::Shell::windows()[0]; + CHECK_EQ(Shell::windows().size(), 1u); + shell_ = Shell::windows()[0]; #if defined(OS_POSIX) signal(SIGTERM, DumpStackTraceSignalHandler); @@ -104,3 +106,5 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() { pool.Recycle(); #endif } + +} // namespace content diff --git a/content/test/content_browser_test.h b/content/test/content_browser_test.h index 44bf42d..0d09774 100644 --- a/content/test/content_browser_test.h +++ b/content/test/content_browser_test.h @@ -9,11 +9,10 @@ #include "content/public/test/browser_test.h" #include "content/test/browser_test_base.h" -class ShellMainDelegate; namespace content { class Shell; -} +class ShellMainDelegate; class ContentBrowserTest : public BrowserTestBase { protected: @@ -28,12 +27,14 @@ class ContentBrowserTest : public BrowserTestBase { virtual void RunTestOnMainThreadLoop() OVERRIDE; // Returns the window for the test. - content::Shell* shell() const { return shell_; } + Shell* shell() const { return shell_; } private: - scoped_ptr<ShellMainDelegate> shell_main_delegate_; + scoped_ptr<content::ShellMainDelegate> shell_main_delegate_; - content::Shell* shell_; + Shell* shell_; }; +} // namespace content + #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_H_ diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc index 861b29a..d5b9c8f 100644 --- a/content/test/content_test_launcher.cc +++ b/content/test/content_test_launcher.cc @@ -85,8 +85,6 @@ class ContentBrowserTestSuite : public ContentTestSuiteBase { DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); }; -} // namespace content - class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { public: ContentTestLauncherDelegate() { @@ -105,11 +103,11 @@ class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { ShellMainDelegate delegate; #if defined(OS_WIN) sandbox::SandboxInterfaceInfo sandbox_info = {0}; - content::InitializeSandboxInfo(&sandbox_info); + InitializeSandboxInfo(&sandbox_info); *return_code = - content::ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate); + ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate); #elif defined(OS_LINUX) - *return_code = content::ContentMain(argc, + *return_code = ContentMain(argc, const_cast<const char**>(argv), &delegate); #endif // defined(OS_WIN) @@ -121,7 +119,7 @@ class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { } virtual int RunTestSuite(int argc, char** argv) OVERRIDE { - return content::ContentBrowserTestSuite(argc, argv).Run(); + return ContentBrowserTestSuite(argc, argv).Run(); } virtual bool AdjustChildProcessCommandLine( @@ -133,11 +131,13 @@ class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); }; +} // namespace content + int main(int argc, char** argv) { #if defined(USE_AURA) LOG(INFO) << "content_browsertests not supported on aura yet."; return 0; #endif - ContentTestLauncherDelegate launcher_delegate; + content::ContentTestLauncherDelegate launcher_delegate; return test_launcher::LaunchTests(&launcher_delegate, argc, argv); } |