| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/browser/shell_browser_main_parts.h" | 5 #include "content/shell/browser/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "content/public/common/main_function_params.h" | 17 #include "content/public/common/main_function_params.h" |
| 18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 19 #include "content/shell/browser/layout_test/layout_test_browser_context.h" | |
| 20 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
| 21 #include "content/shell/browser/shell_browser_context.h" | 20 #include "content/shell/browser/shell_browser_context.h" |
| 22 #include "content/shell/browser/shell_devtools_delegate.h" | 21 #include "content/shell/browser/shell_devtools_delegate.h" |
| 23 #include "content/shell/browser/shell_net_log.h" | 22 #include "content/shell/browser/shell_net_log.h" |
| 24 #include "content/shell/common/shell_switches.h" | 23 #include "content/shell/common/shell_switches.h" |
| 25 #include "net/base/filename_util.h" | 24 #include "net/base/filename_util.h" |
| 26 #include "net/base/net_module.h" | 25 #include "net/base/net_module.h" |
| 27 #include "net/grit/net_resources.h" | 26 #include "net/grit/net_resources.h" |
| 28 #include "storage/browser/quota/quota_manager.h" | 27 #include "storage/browser/quota/quota_manager.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 #if defined(OS_ANDROID) | 121 #if defined(OS_ANDROID) |
| 123 if (CommandLine::ForCurrentProcess()->HasSwitch( | 122 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 124 switches::kEnableCrashReporter)) { | 123 switches::kEnableCrashReporter)) { |
| 125 base::FilePath crash_dumps_dir = | 124 base::FilePath crash_dumps_dir = |
| 126 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 125 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 127 switches::kCrashDumpsDir); | 126 switches::kCrashDumpsDir); |
| 128 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); | 127 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); |
| 129 } | 128 } |
| 130 #endif | 129 #endif |
| 131 net_log_.reset(new ShellNetLog("content_shell")); | 130 net_log_.reset(new ShellNetLog("content_shell")); |
| 132 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 131 browser_context_.reset(new ShellBrowserContext(false, net_log_.get())); |
| 133 browser_context_.reset(new LayoutTestBrowserContext(false, net_log_.get())); | 132 off_the_record_browser_context_.reset( |
| 134 off_the_record_browser_context_.reset( | 133 new ShellBrowserContext(true, net_log_.get())); |
| 135 new LayoutTestBrowserContext(true, net_log_.get())); | |
| 136 } else { | |
| 137 browser_context_.reset(new ShellBrowserContext(false, net_log_.get())); | |
| 138 off_the_record_browser_context_.reset( | |
| 139 new ShellBrowserContext(true, net_log_.get())); | |
| 140 } | |
| 141 | 134 |
| 142 Shell::Initialize(); | 135 Shell::Initialize(); |
| 143 net::NetModule::SetResourceProvider(PlatformResourceProvider); | 136 net::NetModule::SetResourceProvider(PlatformResourceProvider); |
| 144 | 137 |
| 145 devtools_delegate_.reset(new ShellDevToolsDelegate(browser_context_.get())); | 138 devtools_delegate_.reset(new ShellDevToolsDelegate(browser_context_.get())); |
| 146 | 139 |
| 147 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 140 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 148 Shell::CreateNewWindow(browser_context_.get(), | 141 Shell::CreateNewWindow(browser_context_.get(), |
| 149 GetStartupURL(), | 142 GetStartupURL(), |
| 150 NULL, | 143 NULL, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 176 } |
| 184 | 177 |
| 185 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 178 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
| 186 if (devtools_delegate_) | 179 if (devtools_delegate_) |
| 187 devtools_delegate_->Stop(); | 180 devtools_delegate_->Stop(); |
| 188 browser_context_.reset(); | 181 browser_context_.reset(); |
| 189 off_the_record_browser_context_.reset(); | 182 off_the_record_browser_context_.reset(); |
| 190 } | 183 } |
| 191 | 184 |
| 192 } // namespace | 185 } // namespace |
| OLD | NEW |