| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/shell/shell_download_manager_delegate.h" | 15 #include "content/shell/shell_download_manager_delegate.h" |
| 16 #include "content/shell/shell_resource_context.h" | 16 #include "content/shell/shell_resource_context.h" |
| 17 #include "content/shell/shell_switches.h" | 17 #include "content/shell/shell_switches.h" |
| 18 #include "content/shell/shell_url_request_context_getter.h" | 18 #include "content/shell/shell_url_request_context_getter.h" |
| 19 | 19 |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include "base/base_paths_win.h" | 21 #include "base/base_paths_win.h" |
| 22 #elif defined(OS_LINUX) | 22 #elif defined(OS_LINUX) |
| 23 #include "base/nix/xdg_util.h" | 23 #include "base/nix/xdg_util.h" |
| 24 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
| 25 #include "base/base_paths_mac.h" | 25 #include "base/base_paths_mac.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 ShellBrowserContext::ShellBrowserContext() { | 30 ShellBrowserContext::ShellBrowserContext(bool off_the_record) |
| 31 : off_the_record_(off_the_record) { |
| 31 InitWhileIOAllowed(); | 32 InitWhileIOAllowed(); |
| 32 } | 33 } |
| 33 | 34 |
| 34 ShellBrowserContext::~ShellBrowserContext() { | 35 ShellBrowserContext::~ShellBrowserContext() { |
| 35 if (resource_context_.get()) { | 36 if (resource_context_.get()) { |
| 36 BrowserThread::DeleteSoon( | 37 BrowserThread::DeleteSoon( |
| 37 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 38 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 | 41 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 | 69 |
| 69 if (!file_util::PathExists(path_)) | 70 if (!file_util::PathExists(path_)) |
| 70 file_util::CreateDirectory(path_); | 71 file_util::CreateDirectory(path_); |
| 71 } | 72 } |
| 72 | 73 |
| 73 FilePath ShellBrowserContext::GetPath() { | 74 FilePath ShellBrowserContext::GetPath() { |
| 74 return path_; | 75 return path_; |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool ShellBrowserContext::IsOffTheRecord() const { | 78 bool ShellBrowserContext::IsOffTheRecord() const { |
| 78 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOffTheRecord); | 79 return off_the_record_; |
| 79 } | 80 } |
| 80 | 81 |
| 81 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { | 82 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
| 82 download_manager_delegate_ = new ShellDownloadManagerDelegate(); | 83 download_manager_delegate_ = new ShellDownloadManagerDelegate(); |
| 83 return download_manager_delegate_.get(); | 84 return download_manager_delegate_.get(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { | 87 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { |
| 87 if (!url_request_getter_) { | 88 if (!url_request_getter_) { |
| 88 url_request_getter_ = new ShellURLRequestContextGetter( | 89 url_request_getter_ = new ShellURLRequestContextGetter( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 125 |
| 125 bool ShellBrowserContext::DidLastSessionExitCleanly() { | 126 bool ShellBrowserContext::DidLastSessionExitCleanly() { |
| 126 return true; | 127 return true; |
| 127 } | 128 } |
| 128 | 129 |
| 129 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 130 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 130 return NULL; | 131 return NULL; |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace content | 134 } // namespace content |
| OLD | NEW |