| 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/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 ShellBrowserContext::~ShellBrowserContext() { | 35 ShellBrowserContext::~ShellBrowserContext() { |
| 36 if (resource_context_.get()) { | 36 if (resource_context_.get()) { |
| 37 BrowserThread::DeleteSoon( | 37 BrowserThread::DeleteSoon( |
| 38 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 38 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 void ShellBrowserContext::InitWhileIOAllowed() { | 42 void ShellBrowserContext::InitWhileIOAllowed() { |
| 43 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 43 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 44 if (cmd_line->HasSwitch(switches::kContentBrowserTest) || | 44 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { |
| 45 cmd_line->HasSwitch(switches::kDumpRenderTree)) { | |
| 46 CHECK(testing_path_.CreateUniqueTempDir()); | 45 CHECK(testing_path_.CreateUniqueTempDir()); |
| 47 path_ = testing_path_.path(); | 46 path_ = testing_path_.path(); |
| 48 return; | 47 return; |
| 49 } | 48 } |
| 49 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 50 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 51 return; |
| 52 } |
| 50 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 51 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); | 54 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
| 52 path_ = path_.Append(std::wstring(L"content_shell")); | 55 path_ = path_.Append(std::wstring(L"content_shell")); |
| 53 #elif defined(OS_LINUX) | 56 #elif defined(OS_LINUX) |
| 54 scoped_ptr<base::Environment> env(base::Environment::Create()); | 57 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 55 FilePath config_dir( | 58 FilePath config_dir( |
| 56 base::nix::GetXDGDirectory(env.get(), | 59 base::nix::GetXDGDirectory(env.get(), |
| 57 base::nix::kXdgConfigHomeEnvVar, | 60 base::nix::kXdgConfigHomeEnvVar, |
| 58 base::nix::kDotConfigDir)); | 61 base::nix::kDotConfigDir)); |
| 59 path_ = config_dir.Append("content_shell"); | 62 path_ = config_dir.Append("content_shell"); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 128 |
| 126 bool ShellBrowserContext::DidLastSessionExitCleanly() { | 129 bool ShellBrowserContext::DidLastSessionExitCleanly() { |
| 127 return true; | 130 return true; |
| 128 } | 131 } |
| 129 | 132 |
| 130 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 133 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 131 return NULL; | 134 return NULL; |
| 132 } | 135 } |
| 133 | 136 |
| 134 } // namespace content | 137 } // namespace content |
| OLD | NEW |