| 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/background_contents_service_factory.h" | 17 #include "chrome/browser/background/background_contents_service_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 19 #include "chrome/browser/content_settings/host_content_settings_map.h" | 20 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 21 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 21 #include "chrome/browser/extensions/extension_info_map.h" | 22 #include "chrome/browser/extensions/extension_info_map.h" |
| 22 #include "chrome/browser/extensions/extension_message_service.h" | 23 #include "chrome/browser/extensions/extension_message_service.h" |
| 23 #include "chrome/browser/extensions/extension_pref_store.h" | 24 #include "chrome/browser/extensions/extension_pref_store.h" |
| 24 #include "chrome/browser/extensions/extension_process_manager.h" | 25 #include "chrome/browser/extensions/extension_process_manager.h" |
| 25 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
| 26 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 27 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 27 #include "chrome/browser/extensions/extension_webrequest_api.h" | 28 #include "chrome/browser/extensions/extension_webrequest_api.h" |
| 28 #include "chrome/browser/net/pref_proxy_config_service.h" | 29 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 30 #include "chrome/browser/plugin_prefs.h" |
| 29 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 31 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" | 33 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
| 32 #include "chrome/browser/profiles/profile_dependency_manager.h" | 34 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 33 #include "chrome/browser/sync/profile_sync_service.h" | 35 #include "chrome/browser/sync/profile_sync_service.h" |
| 34 #include "chrome/browser/themes/theme_service.h" | 36 #include "chrome/browser/themes/theme_service.h" |
| 35 #include "chrome/browser/transport_security_persister.h" | 37 #include "chrome/browser/transport_security_persister.h" |
| 36 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
| 37 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 39 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 38 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 40 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Profile member from a thread other than the UI thread, so we need to | 112 // Profile member from a thread other than the UI thread, so we need to |
| 111 // prevent a race. | 113 // prevent a race. |
| 112 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 113 GetRequestContext(); | 115 GetRequestContext(); |
| 114 #endif // defined(OS_CHROMEOS) | 116 #endif // defined(OS_CHROMEOS) |
| 115 | 117 |
| 116 // Make the chrome//extension-icon/ resource available. | 118 // Make the chrome//extension-icon/ resource available. |
| 117 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); | 119 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); |
| 118 GetChromeURLDataManager()->AddDataSource(icon_source); | 120 GetChromeURLDataManager()->AddDataSource(icon_source); |
| 119 | 121 |
| 122 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 123 PluginPrefs::GetForProfile(this), &GetResourceContext()); |
| 124 |
| 120 BrowserThread::PostTask( | 125 BrowserThread::PostTask( |
| 121 BrowserThread::IO, FROM_HERE, | 126 BrowserThread::IO, FROM_HERE, |
| 122 NewRunnableFunction(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); | 127 NewRunnableFunction(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); |
| 123 } | 128 } |
| 124 | 129 |
| 125 virtual ~OffTheRecordProfileImpl() { | 130 virtual ~OffTheRecordProfileImpl() { |
| 126 NotificationService::current()->Notify( | 131 NotificationService::current()->Notify( |
| 127 chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), | 132 chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), |
| 128 NotificationService::NoDetails()); | 133 NotificationService::NoDetails()); |
| 129 | 134 |
| 135 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 136 &GetResourceContext()); |
| 137 |
| 130 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 138 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 131 | 139 |
| 132 BrowserThread::PostTask( | 140 BrowserThread::PostTask( |
| 133 BrowserThread::IO, FROM_HERE, | 141 BrowserThread::IO, FROM_HERE, |
| 134 NewRunnableFunction( | 142 NewRunnableFunction( |
| 135 &NotifyOTRProfileDestroyedOnIOThread, profile_, this)); | 143 &NotifyOTRProfileDestroyedOnIOThread, profile_, this)); |
| 136 | 144 |
| 137 // Clean up all DB files/directories | 145 // Clean up all DB files/directories |
| 138 if (db_tracker_) { | 146 if (db_tracker_) { |
| 139 BrowserThread::PostTask( | 147 BrowserThread::PostTask( |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 }; | 726 }; |
| 719 #endif | 727 #endif |
| 720 | 728 |
| 721 Profile* Profile::CreateOffTheRecordProfile() { | 729 Profile* Profile::CreateOffTheRecordProfile() { |
| 722 #if defined(OS_CHROMEOS) | 730 #if defined(OS_CHROMEOS) |
| 723 if (Profile::IsGuestSession()) | 731 if (Profile::IsGuestSession()) |
| 724 return new GuestSessionProfile(this); | 732 return new GuestSessionProfile(this); |
| 725 #endif | 733 #endif |
| 726 return new OffTheRecordProfileImpl(this); | 734 return new OffTheRecordProfileImpl(this); |
| 727 } | 735 } |
| OLD | NEW |