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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 #if defined(ENABLE_SESSION_SERVICE) | 506 #if defined(ENABLE_SESSION_SERVICE) |
507 StopCreateSessionServiceTimer(); | 507 StopCreateSessionServiceTimer(); |
508 #endif | 508 #endif |
509 | 509 |
510 // Remove pref observers | 510 // Remove pref observers |
511 pref_change_registrar_.RemoveAll(); | 511 pref_change_registrar_.RemoveAll(); |
512 | 512 |
513 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 513 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
514 io_data_.GetResourceContextNoInit()); | 514 io_data_.GetResourceContextNoInit()); |
515 | 515 |
516 if (io_data_.HasMainRequestContext() && | |
517 default_request_context_ == GetRequestContext()) { | |
518 default_request_context_ = NULL; | |
519 } | |
520 | |
521 // Destroy OTR profile and its profile services first. | 516 // Destroy OTR profile and its profile services first. |
522 if (off_the_record_profile_.get()) { | 517 if (off_the_record_profile_.get()) { |
523 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 518 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
524 off_the_record_profile_.get()); | 519 off_the_record_profile_.get()); |
525 } else { | 520 } else { |
526 ExtensionPrefValueMapFactory::GetForProfile(this)-> | 521 ExtensionPrefValueMapFactory::GetForProfile(this)-> |
527 ClearAllIncognitoSessionOnlyPreferences(); | 522 ClearAllIncognitoSessionOnlyPreferences(); |
528 } | 523 } |
529 | 524 |
530 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 525 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 return otr_prefs_.get(); | 691 return otr_prefs_.get(); |
697 } | 692 } |
698 | 693 |
699 FilePath ProfileImpl::GetPrefFilePath() { | 694 FilePath ProfileImpl::GetPrefFilePath() { |
700 FilePath pref_file_path = path_; | 695 FilePath pref_file_path = path_; |
701 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 696 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
702 return pref_file_path; | 697 return pref_file_path; |
703 } | 698 } |
704 | 699 |
705 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 700 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
706 net::URLRequestContextGetter* request_context = | 701 return io_data_.GetMainRequestContextGetter(); |
707 io_data_.GetMainRequestContextGetter(); | |
708 // The first request context is always a normal (non-OTR) request context. | |
709 // Even when Chromium is started in OTR mode, a normal profile is always | |
710 // created first. | |
711 if (!default_request_context_) | |
712 default_request_context_ = request_context; | |
713 | |
714 return request_context; | |
715 } | 702 } |
716 | 703 |
717 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 704 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
718 int renderer_child_id) { | 705 int renderer_child_id) { |
719 ExtensionService* extension_service = | 706 ExtensionService* extension_service = |
720 ExtensionSystem::Get(this)->extension_service(); | 707 ExtensionSystem::Get(this)->extension_service(); |
721 if (extension_service) { | 708 if (extension_service) { |
722 const extensions::Extension* installed_app = extension_service-> | 709 const extensions::Extension* installed_app = extension_service-> |
723 GetInstalledAppForRenderer(renderer_child_id); | 710 GetInstalledAppForRenderer(renderer_child_id); |
724 if (installed_app != NULL && installed_app->is_storage_isolated()) { | 711 if (installed_app != NULL && installed_app->is_storage_isolated()) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 if (!path.empty()) | 1095 if (!path.empty()) |
1109 *cache_path = path; | 1096 *cache_path = path; |
1110 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1097 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1111 prefs_->GetInteger(prefs::kDiskCacheSize); | 1098 prefs_->GetInteger(prefs::kDiskCacheSize); |
1112 } | 1099 } |
1113 | 1100 |
1114 base::Callback<ChromeURLDataManagerBackend*(void)> | 1101 base::Callback<ChromeURLDataManagerBackend*(void)> |
1115 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1102 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1116 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1103 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1117 } | 1104 } |
OLD | NEW |