| 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/off_the_record_profile_io_data.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_io_data.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 OffTheRecordProfileIOData::Handle::Handle(Profile* profile) | 40 OffTheRecordProfileIOData::Handle::Handle(Profile* profile) |
| 41 : io_data_(new OffTheRecordProfileIOData), | 41 : io_data_(new OffTheRecordProfileIOData), |
| 42 profile_(profile), | 42 profile_(profile), |
| 43 initialized_(false) { | 43 initialized_(false) { |
| 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 45 DCHECK(profile); | 45 DCHECK(profile); |
| 46 } | 46 } |
| 47 | 47 |
| 48 OffTheRecordProfileIOData::Handle::~Handle() { | 48 OffTheRecordProfileIOData::Handle::~Handle() { |
| 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 50 if (main_request_context_getter_) | 50 if (main_request_context_getter_.get()) |
| 51 main_request_context_getter_->CleanupOnUIThread(); | 51 main_request_context_getter_->CleanupOnUIThread(); |
| 52 if (extensions_request_context_getter_) | 52 if (extensions_request_context_getter_.get()) |
| 53 extensions_request_context_getter_->CleanupOnUIThread(); | 53 extensions_request_context_getter_->CleanupOnUIThread(); |
| 54 | 54 |
| 55 // Clean up all isolated app request contexts. | 55 // Clean up all isolated app request contexts. |
| 56 for (ChromeURLRequestContextGetterMap::iterator iter = | 56 for (ChromeURLRequestContextGetterMap::iterator iter = |
| 57 app_request_context_getter_map_.begin(); | 57 app_request_context_getter_map_.begin(); |
| 58 iter != app_request_context_getter_map_.end(); | 58 iter != app_request_context_getter_map_.end(); |
| 59 ++iter) { | 59 ++iter) { |
| 60 iter->second->CleanupOnUIThread(); | 60 iter->second->CleanupOnUIThread(); |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 scoped_refptr<ChromeURLRequestContextGetter> | 91 scoped_refptr<ChromeURLRequestContextGetter> |
| 92 OffTheRecordProfileIOData::Handle::GetMainRequestContextGetter() const { | 92 OffTheRecordProfileIOData::Handle::GetMainRequestContextGetter() const { |
| 93 // TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI | 93 // TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI |
| 94 // thread. | 94 // thread. |
| 95 #if !defined(OS_CHROMEOS) | 95 #if !defined(OS_CHROMEOS) |
| 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 97 #endif // defined(OS_CHROMEOS) | 97 #endif // defined(OS_CHROMEOS) |
| 98 LazyInitialize(); | 98 LazyInitialize(); |
| 99 if (!main_request_context_getter_) { | 99 if (!main_request_context_getter_.get()) { |
| 100 main_request_context_getter_ = | 100 main_request_context_getter_ = |
| 101 ChromeURLRequestContextGetter::CreateOffTheRecord(profile_, io_data_); | 101 ChromeURLRequestContextGetter::CreateOffTheRecord(profile_, io_data_); |
| 102 } | 102 } |
| 103 return main_request_context_getter_; | 103 return main_request_context_getter_; |
| 104 } | 104 } |
| 105 | 105 |
| 106 scoped_refptr<ChromeURLRequestContextGetter> | 106 scoped_refptr<ChromeURLRequestContextGetter> |
| 107 OffTheRecordProfileIOData::Handle::GetExtensionsRequestContextGetter() const { | 107 OffTheRecordProfileIOData::Handle::GetExtensionsRequestContextGetter() const { |
| 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 109 LazyInitialize(); | 109 LazyInitialize(); |
| 110 if (!extensions_request_context_getter_) { | 110 if (!extensions_request_context_getter_.get()) { |
| 111 extensions_request_context_getter_ = | 111 extensions_request_context_getter_ = |
| 112 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( | 112 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( |
| 113 profile_, io_data_); | 113 profile_, io_data_); |
| 114 } | 114 } |
| 115 return extensions_request_context_getter_; | 115 return extensions_request_context_getter_; |
| 116 } | 116 } |
| 117 | 117 |
| 118 scoped_refptr<ChromeURLRequestContextGetter> | 118 scoped_refptr<ChromeURLRequestContextGetter> |
| 119 OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter( | 119 OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter( |
| 120 const std::string& app_id) const { | 120 const std::string& app_id) const { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 // For incognito, we use a non-persistent server bound cert store. | 203 // For incognito, we use a non-persistent server bound cert store. |
| 204 net::ServerBoundCertService* server_bound_cert_service = | 204 net::ServerBoundCertService* server_bound_cert_service = |
| 205 new net::ServerBoundCertService( | 205 new net::ServerBoundCertService( |
| 206 new net::DefaultServerBoundCertStore(NULL), | 206 new net::DefaultServerBoundCertStore(NULL), |
| 207 base::WorkerPool::GetTaskRunner(true)); | 207 base::WorkerPool::GetTaskRunner(true)); |
| 208 set_server_bound_cert_service(server_bound_cert_service); | 208 set_server_bound_cert_service(server_bound_cert_service); |
| 209 main_context->set_server_bound_cert_service(server_bound_cert_service); | 209 main_context->set_server_bound_cert_service(server_bound_cert_service); |
| 210 | 210 |
| 211 main_context->set_cookie_store( | 211 main_context->set_cookie_store( |
| 212 new net::CookieMonster(NULL, profile_params->cookie_monster_delegate)); | 212 new net::CookieMonster( |
| 213 NULL, profile_params->cookie_monster_delegate.get())); |
| 213 // All we care about for extensions is the cookie store. For incognito, we | 214 // All we care about for extensions is the cookie store. For incognito, we |
| 214 // use a non-persistent cookie store. | 215 // use a non-persistent cookie store. |
| 215 | 216 |
| 216 net::CookieMonster* extensions_cookie_store = | 217 net::CookieMonster* extensions_cookie_store = |
| 217 new net::CookieMonster(NULL, NULL); | 218 new net::CookieMonster(NULL, NULL); |
| 218 // Enable cookies for devtools and extension URLs. | 219 // Enable cookies for devtools and extension URLs. |
| 219 const char* schemes[] = {chrome::kChromeDevToolsScheme, | 220 const char* schemes[] = {chrome::kChromeDevToolsScheme, |
| 220 chrome::kExtensionScheme}; | 221 chrome::kExtensionScheme}; |
| 221 extensions_cookie_store->SetCookieableSchemes(schemes, 2); | 222 extensions_cookie_store->SetCookieableSchemes(schemes, 2); |
| 222 extensions_context->set_cookie_store(extensions_cookie_store); | 223 extensions_context->set_cookie_store(extensions_cookie_store); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 ChromeURLRequestContext* app_context, | 341 ChromeURLRequestContext* app_context, |
| 341 const std::string& app_id) const { | 342 const std::string& app_id) const { |
| 342 NOTREACHED(); | 343 NOTREACHED(); |
| 343 return NULL; | 344 return NULL; |
| 344 } | 345 } |
| 345 | 346 |
| 346 chrome_browser_net::LoadTimeStats* OffTheRecordProfileIOData::GetLoadTimeStats( | 347 chrome_browser_net::LoadTimeStats* OffTheRecordProfileIOData::GetLoadTimeStats( |
| 347 IOThread::Globals* io_thread_globals) const { | 348 IOThread::Globals* io_thread_globals) const { |
| 348 return NULL; | 349 return NULL; |
| 349 } | 350 } |
| OLD | NEW |