| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
| 35 #include "chrome/browser/content_settings/cookie_settings.h" | 35 #include "chrome/browser/content_settings/cookie_settings.h" |
| 36 #include "chrome/browser/content_settings/host_content_settings_map.h" | 36 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 37 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 37 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 38 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" | 38 #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" |
| 39 #include "chrome/browser/domain_reliability/service_factory.h" | 39 #include "chrome/browser/domain_reliability/service_factory.h" |
| 40 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 40 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 41 #include "chrome/browser/download/download_service.h" | 41 #include "chrome/browser/download/download_service.h" |
| 42 #include "chrome/browser/download/download_service_factory.h" | 42 #include "chrome/browser/download/download_service_factory.h" |
| 43 #include "chrome/browser/extensions/extension_service.h" | |
| 44 #include "chrome/browser/extensions/extension_special_storage_policy.h" | |
| 45 #include "chrome/browser/history/top_sites.h" | 43 #include "chrome/browser/history/top_sites.h" |
| 46 #include "chrome/browser/net/chrome_url_request_context.h" | 44 #include "chrome/browser/net/chrome_url_request_context.h" |
| 47 #include "chrome/browser/net/net_pref_observer.h" | 45 #include "chrome/browser/net/net_pref_observer.h" |
| 48 #include "chrome/browser/net/predictor.h" | 46 #include "chrome/browser/net/predictor.h" |
| 49 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 47 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 50 #include "chrome/browser/net/proxy_service_factory.h" | 48 #include "chrome/browser/net/proxy_service_factory.h" |
| 51 #include "chrome/browser/net/ssl_config_service_manager.h" | 49 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 50 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 53 #include "chrome/browser/plugins/plugin_prefs.h" | 51 #include "chrome/browser/plugins/plugin_prefs.h" |
| 54 #include "chrome/browser/policy/profile_policy_connector.h" | 52 #include "chrome/browser/policy/profile_policy_connector.h" |
| 55 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 53 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 56 #include "chrome/browser/prefs/browser_prefs.h" | 54 #include "chrome/browser/prefs/browser_prefs.h" |
| 57 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 58 #include "chrome/browser/prefs/pref_service_syncable.h" | 56 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 59 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 57 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
| 60 #include "chrome/browser/prerender/prerender_manager_factory.h" | 58 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 61 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 59 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
| 62 #include "chrome/browser/profiles/chrome_version_service.h" | 60 #include "chrome/browser/profiles/chrome_version_service.h" |
| 63 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" | 61 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" |
| 64 #include "chrome/browser/profiles/profile_destroyer.h" | 62 #include "chrome/browser/profiles/profile_destroyer.h" |
| 65 #include "chrome/browser/profiles/profile_info_cache.h" | 63 #include "chrome/browser/profiles/profile_info_cache.h" |
| 66 #include "chrome/browser/profiles/profile_manager.h" | 64 #include "chrome/browser/profiles/profile_manager.h" |
| 67 #include "chrome/browser/profiles/profile_metrics.h" | 65 #include "chrome/browser/profiles/profile_metrics.h" |
| 68 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 66 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 69 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 67 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 70 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 68 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 71 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" | 69 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
| 72 #include "chrome/browser/sessions/session_service_factory.h" | 70 #include "chrome/browser/sessions/session_service_factory.h" |
| 73 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 71 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 74 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | |
| 75 #include "chrome/common/chrome_constants.h" | 72 #include "chrome/common/chrome_constants.h" |
| 76 #include "chrome/common/chrome_paths_internal.h" | 73 #include "chrome/common/chrome_paths_internal.h" |
| 77 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
| 78 #include "chrome/common/chrome_version_info.h" | 75 #include "chrome/common/chrome_version_info.h" |
| 79 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
| 80 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
| 81 #include "components/bookmarks/browser/bookmark_model.h" | 78 #include "components/bookmarks/browser/bookmark_model.h" |
| 82 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" | 79 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
| 83 #include "components/domain_reliability/monitor.h" | 80 #include "components/domain_reliability/monitor.h" |
| 84 #include "components/domain_reliability/service.h" | 81 #include "components/domain_reliability/service.h" |
| 85 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 82 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 86 #include "components/metrics/metrics_service.h" | 83 #include "components/metrics/metrics_service.h" |
| 87 #include "components/pref_registry/pref_registry_syncable.h" | 84 #include "components/pref_registry/pref_registry_syncable.h" |
| 88 #include "components/startup_metric_utils/startup_metric_utils.h" | 85 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 89 #include "components/url_fixer/url_fixer.h" | 86 #include "components/url_fixer/url_fixer.h" |
| 90 #include "components/user_prefs/user_prefs.h" | 87 #include "components/user_prefs/user_prefs.h" |
| 91 #include "content/public/browser/browser_thread.h" | 88 #include "content/public/browser/browser_thread.h" |
| 92 #include "content/public/browser/dom_storage_context.h" | 89 #include "content/public/browser/dom_storage_context.h" |
| 93 #include "content/public/browser/host_zoom_map.h" | 90 #include "content/public/browser/host_zoom_map.h" |
| 94 #include "content/public/browser/notification_service.h" | 91 #include "content/public/browser/notification_service.h" |
| 95 #include "content/public/browser/render_process_host.h" | 92 #include "content/public/browser/render_process_host.h" |
| 96 #include "content/public/browser/storage_partition.h" | 93 #include "content/public/browser/storage_partition.h" |
| 97 #include "content/public/browser/url_data_source.h" | 94 #include "content/public/browser/url_data_source.h" |
| 98 #include "content/public/browser/user_metrics.h" | 95 #include "content/public/browser/user_metrics.h" |
| 99 #include "content/public/common/content_constants.h" | 96 #include "content/public/common/content_constants.h" |
| 100 #include "content/public/common/page_zoom.h" | 97 #include "content/public/common/page_zoom.h" |
| 101 #include "extensions/browser/extension_pref_store.h" | |
| 102 #include "extensions/browser/extension_pref_value_map.h" | |
| 103 #include "extensions/browser/extension_pref_value_map_factory.h" | |
| 104 #include "extensions/browser/extension_system.h" | |
| 105 #include "grit/chromium_strings.h" | 98 #include "grit/chromium_strings.h" |
| 106 #include "grit/generated_resources.h" | 99 #include "grit/generated_resources.h" |
| 107 #include "ui/base/l10n/l10n_util.h" | 100 #include "ui/base/l10n/l10n_util.h" |
| 108 | 101 |
| 109 #if defined(OS_ANDROID) | 102 #if defined(OS_ANDROID) |
| 110 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 103 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 111 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" | 104 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
| 112 #endif | 105 #endif |
| 113 | 106 |
| 114 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 126 #include "chrome/browser/chromeos/login/login_utils.h" | 119 #include "chrome/browser/chromeos/login/login_utils.h" |
| 127 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 120 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 121 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 129 #else | 122 #else |
| 130 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 123 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 131 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 124 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 132 #endif | 125 #endif |
| 133 #endif | 126 #endif |
| 134 | 127 |
| 135 #if defined(ENABLE_EXTENSIONS) | 128 #if defined(ENABLE_EXTENSIONS) |
| 129 #include "chrome/browser/extensions/extension_service.h" |
| 130 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 136 #include "chrome/browser/guest_view/guest_view_manager.h" | 131 #include "chrome/browser/guest_view/guest_view_manager.h" |
| 132 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 133 #include "extensions/browser/extension_pref_store.h" |
| 134 #include "extensions/browser/extension_pref_value_map.h" |
| 135 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 136 #include "extensions/browser/extension_system.h" |
| 137 #endif | 137 #endif |
| 138 | 138 |
| 139 #if defined(ENABLE_MANAGED_USERS) | 139 #if defined(ENABLE_MANAGED_USERS) |
| 140 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 140 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 141 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 141 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 142 #endif | 142 #endif |
| 143 | 143 |
| 144 using base::Time; | 144 using base::Time; |
| 145 using base::TimeDelta; | 145 using base::TimeDelta; |
| 146 using base::UserMetricsAction; | 146 using base::UserMetricsAction; |
| 147 using content::BrowserThread; | 147 using content::BrowserThread; |
| 148 using content::DownloadManagerDelegate; | 148 using content::DownloadManagerDelegate; |
| 149 using content::HostZoomMap; | 149 using content::HostZoomMap; |
| 150 | 150 |
| 151 namespace { | 151 namespace { |
| 152 | 152 |
| 153 #if defined(ENABLE_SESSION_SERVICE) | 153 #if defined(ENABLE_SESSION_SERVICE) |
| 154 // Delay, in milliseconds, before we explicitly create the SessionService. | 154 // Delay, in milliseconds, before we explicitly create the SessionService. |
| 155 static const int kCreateSessionServiceDelayMS = 500; | 155 const int kCreateSessionServiceDelayMS = 500; |
| 156 #endif | 156 #endif |
| 157 | 157 |
| 158 // Text content of README file created in each profile directory. Both %s | 158 // Text content of README file created in each profile directory. Both %s |
| 159 // placeholders must contain the product name. This is not localizable and hence | 159 // placeholders must contain the product name. This is not localizable and hence |
| 160 // not in resources. | 160 // not in resources. |
| 161 static const char kReadmeText[] = | 161 const char kReadmeText[] = |
| 162 "%s settings and storage represent user-selected preferences and " | 162 "%s settings and storage represent user-selected preferences and " |
| 163 "information and MUST not be extracted, overwritten or modified except " | 163 "information and MUST not be extracted, overwritten or modified except " |
| 164 "through %s defined APIs."; | 164 "through %s defined APIs."; |
| 165 | 165 |
| 166 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED. | 166 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED. |
| 167 const char* const kPrefExitTypeCrashed = "Crashed"; | 167 const char kPrefExitTypeCrashed[] = "Crashed"; |
| 168 const char* const kPrefExitTypeSessionEnded = "SessionEnded"; | 168 const char kPrefExitTypeSessionEnded[] = "SessionEnded"; |
| 169 | 169 |
| 170 // Helper method needed because PostTask cannot currently take a Callback | 170 // Helper method needed because PostTask cannot currently take a Callback |
| 171 // function with non-void return type. | 171 // function with non-void return type. |
| 172 void CreateDirectoryAndSignal(const base::FilePath& path, | 172 void CreateDirectoryAndSignal(const base::FilePath& path, |
| 173 base::WaitableEvent* done_creating) { | 173 base::WaitableEvent* done_creating) { |
| 174 DVLOG(1) << "Creating directory " << path.value(); | 174 DVLOG(1) << "Creating directory " << path.value(); |
| 175 base::CreateDirectory(path); | 175 base::CreateDirectory(path); |
| 176 done_creating->Signal(); | 176 done_creating->Signal(); |
| 177 } | 177 } |
| 178 | 178 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // The LazyDomDistillerService deletes itself when the profile is destroyed. | 253 // The LazyDomDistillerService deletes itself when the profile is destroyed. |
| 254 dom_distiller::LazyDomDistillerService* lazy_service = | 254 dom_distiller::LazyDomDistillerService* lazy_service = |
| 255 new dom_distiller::LazyDomDistillerService( | 255 new dom_distiller::LazyDomDistillerService( |
| 256 profile, dom_distiller_service_factory); | 256 profile, dom_distiller_service_factory); |
| 257 content::URLDataSource::Add(profile, | 257 content::URLDataSource::Add(profile, |
| 258 new dom_distiller::DomDistillerViewerSource( | 258 new dom_distiller::DomDistillerViewerSource( |
| 259 lazy_service, chrome::kDomDistillerScheme)); | 259 lazy_service, chrome::kDomDistillerScheme)); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 PrefStore* CreateExtensionPrefStore(Profile* profile, |
| 264 bool incognito_pref_store) { |
| 265 #if defined(ENABLE_EXTENSIONS) |
| 266 return new ExtensionPrefStore( |
| 267 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), |
| 268 incognito_pref_store); |
| 269 #else |
| 270 return NULL; |
| 271 #endif |
| 272 } |
| 273 |
| 263 } // namespace | 274 } // namespace |
| 264 | 275 |
| 265 // static | 276 // static |
| 266 Profile* Profile::CreateProfile(const base::FilePath& path, | 277 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 267 Delegate* delegate, | 278 Delegate* delegate, |
| 268 CreateMode create_mode) { | 279 CreateMode create_mode) { |
| 269 TRACE_EVENT_BEGIN1("browser", | 280 TRACE_EVENT_BEGIN1("browser", |
| 270 "Profile::CreateProfile", | 281 "Profile::CreateProfile", |
| 271 "profile_path", | 282 "profile_path", |
| 272 path.value().c_str()); | 283 path.value().c_str()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // On startup, preference loading is always synchronous so a scoped timer | 473 // On startup, preference loading is always synchronous so a scoped timer |
| 463 // will work here. | 474 // will work here. |
| 464 startup_metric_utils::ScopedSlowStartupUMA | 475 startup_metric_utils::ScopedSlowStartupUMA |
| 465 scoped_timer("Startup.SlowStartupPreferenceLoading"); | 476 scoped_timer("Startup.SlowStartupPreferenceLoading"); |
| 466 prefs_ = chrome_prefs::CreateProfilePrefs( | 477 prefs_ = chrome_prefs::CreateProfilePrefs( |
| 467 path_, | 478 path_, |
| 468 sequenced_task_runner, | 479 sequenced_task_runner, |
| 469 pref_validation_delegate_.get(), | 480 pref_validation_delegate_.get(), |
| 470 profile_policy_connector_->policy_service(), | 481 profile_policy_connector_->policy_service(), |
| 471 supervised_user_settings, | 482 supervised_user_settings, |
| 472 new ExtensionPrefStore( | 483 CreateExtensionPrefStore(this, false), |
| 473 ExtensionPrefValueMapFactory::GetForBrowserContext(this), false), | |
| 474 pref_registry_, | 484 pref_registry_, |
| 475 async_prefs).Pass(); | 485 async_prefs).Pass(); |
| 476 // Register on BrowserContext. | 486 // Register on BrowserContext. |
| 477 user_prefs::UserPrefs::Set(this, prefs_.get()); | 487 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 478 } | 488 } |
| 479 | 489 |
| 480 startup_metric_utils::ScopedSlowStartupUMA | 490 startup_metric_utils::ScopedSlowStartupUMA |
| 481 scoped_timer("Startup.SlowStartupFinalProfileInit"); | 491 scoped_timer("Startup.SlowStartupFinalProfileInit"); |
| 482 if (async_prefs) { | 492 if (async_prefs) { |
| 483 // Wait for the notification that prefs has been loaded | 493 // Wait for the notification that prefs has been loaded |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #if defined(ENABLE_PLUGINS) | 740 #if defined(ENABLE_PLUGINS) |
| 731 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 741 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 732 io_data_.GetResourceContextNoInit()); | 742 io_data_.GetResourceContextNoInit()); |
| 733 #endif | 743 #endif |
| 734 | 744 |
| 735 // Destroy OTR profile and its profile services first. | 745 // Destroy OTR profile and its profile services first. |
| 736 if (off_the_record_profile_) { | 746 if (off_the_record_profile_) { |
| 737 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 747 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
| 738 off_the_record_profile_.get()); | 748 off_the_record_profile_.get()); |
| 739 } else { | 749 } else { |
| 750 #if defined(ENABLE_EXTENSIONS) |
| 740 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> | 751 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> |
| 741 ClearAllIncognitoSessionOnlyPreferences(); | 752 ClearAllIncognitoSessionOnlyPreferences(); |
| 753 #endif |
| 742 } | 754 } |
| 743 | 755 |
| 744 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( | 756 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
| 745 this); | 757 this); |
| 746 | 758 |
| 747 if (top_sites_.get()) | 759 if (top_sites_.get()) |
| 748 top_sites_->Shutdown(); | 760 top_sites_->Shutdown(); |
| 749 | 761 |
| 750 if (pref_proxy_config_tracker_) | 762 if (pref_proxy_config_tracker_) |
| 751 pref_proxy_config_tracker_->DetachFromPrefService(); | 763 pref_proxy_config_tracker_->DetachFromPrefService(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 content::NotificationService::current()->Notify( | 799 content::NotificationService::current()->Notify( |
| 788 chrome::NOTIFICATION_PROFILE_CREATED, | 800 chrome::NOTIFICATION_PROFILE_CREATED, |
| 789 content::Source<Profile>(off_the_record_profile_.get()), | 801 content::Source<Profile>(off_the_record_profile_.get()), |
| 790 content::NotificationService::NoDetails()); | 802 content::NotificationService::NoDetails()); |
| 791 } | 803 } |
| 792 return off_the_record_profile_.get(); | 804 return off_the_record_profile_.get(); |
| 793 } | 805 } |
| 794 | 806 |
| 795 void ProfileImpl::DestroyOffTheRecordProfile() { | 807 void ProfileImpl::DestroyOffTheRecordProfile() { |
| 796 off_the_record_profile_.reset(); | 808 off_the_record_profile_.reset(); |
| 809 #if defined(ENABLE_EXTENSIONS) |
| 797 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> | 810 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> |
| 798 ClearAllIncognitoSessionOnlyPreferences(); | 811 ClearAllIncognitoSessionOnlyPreferences(); |
| 812 #endif |
| 799 } | 813 } |
| 800 | 814 |
| 801 bool ProfileImpl::HasOffTheRecordProfile() { | 815 bool ProfileImpl::HasOffTheRecordProfile() { |
| 802 return off_the_record_profile_.get() != NULL; | 816 return off_the_record_profile_.get() != NULL; |
| 803 } | 817 } |
| 804 | 818 |
| 805 Profile* ProfileImpl::GetOriginalProfile() { | 819 Profile* ProfileImpl::GetOriginalProfile() { |
| 806 return this; | 820 return this; |
| 807 } | 821 } |
| 808 | 822 |
| 809 bool ProfileImpl::IsSupervised() { | 823 bool ProfileImpl::IsSupervised() { |
| 810 return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty(); | 824 return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty(); |
| 811 } | 825 } |
| 812 | 826 |
| 813 ExtensionSpecialStoragePolicy* | 827 ExtensionSpecialStoragePolicy* |
| 814 ProfileImpl::GetExtensionSpecialStoragePolicy() { | 828 ProfileImpl::GetExtensionSpecialStoragePolicy() { |
| 829 #if defined(ENABLE_EXTENSIONS) |
| 815 if (!extension_special_storage_policy_.get()) { | 830 if (!extension_special_storage_policy_.get()) { |
| 816 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") | 831 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") |
| 817 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( | 832 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( |
| 818 CookieSettings::Factory::GetForProfile(this).get()); | 833 CookieSettings::Factory::GetForProfile(this).get()); |
| 819 } | 834 } |
| 820 return extension_special_storage_policy_.get(); | 835 return extension_special_storage_policy_.get(); |
| 836 #else |
| 837 return NULL; |
| 838 #endif |
| 821 } | 839 } |
| 822 | 840 |
| 823 void ProfileImpl::OnPrefsLoaded(bool success) { | 841 void ProfileImpl::OnPrefsLoaded(bool success) { |
| 824 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded") | 842 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded") |
| 825 if (!success) { | 843 if (!success) { |
| 826 if (delegate_) | 844 if (delegate_) |
| 827 delegate_->OnProfileCreated(this, false, false); | 845 delegate_->OnProfileCreated(this, false, false); |
| 828 return; | 846 return; |
| 829 } | 847 } |
| 830 | 848 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 DCHECK(prefs_); // Should explicitly be initialized. | 936 DCHECK(prefs_); // Should explicitly be initialized. |
| 919 return prefs_.get(); | 937 return prefs_.get(); |
| 920 } | 938 } |
| 921 | 939 |
| 922 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 940 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
| 923 DCHECK(prefs_); | 941 DCHECK(prefs_); |
| 924 if (!otr_prefs_) { | 942 if (!otr_prefs_) { |
| 925 // The new ExtensionPrefStore is ref_counted and the new PrefService | 943 // The new ExtensionPrefStore is ref_counted and the new PrefService |
| 926 // stores a reference so that we do not leak memory here. | 944 // stores a reference so that we do not leak memory here. |
| 927 otr_prefs_.reset(prefs_->CreateIncognitoPrefService( | 945 otr_prefs_.reset(prefs_->CreateIncognitoPrefService( |
| 928 new ExtensionPrefStore( | 946 CreateExtensionPrefStore(this, true))); |
| 929 ExtensionPrefValueMapFactory::GetForBrowserContext(this), true))); | |
| 930 } | 947 } |
| 931 return otr_prefs_.get(); | 948 return otr_prefs_.get(); |
| 932 } | 949 } |
| 933 | 950 |
| 934 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( | 951 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 935 content::ProtocolHandlerMap* protocol_handlers, | 952 content::ProtocolHandlerMap* protocol_handlers, |
| 936 content::URLRequestInterceptorScopedVector request_interceptors) { | 953 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 937 return io_data_.CreateMainRequestContextGetter( | 954 return io_data_.CreateMainRequestContextGetter( |
| 938 protocol_handlers, | 955 protocol_handlers, |
| 939 request_interceptors.Pass(), | 956 request_interceptors.Pass(), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 return NULL; | 1039 return NULL; |
| 1023 #endif | 1040 #endif |
| 1024 } | 1041 } |
| 1025 | 1042 |
| 1026 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { | 1043 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { |
| 1027 return DownloadServiceFactory::GetForBrowserContext(this)-> | 1044 return DownloadServiceFactory::GetForBrowserContext(this)-> |
| 1028 GetDownloadManagerDelegate(); | 1045 GetDownloadManagerDelegate(); |
| 1029 } | 1046 } |
| 1030 | 1047 |
| 1031 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { | 1048 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { |
| 1049 #if defined(ENABLE_EXTENSIONS) |
| 1032 return GetExtensionSpecialStoragePolicy(); | 1050 return GetExtensionSpecialStoragePolicy(); |
| 1051 #else |
| 1052 return NULL; |
| 1053 #endif |
| 1033 } | 1054 } |
| 1034 | 1055 |
| 1035 content::PushMessagingService* ProfileImpl::GetPushMessagingService() { | 1056 content::PushMessagingService* ProfileImpl::GetPushMessagingService() { |
| 1036 return gcm::GCMProfileServiceFactory::GetForProfile( | 1057 return gcm::GCMProfileServiceFactory::GetForProfile( |
| 1037 this)->push_messaging_service(); | 1058 this)->push_messaging_service(); |
| 1038 } | 1059 } |
| 1039 | 1060 |
| 1040 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1061 bool ProfileImpl::IsSameProfile(Profile* profile) { |
| 1041 if (profile == static_cast<Profile*>(this)) | 1062 if (profile == static_cast<Profile*>(this)) |
| 1042 return true; | 1063 return true; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 ProfileImpl::CreateDomainReliabilityMonitor() { | 1340 ProfileImpl::CreateDomainReliabilityMonitor() { |
| 1320 domain_reliability::DomainReliabilityService* service = | 1341 domain_reliability::DomainReliabilityService* service = |
| 1321 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1342 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1322 GetForBrowserContext(this); | 1343 GetForBrowserContext(this); |
| 1323 if (!service) | 1344 if (!service) |
| 1324 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1345 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1325 | 1346 |
| 1326 return service->CreateMonitor( | 1347 return service->CreateMonitor( |
| 1327 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1348 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1328 } | 1349 } |
| OLD | NEW |