// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/shell/shell_content_browser_client.h" #include "base/command_line.h" #include "base/file_path.h" #include "content/public/browser/resource_dispatcher_host.h" #include "content/shell/layout_test_controller_host.h" #include "content/shell/shell.h" #include "content/shell/shell_browser_main_parts.h" #include "content/shell/shell_devtools_delegate.h" #include "content/shell/shell_resource_dispatcher_host_delegate.h" #include "content/shell/shell_switches.h" #include "googleurl/src/gurl.h" namespace content { ShellContentBrowserClient::ShellContentBrowserClient() : shell_browser_main_parts_(NULL) { } ShellContentBrowserClient::~ShellContentBrowserClient() { } BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( const content::MainFunctionParams& parameters) { shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); return shell_browser_main_parts_; } void ShellContentBrowserClient::RenderViewHostCreated( RenderViewHost* render_view_host) { if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) return; new LayoutTestControllerHost(render_view_host); } void ShellContentBrowserClient::AppendExtraCommandLineSwitches( CommandLine* command_line, int child_process_id) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) command_line->AppendSwitch(switches::kDumpRenderTree); } void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.reset( new ShellResourceDispatcherHostDelegate()); ResourceDispatcherHost::Get()->SetDelegate( resource_dispatcher_host_delegate_.get()); } std::string ShellContentBrowserClient::GetDefaultDownloadName() { return "download"; } ShellBrowserContext* ShellContentBrowserClient::browser_context() { return shell_browser_main_parts_->browser_context(); } } // namespace content