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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 pref_change_registrar_.Add( | 556 pref_change_registrar_.Add( |
556 prefs::kProfileName, | 557 prefs::kProfileName, |
557 base::Bind(&ProfileImpl::UpdateNameInStorage, | 558 base::Bind(&ProfileImpl::UpdateNameInStorage, |
558 base::Unretained(this))); | 559 base::Unretained(this))); |
559 | 560 |
560 pref_change_registrar_.Add( | 561 pref_change_registrar_.Add( |
561 prefs::kForceEphemeralProfiles, | 562 prefs::kForceEphemeralProfiles, |
562 base::Bind(&ProfileImpl::UpdateIsEphemeralInStorage, | 563 base::Bind(&ProfileImpl::UpdateIsEphemeralInStorage, |
563 base::Unretained(this))); | 564 base::Unretained(this))); |
564 | 565 |
| 566 media_device_id_salt_ = new MediaDeviceIDSalt(prefs_.get()); |
| 567 |
565 // It would be nice to use PathService for fetching this directory, but | 568 // It would be nice to use PathService for fetching this directory, but |
566 // the cache directory depends on the profile directory, which isn't available | 569 // the cache directory depends on the profile directory, which isn't available |
567 // to PathService. | 570 // to PathService. |
568 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 571 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
569 // Always create the cache directory asynchronously. | 572 // Always create the cache directory asynchronously. |
570 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | 573 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
571 JsonPrefStore::GetTaskRunnerForFile(base_cache_path_, | 574 JsonPrefStore::GetTaskRunnerForFile(base_cache_path_, |
572 BrowserThread::GetBlockingPool()); | 575 BrowserThread::GetBlockingPool()); |
573 CreateProfileDirectory(sequenced_task_runner.get(), base_cache_path_, false); | 576 CreateProfileDirectory(sequenced_task_runner.get(), base_cache_path_, false); |
574 | 577 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1089 |
1087 // NOTE: The dependencies of the Identity Service have not yet been created, | 1090 // NOTE: The dependencies of the Identity Service have not yet been created, |
1088 // so it is not possible to bind them here. Instead, bind them at the time | 1091 // so it is not possible to bind them here. Instead, bind them at the time |
1089 // of the actual request to create the Identity Service. | 1092 // of the actual request to create the Identity Service. |
1090 identity_service_info.factory = | 1093 identity_service_info.factory = |
1091 base::Bind(&ProfileImpl::CreateIdentityService, base::Unretained(this)); | 1094 base::Bind(&ProfileImpl::CreateIdentityService, base::Unretained(this)); |
1092 services->insert( | 1095 services->insert( |
1093 std::make_pair(identity::mojom::kServiceName, identity_service_info)); | 1096 std::make_pair(identity::mojom::kServiceName, identity_service_info)); |
1094 } | 1097 } |
1095 | 1098 |
| 1099 std::string ProfileImpl::GetMediaDeviceIDSalt() { |
| 1100 return media_device_id_salt_->GetSalt(); |
| 1101 } |
| 1102 |
1096 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1103 bool ProfileImpl::IsSameProfile(Profile* profile) { |
1097 if (profile == static_cast<Profile*>(this)) | 1104 if (profile == static_cast<Profile*>(this)) |
1098 return true; | 1105 return true; |
1099 Profile* otr_profile = off_the_record_profile_.get(); | 1106 Profile* otr_profile = off_the_record_profile_.get(); |
1100 return otr_profile && profile == otr_profile; | 1107 return otr_profile && profile == otr_profile; |
1101 } | 1108 } |
1102 | 1109 |
1103 Time ProfileImpl::GetStartTime() const { | 1110 Time ProfileImpl::GetStartTime() const { |
1104 return start_time_; | 1111 return start_time_; |
1105 } | 1112 } |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1354 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1348 | 1355 |
1349 return service->CreateMonitor( | 1356 return service->CreateMonitor( |
1350 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1357 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
1351 } | 1358 } |
1352 | 1359 |
1353 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { | 1360 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { |
1354 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); | 1361 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); |
1355 return base::MakeUnique<identity::IdentityService>(signin_manager); | 1362 return base::MakeUnique<identity::IdentityService>(signin_manager); |
1356 } | 1363 } |
OLD | NEW |