OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "content/browser/resource_context.h" | 46 #include "content/browser/resource_context.h" |
47 #include "content/common/notification_service.h" | 47 #include "content/common/notification_service.h" |
48 #include "net/http/http_transaction_factory.h" | 48 #include "net/http/http_transaction_factory.h" |
49 #include "net/http/http_util.h" | 49 #include "net/http/http_util.h" |
50 #include "net/proxy/proxy_config_service_fixed.h" | 50 #include "net/proxy/proxy_config_service_fixed.h" |
51 #include "net/proxy/proxy_script_fetcher_impl.h" | 51 #include "net/proxy/proxy_script_fetcher_impl.h" |
52 #include "net/proxy/proxy_service.h" | 52 #include "net/proxy/proxy_service.h" |
53 #include "net/url_request/url_request.h" | 53 #include "net/url_request/url_request.h" |
54 #include "webkit/blob/blob_data.h" | 54 #include "webkit/blob/blob_data.h" |
55 #include "webkit/blob/blob_url_request_job_factory.h" | 55 #include "webkit/blob/blob_url_request_job_factory.h" |
| 56 #include "webkit/database/database_tracker.h" |
56 #include "webkit/fileapi/file_system_context.h" | 57 #include "webkit/fileapi/file_system_context.h" |
57 #include "webkit/fileapi/file_system_url_request_job_factory.h" | 58 #include "webkit/fileapi/file_system_url_request_job_factory.h" |
58 #include "webkit/database/database_tracker.h" | |
59 #include "webkit/quota/quota_manager.h" | 59 #include "webkit/quota/quota_manager.h" |
60 | 60 |
61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
62 #include "chrome/browser/chromeos/gview_request_interceptor.h" | 62 #include "chrome/browser/chromeos/gview_request_interceptor.h" |
63 #endif // defined(OS_CHROMEOS) | 63 #endif // defined(OS_CHROMEOS) |
64 | 64 |
65 namespace { | 65 namespace { |
66 | 66 |
67 // ---------------------------------------------------------------------------- | 67 // ---------------------------------------------------------------------------- |
68 // CookieMonster::Delegate implementation | 68 // CookieMonster::Delegate implementation |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return profile->GetPrerenderManager(); | 184 return profile->GetPrerenderManager(); |
185 return NULL; | 185 return NULL; |
186 } | 186 } |
187 | 187 |
188 } // namespace | 188 } // namespace |
189 | 189 |
190 void ProfileIOData::InitializeProfileParams(Profile* profile) { | 190 void ProfileIOData::InitializeProfileParams(Profile* profile) { |
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
192 PrefService* pref_service = profile->GetPrefs(); | 192 PrefService* pref_service = profile->GetPrefs(); |
193 | 193 |
| 194 next_download_id_thunk_ = profile->GetDownloadManager()->GetNextIdThunk(); |
| 195 |
194 scoped_ptr<ProfileParams> params(new ProfileParams); | 196 scoped_ptr<ProfileParams> params(new ProfileParams); |
195 params->is_incognito = profile->IsOffTheRecord(); | 197 params->is_incognito = profile->IsOffTheRecord(); |
196 params->clear_local_state_on_exit = | 198 params->clear_local_state_on_exit = |
197 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | 199 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); |
198 | 200 |
199 params->appcache_service = profile->GetAppCacheService(); | 201 params->appcache_service = profile->GetAppCacheService(); |
200 | 202 |
201 // Set up Accept-Language and Accept-Charset header values | 203 // Set up Accept-Language and Accept-Charset header values |
202 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 204 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
203 pref_service->GetString(prefs::kAcceptLanguages)); | 205 pref_service->GetString(prefs::kAcceptLanguages)); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 resource_context_.set_database_tracker(database_tracker_); | 480 resource_context_.set_database_tracker(database_tracker_); |
479 resource_context_.set_appcache_service(appcache_service_); | 481 resource_context_.set_appcache_service(appcache_service_); |
480 resource_context_.set_blob_storage_context(blob_storage_context_); | 482 resource_context_.set_blob_storage_context(blob_storage_context_); |
481 resource_context_.set_file_system_context(file_system_context_); | 483 resource_context_.set_file_system_context(file_system_context_); |
482 resource_context_.set_quota_manager(quota_manager_); | 484 resource_context_.set_quota_manager(quota_manager_); |
483 resource_context_.set_host_zoom_map(host_zoom_map_); | 485 resource_context_.set_host_zoom_map(host_zoom_map_); |
484 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); | 486 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); |
485 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); | 487 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); |
486 resource_context_.set_media_observer( | 488 resource_context_.set_media_observer( |
487 io_thread_globals->media.media_internals.get()); | 489 io_thread_globals->media.media_internals.get()); |
| 490 // TODO(benjhayden) clean this up when we can include DownloadManager in |
| 491 // ResourceContext. |
| 492 resource_context_.SetUserData(reinterpret_cast<void*>(BASE_HASH_NAMESPACE:: |
| 493 #if defined(COMPILER_GCC) |
| 494 hash<std::string>() |
| 495 #elif defined(COMPILER_MSVC) |
| 496 hash_value |
| 497 #endif |
| 498 ("next_download_id_thunk")), &next_download_id_thunk_); |
488 | 499 |
489 LazyInitializeInternal(profile_params_.get()); | 500 LazyInitializeInternal(profile_params_.get()); |
490 | 501 |
491 profile_params_.reset(); | 502 profile_params_.reset(); |
492 initialized_ = true; | 503 initialized_ = true; |
493 } | 504 } |
494 | 505 |
495 void ProfileIOData::ApplyProfileParamsToContext( | 506 void ProfileIOData::ApplyProfileParamsToContext( |
496 ChromeURLRequestContext* context) const { | 507 ChromeURLRequestContext* context) const { |
497 context->set_is_incognito(profile_params_->is_incognito); | 508 context->set_is_incognito(profile_params_->is_incognito); |
(...skipping 14 matching lines...) Expand all Loading... |
512 BrowserThread::IO, FROM_HERE, | 523 BrowserThread::IO, FROM_HERE, |
513 base::Bind( | 524 base::Bind( |
514 &ResourceDispatcherHost::CancelRequestsForContext, | 525 &ResourceDispatcherHost::CancelRequestsForContext, |
515 base::Unretained(g_browser_process->resource_dispatcher_host()), | 526 base::Unretained(g_browser_process->resource_dispatcher_host()), |
516 &resource_context_)); | 527 &resource_context_)); |
517 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 528 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
518 new DeleteTask<ProfileIOData>(this)); | 529 new DeleteTask<ProfileIOData>(this)); |
519 if (!posted) | 530 if (!posted) |
520 delete this; | 531 delete this; |
521 } | 532 } |
OLD | NEW |