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 |
516 // Destroy OTR profile and its profile services first. | 521 // Destroy OTR profile and its profile services first. |
517 if (off_the_record_profile_.get()) { | 522 if (off_the_record_profile_.get()) { |
518 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 523 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
519 off_the_record_profile_.get()); | 524 off_the_record_profile_.get()); |
520 } else { | 525 } else { |
521 ExtensionPrefValueMapFactory::GetForProfile(this)-> | 526 ExtensionPrefValueMapFactory::GetForProfile(this)-> |
522 ClearAllIncognitoSessionOnlyPreferences(); | 527 ClearAllIncognitoSessionOnlyPreferences(); |
523 } | 528 } |
524 | 529 |
525 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 530 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 return otr_prefs_.get(); | 696 return otr_prefs_.get(); |
692 } | 697 } |
693 | 698 |
694 FilePath ProfileImpl::GetPrefFilePath() { | 699 FilePath ProfileImpl::GetPrefFilePath() { |
695 FilePath pref_file_path = path_; | 700 FilePath pref_file_path = path_; |
696 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 701 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
697 return pref_file_path; | 702 return pref_file_path; |
698 } | 703 } |
699 | 704 |
700 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 705 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
701 return io_data_.GetMainRequestContextGetter(); | 706 net::URLRequestContextGetter* request_context = |
| 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; |
702 } | 715 } |
703 | 716 |
704 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 717 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
705 int renderer_child_id) { | 718 int renderer_child_id) { |
706 ExtensionService* extension_service = | 719 ExtensionService* extension_service = |
707 ExtensionSystem::Get(this)->extension_service(); | 720 ExtensionSystem::Get(this)->extension_service(); |
708 if (extension_service) { | 721 if (extension_service) { |
709 const extensions::Extension* installed_app = extension_service-> | 722 const extensions::Extension* installed_app = extension_service-> |
710 GetInstalledAppForRenderer(renderer_child_id); | 723 GetInstalledAppForRenderer(renderer_child_id); |
711 if (installed_app != NULL && installed_app->is_storage_isolated()) { | 724 if (installed_app != NULL && installed_app->is_storage_isolated()) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 if (!path.empty()) | 1108 if (!path.empty()) |
1096 *cache_path = path; | 1109 *cache_path = path; |
1097 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1110 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1098 prefs_->GetInteger(prefs::kDiskCacheSize); | 1111 prefs_->GetInteger(prefs::kDiskCacheSize); |
1099 } | 1112 } |
1100 | 1113 |
1101 base::Callback<ChromeURLDataManagerBackend*(void)> | 1114 base::Callback<ChromeURLDataManagerBackend*(void)> |
1102 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1115 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1103 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1116 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1104 } | 1117 } |
OLD | NEW |