| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { | 50 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 51 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); | 51 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 55 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); | 55 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
| 56 path_ = path_.Append(std::wstring(L"content_shell")); | 56 path_ = path_.Append(std::wstring(L"content_shell")); |
| 57 #elif defined(OS_LINUX) | 57 #elif defined(OS_LINUX) |
| 58 scoped_ptr<base::Environment> env(base::Environment::Create()); | 58 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 59 FilePath config_dir( | 59 base::FilePath config_dir( |
| 60 base::nix::GetXDGDirectory(env.get(), | 60 base::nix::GetXDGDirectory(env.get(), |
| 61 base::nix::kXdgConfigHomeEnvVar, | 61 base::nix::kXdgConfigHomeEnvVar, |
| 62 base::nix::kDotConfigDir)); | 62 base::nix::kDotConfigDir)); |
| 63 path_ = config_dir.Append("content_shell"); | 63 path_ = config_dir.Append("content_shell"); |
| 64 #elif defined(OS_MACOSX) | 64 #elif defined(OS_MACOSX) |
| 65 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); | 65 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); |
| 66 path_ = path_.Append("Chromium Content Shell"); | 66 path_ = path_.Append("Chromium Content Shell"); |
| 67 #elif defined(OS_ANDROID) | 67 #elif defined(OS_ANDROID) |
| 68 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); | 68 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); |
| 69 path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); | 69 path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); |
| 70 #else | 70 #else |
| 71 NOTIMPLEMENTED(); | 71 NOTIMPLEMENTED(); |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 if (!file_util::PathExists(path_)) | 74 if (!file_util::PathExists(path_)) |
| 75 file_util::CreateDirectory(path_); | 75 file_util::CreateDirectory(path_); |
| 76 } | 76 } |
| 77 | 77 |
| 78 FilePath ShellBrowserContext::GetPath() { | 78 base::FilePath ShellBrowserContext::GetPath() { |
| 79 return path_; | 79 return path_; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool ShellBrowserContext::IsOffTheRecord() const { | 82 bool ShellBrowserContext::IsOffTheRecord() const { |
| 83 return off_the_record_; | 83 return off_the_record_; |
| 84 } | 84 } |
| 85 | 85 |
| 86 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { | 86 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
| 87 DownloadManager* manager = BrowserContext::GetDownloadManager(this); | 87 DownloadManager* manager = BrowserContext::GetDownloadManager(this); |
| 88 | 88 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 net::URLRequestContextGetter* | 124 net::URLRequestContextGetter* |
| 125 ShellBrowserContext::GetMediaRequestContextForRenderProcess( | 125 ShellBrowserContext::GetMediaRequestContextForRenderProcess( |
| 126 int renderer_child_id) { | 126 int renderer_child_id) { |
| 127 return GetRequestContext(); | 127 return GetRequestContext(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 net::URLRequestContextGetter* | 130 net::URLRequestContextGetter* |
| 131 ShellBrowserContext::GetMediaRequestContextForStoragePartition( | 131 ShellBrowserContext::GetMediaRequestContextForStoragePartition( |
| 132 const FilePath& partition_path, | 132 const base::FilePath& partition_path, |
| 133 bool in_memory) { | 133 bool in_memory) { |
| 134 return GetRequestContext(); | 134 return GetRequestContext(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 net::URLRequestContextGetter* | 137 net::URLRequestContextGetter* |
| 138 ShellBrowserContext::GetRequestContextForStoragePartition( | 138 ShellBrowserContext::GetRequestContextForStoragePartition( |
| 139 const FilePath& partition_path, | 139 const base::FilePath& partition_path, |
| 140 bool in_memory) { | 140 bool in_memory) { |
| 141 return NULL; | 141 return NULL; |
| 142 } | 142 } |
| 143 | 143 |
| 144 ResourceContext* ShellBrowserContext::GetResourceContext() { | 144 ResourceContext* ShellBrowserContext::GetResourceContext() { |
| 145 if (!resource_context_.get()) { | 145 if (!resource_context_.get()) { |
| 146 resource_context_.reset(new ShellResourceContext( | 146 resource_context_.reset(new ShellResourceContext( |
| 147 static_cast<ShellURLRequestContextGetter*>(GetRequestContext()))); | 147 static_cast<ShellURLRequestContextGetter*>(GetRequestContext()))); |
| 148 } | 148 } |
| 149 return resource_context_.get(); | 149 return resource_context_.get(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 GeolocationPermissionContext* | 152 GeolocationPermissionContext* |
| 153 ShellBrowserContext::GetGeolocationPermissionContext() { | 153 ShellBrowserContext::GetGeolocationPermissionContext() { |
| 154 return NULL; | 154 return NULL; |
| 155 } | 155 } |
| 156 | 156 |
| 157 SpeechRecognitionPreferences* | 157 SpeechRecognitionPreferences* |
| 158 ShellBrowserContext::GetSpeechRecognitionPreferences() { | 158 ShellBrowserContext::GetSpeechRecognitionPreferences() { |
| 159 return NULL; | 159 return NULL; |
| 160 } | 160 } |
| 161 | 161 |
| 162 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 162 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 163 return NULL; | 163 return NULL; |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace content | 166 } // namespace content |
| OLD | NEW |