| 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.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/background_contents_service.h" | 17 #include "chrome/browser/background_contents_service.h" |
| 18 #include "chrome/browser/browser_list.h" | 18 #include "chrome/browser/browser_list.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/content_settings/host_content_settings_map.h" | 20 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 21 #include "chrome/browser/download/download_manager.h" | 21 #include "chrome/browser/download/download_manager.h" |
| 22 #include "chrome/browser/extensions/extension_message_service.h" | 22 #include "chrome/browser/extensions/extension_message_service.h" |
| 23 #include "chrome/browser/extensions/extension_pref_store.h" | 23 #include "chrome/browser/extensions/extension_pref_store.h" |
| 24 #include "chrome/browser/extensions/extension_process_manager.h" | 24 #include "chrome/browser/extensions/extension_process_manager.h" |
| 25 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 25 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 26 #include "chrome/browser/net/pref_proxy_config_service.h" | 26 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 27 #include "chrome/browser/notifications/desktop_notification_service.h" | 27 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" | 29 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
| 30 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 30 #include "chrome/browser/ssl/ssl_host_state.h" | 31 #include "chrome/browser/ssl/ssl_host_state.h" |
| 31 #include "chrome/browser/sync/profile_sync_service.h" | 32 #include "chrome/browser/sync/profile_sync_service.h" |
| 32 #include "chrome/browser/themes/theme_service.h" | 33 #include "chrome/browser/themes/theme_service.h" |
| 33 #include "chrome/browser/transport_security_persister.h" | 34 #include "chrome/browser/transport_security_persister.h" |
| 34 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 35 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 35 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 36 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 36 #include "chrome/browser/ui/webui/extension_icon_source.h" | 37 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| 37 #include "chrome/common/chrome_constants.h" | 38 #include "chrome/common/chrome_constants.h" |
| 38 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
| 39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 // Make the chrome//extension-icon/ resource available. | 183 // Make the chrome//extension-icon/ resource available. |
| 183 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); | 184 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); |
| 184 GetChromeURLDataManager()->AddDataSource(icon_source); | 185 GetChromeURLDataManager()->AddDataSource(icon_source); |
| 185 } | 186 } |
| 186 | 187 |
| 187 virtual ~OffTheRecordProfileImpl() { | 188 virtual ~OffTheRecordProfileImpl() { |
| 188 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, | 189 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, |
| 189 Source<Profile>(this), | 190 Source<Profile>(this), |
| 190 NotificationService::NoDetails()); | 191 NotificationService::NoDetails()); |
| 192 |
| 193 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 194 |
| 191 // Clean up all DB files/directories | 195 // Clean up all DB files/directories |
| 192 if (db_tracker_) | 196 if (db_tracker_) |
| 193 BrowserThread::PostTask( | 197 BrowserThread::PostTask( |
| 194 BrowserThread::FILE, FROM_HERE, | 198 BrowserThread::FILE, FROM_HERE, |
| 195 NewRunnableMethod( | 199 NewRunnableMethod( |
| 196 db_tracker_.get(), | 200 db_tracker_.get(), |
| 197 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); | 201 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); |
| 198 | 202 |
| 199 BrowserList::RemoveObserver(this); | 203 BrowserList::RemoveObserver(this); |
| 200 | 204 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 }; | 777 }; |
| 774 #endif | 778 #endif |
| 775 | 779 |
| 776 Profile* Profile::CreateOffTheRecordProfile() { | 780 Profile* Profile::CreateOffTheRecordProfile() { |
| 777 #if defined(OS_CHROMEOS) | 781 #if defined(OS_CHROMEOS) |
| 778 if (Profile::IsGuestSession()) | 782 if (Profile::IsGuestSession()) |
| 779 return new GuestSessionProfile(this); | 783 return new GuestSessionProfile(this); |
| 780 #endif | 784 #endif |
| 781 return new OffTheRecordProfileImpl(this); | 785 return new OffTheRecordProfileImpl(this); |
| 782 } | 786 } |
| OLD | NEW |