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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 37 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
38 #include "chrome/browser/browser_process.h" | 38 #include "chrome/browser/browser_process.h" |
39 #include "chrome/browser/chrome_notification_types.h" | 39 #include "chrome/browser/chrome_notification_types.h" |
40 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 40 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
41 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 41 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
42 #include "chrome/browser/dom_distiller/profile_utils.h" | 42 #include "chrome/browser/dom_distiller/profile_utils.h" |
43 #include "chrome/browser/domain_reliability/service_factory.h" | 43 #include "chrome/browser/domain_reliability/service_factory.h" |
44 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 44 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
45 #include "chrome/browser/download/download_service.h" | 45 #include "chrome/browser/download/download_service.h" |
46 #include "chrome/browser/download/download_service_factory.h" | 46 #include "chrome/browser/download/download_service_factory.h" |
| 47 #include "chrome/browser/media/media_device_id_salt.h" |
47 #include "chrome/browser/net/predictor.h" | 48 #include "chrome/browser/net/predictor.h" |
48 #include "chrome/browser/net/proxy_service_factory.h" | 49 #include "chrome/browser/net/proxy_service_factory.h" |
49 #include "chrome/browser/permissions/permission_manager.h" | 50 #include "chrome/browser/permissions/permission_manager.h" |
50 #include "chrome/browser/permissions/permission_manager_factory.h" | 51 #include "chrome/browser/permissions/permission_manager_factory.h" |
51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
52 #include "chrome/browser/plugins/plugin_prefs.h" | 53 #include "chrome/browser/plugins/plugin_prefs.h" |
53 #include "chrome/browser/policy/profile_policy_connector.h" | 54 #include "chrome/browser/policy/profile_policy_connector.h" |
54 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 55 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
55 #include "chrome/browser/policy/schema_registry_service.h" | 56 #include "chrome/browser/policy/schema_registry_service.h" |
56 #include "chrome/browser/policy/schema_registry_service_factory.h" | 57 #include "chrome/browser/policy/schema_registry_service_factory.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 pref_change_registrar_.Add( | 559 pref_change_registrar_.Add( |
559 prefs::kProfileName, | 560 prefs::kProfileName, |
560 base::Bind(&ProfileImpl::UpdateNameInStorage, | 561 base::Bind(&ProfileImpl::UpdateNameInStorage, |
561 base::Unretained(this))); | 562 base::Unretained(this))); |
562 | 563 |
563 pref_change_registrar_.Add( | 564 pref_change_registrar_.Add( |
564 prefs::kForceEphemeralProfiles, | 565 prefs::kForceEphemeralProfiles, |
565 base::Bind(&ProfileImpl::UpdateIsEphemeralInStorage, | 566 base::Bind(&ProfileImpl::UpdateIsEphemeralInStorage, |
566 base::Unretained(this))); | 567 base::Unretained(this))); |
567 | 568 |
| 569 media_device_id_salt_ = new MediaDeviceIDSalt(prefs_.get()); |
| 570 |
568 // It would be nice to use PathService for fetching this directory, but | 571 // It would be nice to use PathService for fetching this directory, but |
569 // the cache directory depends on the profile directory, which isn't available | 572 // the cache directory depends on the profile directory, which isn't available |
570 // to PathService. | 573 // to PathService. |
571 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 574 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
572 // Always create the cache directory asynchronously. | 575 // Always create the cache directory asynchronously. |
573 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | 576 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
574 JsonPrefStore::GetTaskRunnerForFile(base_cache_path_, | 577 JsonPrefStore::GetTaskRunnerForFile(base_cache_path_, |
575 BrowserThread::GetBlockingPool()); | 578 BrowserThread::GetBlockingPool()); |
576 CreateProfileDirectory(sequenced_task_runner.get(), base_cache_path_, false); | 579 CreateProfileDirectory(sequenced_task_runner.get(), base_cache_path_, false); |
577 | 580 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 | 1092 |
1090 // NOTE: The dependencies of the Identity Service have not yet been created, | 1093 // NOTE: The dependencies of the Identity Service have not yet been created, |
1091 // so it is not possible to bind them here. Instead, bind them at the time | 1094 // so it is not possible to bind them here. Instead, bind them at the time |
1092 // of the actual request to create the Identity Service. | 1095 // of the actual request to create the Identity Service. |
1093 identity_service_info.factory = | 1096 identity_service_info.factory = |
1094 base::Bind(&ProfileImpl::CreateIdentityService, base::Unretained(this)); | 1097 base::Bind(&ProfileImpl::CreateIdentityService, base::Unretained(this)); |
1095 services->insert( | 1098 services->insert( |
1096 std::make_pair(identity::mojom::kServiceName, identity_service_info)); | 1099 std::make_pair(identity::mojom::kServiceName, identity_service_info)); |
1097 } | 1100 } |
1098 | 1101 |
| 1102 std::string ProfileImpl::GetMediaDeviceIDSalt() { |
| 1103 return media_device_id_salt_->GetSalt(); |
| 1104 } |
| 1105 |
1099 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1106 bool ProfileImpl::IsSameProfile(Profile* profile) { |
1100 if (profile == static_cast<Profile*>(this)) | 1107 if (profile == static_cast<Profile*>(this)) |
1101 return true; | 1108 return true; |
1102 Profile* otr_profile = off_the_record_profile_.get(); | 1109 Profile* otr_profile = off_the_record_profile_.get(); |
1103 return otr_profile && profile == otr_profile; | 1110 return otr_profile && profile == otr_profile; |
1104 } | 1111 } |
1105 | 1112 |
1106 Time ProfileImpl::GetStartTime() const { | 1113 Time ProfileImpl::GetStartTime() const { |
1107 return start_time_; | 1114 return start_time_; |
1108 } | 1115 } |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1357 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1351 | 1358 |
1352 return service->CreateMonitor( | 1359 return service->CreateMonitor( |
1353 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1360 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
1354 } | 1361 } |
1355 | 1362 |
1356 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { | 1363 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { |
1357 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); | 1364 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); |
1358 return base::MakeUnique<identity::IdentityService>(signin_manager); | 1365 return base::MakeUnique<identity::IdentityService>(signin_manager); |
1359 } | 1366 } |
OLD | NEW |