| 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 10 matching lines...) Expand all Loading... |
| 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(bool off_the_record) | 30 ShellBrowserContext::ShellBrowserContext(bool off_the_record) |
| 31 : off_the_record_(off_the_record) { | 31 : off_the_record_(off_the_record), |
| 32 ignore_certificate_errors_(false) { |
| 32 InitWhileIOAllowed(); | 33 InitWhileIOAllowed(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 ShellBrowserContext::~ShellBrowserContext() { | 36 ShellBrowserContext::~ShellBrowserContext() { |
| 36 if (resource_context_.get()) { | 37 if (resource_context_.get()) { |
| 37 BrowserThread::DeleteSoon( | 38 BrowserThread::DeleteSoon( |
| 38 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 39 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 39 } | 40 } |
| 40 } | 41 } |
| 41 | 42 |
| 42 void ShellBrowserContext::InitWhileIOAllowed() { | 43 void ShellBrowserContext::InitWhileIOAllowed() { |
| 43 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 44 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 45 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) |
| 46 ignore_certificate_errors_ = true; |
| 44 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { | 47 if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { |
| 45 CHECK(testing_path_.CreateUniqueTempDir()); | 48 CHECK(testing_path_.CreateUniqueTempDir()); |
| 46 path_ = testing_path_.path(); | 49 path_ = testing_path_.path(); |
| 47 return; | 50 return; |
| 48 } | 51 } |
| 49 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { | 52 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 50 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); | 53 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 51 return; | 54 return; |
| 52 } | 55 } |
| 53 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 download_manager_delegate_ = new ShellDownloadManagerDelegate(); | 92 download_manager_delegate_ = new ShellDownloadManagerDelegate(); |
| 90 download_manager_delegate_->SetDownloadManager(manager); | 93 download_manager_delegate_->SetDownloadManager(manager); |
| 91 } | 94 } |
| 92 | 95 |
| 93 return download_manager_delegate_.get(); | 96 return download_manager_delegate_.get(); |
| 94 } | 97 } |
| 95 | 98 |
| 96 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { | 99 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { |
| 97 if (!url_request_getter_) { | 100 if (!url_request_getter_) { |
| 98 url_request_getter_ = new ShellURLRequestContextGetter( | 101 url_request_getter_ = new ShellURLRequestContextGetter( |
| 102 ignore_certificate_errors_, |
| 99 GetPath(), | 103 GetPath(), |
| 100 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), | 104 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), |
| 101 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); | 105 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); |
| 102 } | 106 } |
| 103 return url_request_getter_; | 107 return url_request_getter_; |
| 104 } | 108 } |
| 105 | 109 |
| 106 net::URLRequestContextGetter* | 110 net::URLRequestContextGetter* |
| 107 ShellBrowserContext::GetRequestContextForRenderProcess( | 111 ShellBrowserContext::GetRequestContextForRenderProcess( |
| 108 int renderer_child_id) { | 112 int renderer_child_id) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 144 |
| 141 bool ShellBrowserContext::DidLastSessionExitCleanly() { | 145 bool ShellBrowserContext::DidLastSessionExitCleanly() { |
| 142 return true; | 146 return true; |
| 143 } | 147 } |
| 144 | 148 |
| 145 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 149 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 146 return NULL; | 150 return NULL; |
| 147 } | 151 } |
| 148 | 152 |
| 149 } // namespace content | 153 } // namespace content |
| OLD | NEW |