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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after 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_) { | 116 if (!download_manager_delegate_.get()) { |
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(); |
127 } | 127 } |
128 | 128 |
129 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { | 129 net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { |
130 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 130 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
131 } | 131 } |
132 | 132 |
133 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( | 133 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
134 ProtocolHandlerMap* protocol_handlers) { | 134 ProtocolHandlerMap* protocol_handlers) { |
135 DCHECK(!url_request_getter_); | 135 DCHECK(!url_request_getter_.get()); |
136 url_request_getter_ = new ShellURLRequestContextGetter( | 136 url_request_getter_ = new ShellURLRequestContextGetter( |
137 ignore_certificate_errors_, | 137 ignore_certificate_errors_, |
138 GetPath(), | 138 GetPath(), |
139 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), | 139 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), |
140 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), | 140 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), |
141 protocol_handlers); | 141 protocol_handlers); |
142 resource_context_->set_url_request_context_getter(url_request_getter_.get()); | 142 resource_context_->set_url_request_context_getter(url_request_getter_.get()); |
143 return url_request_getter_.get(); | 143 return url_request_getter_.get(); |
144 } | 144 } |
145 | 145 |
(...skipping 41 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 |