| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 void InitializeAndPassKeygenHandler( | 344 void InitializeAndPassKeygenHandler( |
| 345 scoped_ptr<net::KeygenHandler> keygen_handler, | 345 scoped_ptr<net::KeygenHandler> keygen_handler, |
| 346 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, | 346 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback, |
| 347 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { | 347 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate) { |
| 348 if (delegate) | 348 if (delegate) |
| 349 keygen_handler->set_crypto_module_delegate(delegate.Pass()); | 349 keygen_handler->set_crypto_module_delegate(delegate.Pass()); |
| 350 callback.Run(keygen_handler.Pass()); | 350 callback.Run(keygen_handler.Pass()); |
| 351 } | 351 } |
| 352 #endif // defined(USE_NSS_CERTS) | 352 #endif // defined(USE_NSS_CERTS) |
| 353 | 353 |
| 354 void InvalidateContextGettersOnIO( | 354 // For safe shutdown, must be called before the ProfileIOData is destroyed. |
| 355 void NotifyContextGettersOfShutdownOnIO( |
| 355 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { | 356 scoped_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> getters) { |
| 356 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 357 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 357 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; | 358 ProfileIOData::ChromeURLRequestContextGetterVector::iterator iter; |
| 358 for (iter = getters->begin(); iter != getters->end(); ++iter) | 359 for (auto& chrome_context_getter : *getters) |
| 359 (*iter)->Invalidate(); | 360 chrome_context_getter->NotifyContextShuttingDown(); |
| 360 } | 361 } |
| 361 | 362 |
| 362 } // namespace | 363 } // namespace |
| 363 | 364 |
| 364 void ProfileIOData::InitializeOnUIThread(Profile* profile) { | 365 void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
| 365 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 366 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 366 PrefService* pref_service = profile->GetPrefs(); | 367 PrefService* pref_service = profile->GetPrefs(); |
| 367 PrefService* local_state_pref_service = g_browser_process->local_state(); | 368 PrefService* local_state_pref_service = g_browser_process->local_state(); |
| 368 | 369 |
| 369 scoped_ptr<ProfileParams> params(new ProfileParams); | 370 scoped_ptr<ProfileParams> params(new ProfileParams); |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 url_blacklist_manager_->ShutdownOnUIThread(); | 1222 url_blacklist_manager_->ShutdownOnUIThread(); |
| 1222 #endif | 1223 #endif |
| 1223 if (chrome_http_user_agent_settings_) | 1224 if (chrome_http_user_agent_settings_) |
| 1224 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 1225 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
| 1225 incognito_availibility_pref_.Destroy(); | 1226 incognito_availibility_pref_.Destroy(); |
| 1226 | 1227 |
| 1227 if (!context_getters->empty()) { | 1228 if (!context_getters->empty()) { |
| 1228 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 1229 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
| 1229 BrowserThread::PostTask( | 1230 BrowserThread::PostTask( |
| 1230 BrowserThread::IO, FROM_HERE, | 1231 BrowserThread::IO, FROM_HERE, |
| 1231 base::Bind(&InvalidateContextGettersOnIO, | 1232 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
| 1232 base::Passed(&context_getters))); | 1233 base::Passed(&context_getters))); |
| 1233 } | 1234 } |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1236 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 1237 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
| 1237 if (!posted) | 1238 if (!posted) |
| 1238 delete this; | 1239 delete this; |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 void ProfileIOData::set_channel_id_service( | 1242 void ProfileIOData::set_channel_id_service( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 new DevToolsNetworkTransactionFactory( | 1288 new DevToolsNetworkTransactionFactory( |
| 1288 network_controller_.get(), shared_session), | 1289 network_controller_.get(), shared_session), |
| 1289 shared_session->net_log(), backend)); | 1290 shared_session->net_log(), backend)); |
| 1290 } | 1291 } |
| 1291 | 1292 |
| 1292 void ProfileIOData::SetCookieSettingsForTesting( | 1293 void ProfileIOData::SetCookieSettingsForTesting( |
| 1293 CookieSettings* cookie_settings) { | 1294 CookieSettings* cookie_settings) { |
| 1294 DCHECK(!cookie_settings_.get()); | 1295 DCHECK(!cookie_settings_.get()); |
| 1295 cookie_settings_ = cookie_settings; | 1296 cookie_settings_ = cookie_settings; |
| 1296 } | 1297 } |
| OLD | NEW |