| 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 "chrome/browser/profiles/profile_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { | 933 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { |
| 934 DCHECK(!callback.is_null()); | 934 DCHECK(!callback.is_null()); |
| 935 #if defined(USE_NSS) | 935 #if defined(USE_NSS) |
| 936 scoped_ptr<net::KeygenHandler> keygen_handler( | 936 scoped_ptr<net::KeygenHandler> keygen_handler( |
| 937 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); | 937 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); |
| 938 | 938 |
| 939 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate( | 939 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate( |
| 940 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen, | 940 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen, |
| 941 net::HostPortPair::FromURL(url))); | 941 net::HostPortPair::FromURL(url))); |
| 942 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get(); | 942 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get(); |
| 943 keygen_handler->set_crypto_module_delegate( | 943 keygen_handler->set_crypto_module_delegate(delegate.Pass()); |
| 944 delegate.PassAs<crypto::NSSCryptoModuleDelegate>()); | |
| 945 | 944 |
| 946 base::Closure bound_callback = | 945 base::Closure bound_callback = |
| 947 base::Bind(callback, base::Passed(&keygen_handler)); | 946 base::Bind(callback, base::Passed(&keygen_handler)); |
| 948 if (delegate_ptr->InitializeSlot(this, bound_callback)) { | 947 if (delegate_ptr->InitializeSlot(this, bound_callback)) { |
| 949 // Initialization complete, run the callback synchronously. | 948 // Initialization complete, run the callback synchronously. |
| 950 bound_callback.Run(); | 949 bound_callback.Run(); |
| 951 return; | 950 return; |
| 952 } | 951 } |
| 953 // Otherwise, the InitializeSlot will run the callback asynchronously. | 952 // Otherwise, the InitializeSlot will run the callback asynchronously. |
| 954 #else | 953 #else |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 job_factory->SetProtocolHandler( | 1152 job_factory->SetProtocolHandler( |
| 1154 url::kFtpScheme, | 1153 url::kFtpScheme, |
| 1155 new net::FtpProtocolHandler(ftp_transaction_factory)); | 1154 new net::FtpProtocolHandler(ftp_transaction_factory)); |
| 1156 #endif // !defined(DISABLE_FTP_SUPPORT) | 1155 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 1157 | 1156 |
| 1158 #if defined(DEBUG_DEVTOOLS) | 1157 #if defined(DEBUG_DEVTOOLS) |
| 1159 request_interceptors.push_back(new DebugDevToolsInterceptor); | 1158 request_interceptors.push_back(new DebugDevToolsInterceptor); |
| 1160 #endif | 1159 #endif |
| 1161 | 1160 |
| 1162 // Set up interceptors in the reverse order. | 1161 // Set up interceptors in the reverse order. |
| 1163 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 1162 scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass(); |
| 1164 job_factory.PassAs<net::URLRequestJobFactory>(); | |
| 1165 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = | 1163 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = |
| 1166 request_interceptors.rbegin(); | 1164 request_interceptors.rbegin(); |
| 1167 i != request_interceptors.rend(); | 1165 i != request_interceptors.rend(); |
| 1168 ++i) { | 1166 ++i) { |
| 1169 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 1167 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| 1170 top_job_factory.Pass(), make_scoped_ptr(*i))); | 1168 top_job_factory.Pass(), make_scoped_ptr(*i))); |
| 1171 } | 1169 } |
| 1172 request_interceptors.weak_clear(); | 1170 request_interceptors.weak_clear(); |
| 1173 | 1171 |
| 1174 if (protocol_handler_interceptor) { | 1172 if (protocol_handler_interceptor) { |
| 1175 protocol_handler_interceptor->Chain(top_job_factory.Pass()); | 1173 protocol_handler_interceptor->Chain(top_job_factory.Pass()); |
| 1176 return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>(); | 1174 return protocol_handler_interceptor.Pass(); |
| 1177 } else { | 1175 } else { |
| 1178 return top_job_factory.Pass(); | 1176 return top_job_factory.Pass(); |
| 1179 } | 1177 } |
| 1180 } | 1178 } |
| 1181 | 1179 |
| 1182 void ProfileIOData::ShutdownOnUIThread( | 1180 void ProfileIOData::ShutdownOnUIThread( |
| 1183 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters) { | 1181 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters) { |
| 1184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1185 | 1183 |
| 1186 if (signin_names_) | 1184 if (signin_names_) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 void ProfileIOData::SetCookieSettingsForTesting( | 1278 void ProfileIOData::SetCookieSettingsForTesting( |
| 1281 CookieSettings* cookie_settings) { | 1279 CookieSettings* cookie_settings) { |
| 1282 DCHECK(!cookie_settings_.get()); | 1280 DCHECK(!cookie_settings_.get()); |
| 1283 cookie_settings_ = cookie_settings; | 1281 cookie_settings_ = cookie_settings; |
| 1284 } | 1282 } |
| 1285 | 1283 |
| 1286 void ProfileIOData::set_signin_names_for_testing( | 1284 void ProfileIOData::set_signin_names_for_testing( |
| 1287 SigninNamesOnIOThread* signin_names) { | 1285 SigninNamesOnIOThread* signin_names) { |
| 1288 signin_names_.reset(signin_names); | 1286 signin_names_.reset(signin_names); |
| 1289 } | 1287 } |
| OLD | NEW |