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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 402 |
403 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, | 403 io_data_.Init(cookie_path, origin_bound_cert_path, cache_path, |
404 cache_max_size, media_cache_path, media_cache_max_size, | 404 cache_max_size, media_cache_path, media_cache_max_size, |
405 extensions_cookie_path, app_path, predictor_, | 405 extensions_cookie_path, app_path, predictor_, |
406 g_browser_process->local_state(), | 406 g_browser_process->local_state(), |
407 g_browser_process->io_thread(), | 407 g_browser_process->io_thread(), |
408 restore_old_session_cookies); | 408 restore_old_session_cookies); |
409 | 409 |
410 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 410 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
411 PluginPrefs::GetForProfile(this), | 411 PluginPrefs::GetForProfile(this), |
412 &io_data_.GetResourceContextNoInit()); | 412 io_data_.GetResourceContextNoInit()); |
413 | 413 |
414 // Creation has been finished. | 414 // Creation has been finished. |
415 if (delegate_) | 415 if (delegate_) |
416 delegate_->OnProfileCreated(this, true); | 416 delegate_->OnProfileCreated(this, true); |
417 | 417 |
418 content::NotificationService::current()->Notify( | 418 content::NotificationService::current()->Notify( |
419 chrome::NOTIFICATION_PROFILE_CREATED, | 419 chrome::NOTIFICATION_PROFILE_CREATED, |
420 content::Source<Profile>(this), | 420 content::Source<Profile>(this), |
421 content::NotificationService::NoDetails()); | 421 content::NotificationService::NoDetails()); |
422 } | 422 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit, | 558 base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit, |
559 appcache_service_.get(), true)); | 559 appcache_service_.get(), true)); |
560 } | 560 } |
561 | 561 |
562 StopCreateSessionServiceTimer(); | 562 StopCreateSessionServiceTimer(); |
563 | 563 |
564 // Remove pref observers | 564 // Remove pref observers |
565 pref_change_registrar_.RemoveAll(); | 565 pref_change_registrar_.RemoveAll(); |
566 | 566 |
567 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 567 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
568 &io_data_.GetResourceContextNoInit()); | 568 io_data_.GetResourceContextNoInit()); |
569 | 569 |
570 if (io_data_.HasMainRequestContext() && | 570 if (io_data_.HasMainRequestContext() && |
571 default_request_context_ == GetRequestContext()) { | 571 default_request_context_ == GetRequestContext()) { |
572 default_request_context_ = NULL; | 572 default_request_context_ = NULL; |
573 } | 573 } |
574 | 574 |
575 // Destroy OTR profile and its profile services first. | 575 // Destroy OTR profile and its profile services first. |
576 DestroyOffTheRecordProfile(); | 576 DestroyOffTheRecordProfile(); |
577 | 577 |
578 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 578 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 return GetRequestContextForIsolatedApp(installed_app->id()); | 835 return GetRequestContextForIsolatedApp(installed_app->id()); |
836 } | 836 } |
837 } | 837 } |
838 return GetRequestContext(); | 838 return GetRequestContext(); |
839 } | 839 } |
840 | 840 |
841 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { | 841 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { |
842 return io_data_.GetMediaRequestContextGetter(); | 842 return io_data_.GetMediaRequestContextGetter(); |
843 } | 843 } |
844 | 844 |
845 const content::ResourceContext& ProfileImpl::GetResourceContext() { | 845 content::ResourceContext* ProfileImpl::GetResourceContext() { |
846 return io_data_.GetResourceContext(); | 846 return io_data_.GetResourceContext(); |
847 } | 847 } |
848 | 848 |
849 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { | 849 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { |
850 if (!favicon_service_created_) { | 850 if (!favicon_service_created_) { |
851 favicon_service_created_ = true; | 851 favicon_service_created_ = true; |
852 favicon_service_.reset(new FaviconService(this)); | 852 favicon_service_.reset(new FaviconService(this)); |
853 } | 853 } |
854 return favicon_service_.get(); | 854 return favicon_service_.get(); |
855 } | 855 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 clear_local_state_on_exit_, quota_manager_->proxy(), | 1238 clear_local_state_on_exit_, quota_manager_->proxy(), |
1239 BrowserThread::GetMessageLoopProxyForThread( | 1239 BrowserThread::GetMessageLoopProxyForThread( |
1240 BrowserThread::WEBKIT_DEPRECATED)); | 1240 BrowserThread::WEBKIT_DEPRECATED)); |
1241 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 1241 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
1242 BrowserThread::PostTask( | 1242 BrowserThread::PostTask( |
1243 BrowserThread::IO, FROM_HERE, | 1243 BrowserThread::IO, FROM_HERE, |
1244 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 1244 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
1245 appcache_service_.get(), | 1245 appcache_service_.get(), |
1246 IsOffTheRecord() | 1246 IsOffTheRecord() |
1247 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 1247 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
1248 &io_data_.GetResourceContextNoInit(), | 1248 io_data_.GetResourceContextNoInit(), |
1249 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); | 1249 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); |
1250 } | 1250 } |
1251 | 1251 |
1252 WebKitContext* ProfileImpl::GetWebKitContext() { | 1252 WebKitContext* ProfileImpl::GetWebKitContext() { |
1253 CreateQuotaManagerAndClients(); | 1253 CreateQuotaManagerAndClients(); |
1254 return webkit_context_.get(); | 1254 return webkit_context_.get(); |
1255 } | 1255 } |
1256 | 1256 |
1257 void ProfileImpl::MarkAsCleanShutdown() { | 1257 void ProfileImpl::MarkAsCleanShutdown() { |
1258 if (prefs_.get()) { | 1258 if (prefs_.get()) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 FilePath* cache_path, | 1589 FilePath* cache_path, |
1590 int* max_size) { | 1590 int* max_size) { |
1591 DCHECK(cache_path); | 1591 DCHECK(cache_path); |
1592 DCHECK(max_size); | 1592 DCHECK(max_size); |
1593 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1593 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1594 if (!path.empty()) | 1594 if (!path.empty()) |
1595 *cache_path = path; | 1595 *cache_path = path; |
1596 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1596 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1597 prefs_->GetInteger(prefs::kDiskCacheSize); | 1597 prefs_->GetInteger(prefs::kDiskCacheSize); |
1598 } | 1598 } |
OLD | NEW |