OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell_browser_context.h" | 5 #include "content/shell/shell_browser_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" |
8 #include "base/environment.h" | 9 #include "base/environment.h" |
9 #include "base/file_util.h" | 10 #include "base/file_util.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
12 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/shell/shell_download_manager_delegate.h" | 15 #include "content/shell/shell_download_manager_delegate.h" |
15 #include "content/shell/shell_resource_context.h" | 16 #include "content/shell/shell_resource_context.h" |
| 17 #include "content/shell/shell_switches.h" |
16 #include "content/shell/shell_url_request_context_getter.h" | 18 #include "content/shell/shell_url_request_context_getter.h" |
17 | 19 |
18 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
19 #include "base/base_paths_win.h" | 21 #include "base/base_paths_win.h" |
20 #elif defined(OS_LINUX) | 22 #elif defined(OS_LINUX) |
21 #include "base/nix/xdg_util.h" | 23 #include "base/nix/xdg_util.h" |
22 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
23 #include "base/base_paths_mac.h" | 25 #include "base/base_paths_mac.h" |
24 #endif | 26 #endif |
25 | 27 |
(...skipping 15 matching lines...) Expand all Loading... |
41 } | 43 } |
42 | 44 |
43 ShellBrowserContext::~ShellBrowserContext() { | 45 ShellBrowserContext::~ShellBrowserContext() { |
44 if (resource_context_.get()) { | 46 if (resource_context_.get()) { |
45 BrowserThread::DeleteSoon( | 47 BrowserThread::DeleteSoon( |
46 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 48 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
47 } | 49 } |
48 } | 50 } |
49 | 51 |
50 void ShellBrowserContext::InitWhileIOAllowed() { | 52 void ShellBrowserContext::InitWhileIOAllowed() { |
| 53 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 54 CHECK(testing_path_.CreateUniqueTempDir()); |
| 55 path_ = testing_path_.path(); |
| 56 return; |
| 57 } |
51 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
52 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); | 59 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
53 path_ = path_.Append(std::wstring(L"content_shell")); | 60 path_ = path_.Append(std::wstring(L"content_shell")); |
54 #elif defined(OS_LINUX) | 61 #elif defined(OS_LINUX) |
55 scoped_ptr<base::Environment> env(base::Environment::Create()); | 62 scoped_ptr<base::Environment> env(base::Environment::Create()); |
56 FilePath config_dir(base::nix::GetXDGDirectory(env.get(), | 63 FilePath config_dir(base::nix::GetXDGDirectory(env.get(), |
57 kXdgConfigHomeEnvVar, | 64 kXdgConfigHomeEnvVar, |
58 kDotConfigDir)); | 65 kDotConfigDir)); |
59 path_ = config_dir.Append("content_shell"); | 66 path_ = config_dir.Append("content_shell"); |
60 #elif defined(OS_MACOSX) | 67 #elif defined(OS_MACOSX) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 132 |
126 bool ShellBrowserContext::DidLastSessionExitCleanly() { | 133 bool ShellBrowserContext::DidLastSessionExitCleanly() { |
127 return true; | 134 return true; |
128 } | 135 } |
129 | 136 |
130 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 137 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
131 return NULL; | 138 return NULL; |
132 } | 139 } |
133 | 140 |
134 } // namespace content | 141 } // namespace content |
OLD | NEW |