| 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_context.h" | 5 #include "content/shell/browser/shell_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 67 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ShellBrowserContext::InitWhileIOAllowed() { | 71 void ShellBrowserContext::InitWhileIOAllowed() { |
| 72 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 72 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 73 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) | 73 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) |
| 74 ignore_certificate_errors_ = true; | 74 ignore_certificate_errors_ = true; |
| 75 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { | 75 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 76 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); | 76 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 77 BrowserContext::Initialize(this, path_); |
| 77 return; | 78 return; |
| 78 } | 79 } |
| 79 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| 80 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); | 81 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
| 81 path_ = path_.Append(std::wstring(L"content_shell")); | 82 path_ = path_.Append(std::wstring(L"content_shell")); |
| 82 #elif defined(OS_LINUX) | 83 #elif defined(OS_LINUX) |
| 83 scoped_ptr<base::Environment> env(base::Environment::Create()); | 84 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 84 base::FilePath config_dir( | 85 base::FilePath config_dir( |
| 85 base::nix::GetXDGDirectory(env.get(), | 86 base::nix::GetXDGDirectory(env.get(), |
| 86 base::nix::kXdgConfigHomeEnvVar, | 87 base::nix::kXdgConfigHomeEnvVar, |
| 87 base::nix::kDotConfigDir)); | 88 base::nix::kDotConfigDir)); |
| 88 path_ = config_dir.Append("content_shell"); | 89 path_ = config_dir.Append("content_shell"); |
| 89 #elif defined(OS_MACOSX) | 90 #elif defined(OS_MACOSX) |
| 90 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); | 91 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); |
| 91 path_ = path_.Append("Chromium Content Shell"); | 92 path_ = path_.Append("Chromium Content Shell"); |
| 92 #elif defined(OS_ANDROID) | 93 #elif defined(OS_ANDROID) |
| 93 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); | 94 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); |
| 94 path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); | 95 path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); |
| 95 #else | 96 #else |
| 96 NOTIMPLEMENTED(); | 97 NOTIMPLEMENTED(); |
| 97 #endif | 98 #endif |
| 98 | 99 |
| 99 if (!base::PathExists(path_)) | 100 if (!base::PathExists(path_)) |
| 100 base::CreateDirectory(path_); | 101 base::CreateDirectory(path_); |
| 102 BrowserContext::Initialize(this, path_); |
| 101 } | 103 } |
| 102 | 104 |
| 103 scoped_ptr<ZoomLevelDelegate> ShellBrowserContext::CreateZoomLevelDelegate( | 105 scoped_ptr<ZoomLevelDelegate> ShellBrowserContext::CreateZoomLevelDelegate( |
| 104 const base::FilePath&) { | 106 const base::FilePath&) { |
| 105 return scoped_ptr<ZoomLevelDelegate>(); | 107 return scoped_ptr<ZoomLevelDelegate>(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 base::FilePath ShellBrowserContext::GetPath() const { | 110 base::FilePath ShellBrowserContext::GetPath() const { |
| 109 return path_; | 111 return path_; |
| 110 } | 112 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return permission_manager_.get(); | 209 return permission_manager_.get(); |
| 208 } | 210 } |
| 209 | 211 |
| 210 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { | 212 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
| 211 if (!background_sync_controller_) | 213 if (!background_sync_controller_) |
| 212 background_sync_controller_.reset(new MockBackgroundSyncController()); | 214 background_sync_controller_.reset(new MockBackgroundSyncController()); |
| 213 return background_sync_controller_.get(); | 215 return background_sync_controller_.get(); |
| 214 } | 216 } |
| 215 | 217 |
| 216 } // namespace content | 218 } // namespace content |
| OLD | NEW |