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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "chrome/browser/net/ssl_config_service_manager.h" | 52 #include "chrome/browser/net/ssl_config_service_manager.h" |
53 #include "chrome/browser/net/url_fixer_upper.h" | 53 #include "chrome/browser/net/url_fixer_upper.h" |
54 #include "chrome/browser/plugin_prefs.h" | 54 #include "chrome/browser/plugin_prefs.h" |
55 #include "chrome/browser/policy/policy_service.h" | 55 #include "chrome/browser/policy/policy_service.h" |
56 #include "chrome/browser/prefs/browser_prefs.h" | 56 #include "chrome/browser/prefs/browser_prefs.h" |
57 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 57 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
58 #include "chrome/browser/prerender/prerender_manager_factory.h" | 58 #include "chrome/browser/prerender/prerender_manager_factory.h" |
59 #include "chrome/browser/profiles/chrome_version_service.h" | 59 #include "chrome/browser/profiles/chrome_version_service.h" |
60 #include "chrome/browser/profiles/gaia_info_update_service.h" | 60 #include "chrome/browser/profiles/gaia_info_update_service.h" |
61 #include "chrome/browser/profiles/profile_dependency_manager.h" | 61 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 62 #include "chrome/browser/profiles/profile_destroyer.h" |
62 #include "chrome/browser/profiles/profile_info_cache.h" | 63 #include "chrome/browser/profiles/profile_info_cache.h" |
63 #include "chrome/browser/profiles/profile_manager.h" | 64 #include "chrome/browser/profiles/profile_manager.h" |
64 #include "chrome/browser/search_engines/template_url_fetcher.h" | 65 #include "chrome/browser/search_engines/template_url_fetcher.h" |
65 #include "chrome/browser/sessions/session_service_factory.h" | 66 #include "chrome/browser/sessions/session_service_factory.h" |
66 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" | 67 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
67 #include "chrome/browser/sync/profile_sync_service_factory.h" | 68 #include "chrome/browser/sync/profile_sync_service_factory.h" |
68 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 69 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
69 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 70 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
70 #include "chrome/browser/user_style_sheet_watcher.h" | 71 #include "chrome/browser/user_style_sheet_watcher.h" |
71 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" | 72 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 495 |
495 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 496 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
496 io_data_.GetResourceContextNoInit()); | 497 io_data_.GetResourceContextNoInit()); |
497 | 498 |
498 if (io_data_.HasMainRequestContext() && | 499 if (io_data_.HasMainRequestContext() && |
499 default_request_context_ == GetRequestContext()) { | 500 default_request_context_ == GetRequestContext()) { |
500 default_request_context_ = NULL; | 501 default_request_context_ = NULL; |
501 } | 502 } |
502 | 503 |
503 // Destroy OTR profile and its profile services first. | 504 // Destroy OTR profile and its profile services first. |
504 DestroyOffTheRecordProfile(); | 505 if (off_the_record_profile_.get()) { |
| 506 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
| 507 off_the_record_profile_.get()); |
| 508 } else { |
| 509 ExtensionPrefValueMapFactory::GetForProfile(this)-> |
| 510 ClearAllIncognitoSessionOnlyPreferences(); |
| 511 } |
505 | 512 |
506 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 513 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
507 | 514 |
508 // The HistoryService maintains threads for background processing. Its | 515 // The HistoryService maintains threads for background processing. Its |
509 // possible each thread still has tasks on it that have increased the ref | 516 // possible each thread still has tasks on it that have increased the ref |
510 // count of the service. In such a situation, when we decrement the refcount, | 517 // count of the service. In such a situation, when we decrement the refcount, |
511 // it won't be 0, and the threads/databases aren't properly shut down. By | 518 // it won't be 0, and the threads/databases aren't properly shut down. By |
512 // explicitly calling Cleanup/Shutdown we ensure the databases are properly | 519 // explicitly calling Cleanup/Shutdown we ensure the databases are properly |
513 // closed. | 520 // closed. |
514 | 521 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 if (!path.empty()) | 1101 if (!path.empty()) |
1095 *cache_path = path; | 1102 *cache_path = path; |
1096 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1103 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1097 prefs_->GetInteger(prefs::kDiskCacheSize); | 1104 prefs_->GetInteger(prefs::kDiskCacheSize); |
1098 } | 1105 } |
1099 | 1106 |
1100 base::Callback<ChromeURLDataManagerBackend*(void)> | 1107 base::Callback<ChromeURLDataManagerBackend*(void)> |
1101 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1108 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1102 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1109 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1103 } | 1110 } |
OLD | NEW |