| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 ShellBrowserContext::ShellBrowserContext(bool off_the_record) | 57 ShellBrowserContext::ShellBrowserContext(bool off_the_record) |
| 58 : off_the_record_(off_the_record), | 58 : off_the_record_(off_the_record), |
| 59 ignore_certificate_errors_(false), | 59 ignore_certificate_errors_(false), |
| 60 resource_context_(new ShellResourceContext) { | 60 resource_context_(new ShellResourceContext) { |
| 61 InitWhileIOAllowed(); | 61 InitWhileIOAllowed(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ShellBrowserContext::~ShellBrowserContext() { | 64 ShellBrowserContext::~ShellBrowserContext() { |
| 65 if (resource_context_.get()) { | 65 if (resource_context_) { |
| 66 BrowserThread::DeleteSoon( | 66 BrowserThread::DeleteSoon( |
| 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 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 72 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 73 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors) || | 73 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors) || |
| 74 cmd_line->HasSwitch(switches::kDumpRenderTree)) { | 74 cmd_line->HasSwitch(switches::kDumpRenderTree)) { |
| 75 ignore_certificate_errors_ = true; | 75 ignore_certificate_errors_ = true; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 106 return path_; | 106 return path_; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool ShellBrowserContext::IsOffTheRecord() const { | 109 bool ShellBrowserContext::IsOffTheRecord() const { |
| 110 return off_the_record_; | 110 return off_the_record_; |
| 111 } | 111 } |
| 112 | 112 |
| 113 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { | 113 DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
| 114 DownloadManager* manager = BrowserContext::GetDownloadManager(this); | 114 DownloadManager* manager = BrowserContext::GetDownloadManager(this); |
| 115 | 115 |
| 116 if (!download_manager_delegate_.get()) { | 116 if (!download_manager_delegate_) { |
| 117 download_manager_delegate_ = new ShellDownloadManagerDelegate(); | 117 download_manager_delegate_ = new ShellDownloadManagerDelegate(); |
| 118 download_manager_delegate_->SetDownloadManager(manager); | 118 download_manager_delegate_->SetDownloadManager(manager); |
| 119 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 119 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 120 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { | 120 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { |
| 121 download_manager_delegate_->SetDownloadBehaviorForTesting( | 121 download_manager_delegate_->SetDownloadBehaviorForTesting( |
| 122 path_.Append(FILE_PATH_LITERAL("downloads"))); | 122 path_.Append(FILE_PATH_LITERAL("downloads"))); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 return download_manager_delegate_.get(); | 126 return download_manager_delegate_.get(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 SpeechRecognitionPreferences* | 187 SpeechRecognitionPreferences* |
| 188 ShellBrowserContext::GetSpeechRecognitionPreferences() { | 188 ShellBrowserContext::GetSpeechRecognitionPreferences() { |
| 189 return NULL; | 189 return NULL; |
| 190 } | 190 } |
| 191 | 191 |
| 192 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 192 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 193 return NULL; | 193 return NULL; |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace content | 196 } // namespace content |
| OLD | NEW |