Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 2745563005: Pref service: add support for tracked prefs. (Closed)
Patch Set: deflake tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "components/zoom/zoom_event_manager.h" 108 #include "components/zoom/zoom_event_manager.h"
109 #include "content/public/browser/browser_thread.h" 109 #include "content/public/browser/browser_thread.h"
110 #include "content/public/browser/dom_storage_context.h" 110 #include "content/public/browser/dom_storage_context.h"
111 #include "content/public/browser/notification_service.h" 111 #include "content/public/browser/notification_service.h"
112 #include "content/public/browser/render_process_host.h" 112 #include "content/public/browser/render_process_host.h"
113 #include "content/public/browser/storage_partition.h" 113 #include "content/public/browser/storage_partition.h"
114 #include "content/public/browser/url_data_source.h" 114 #include "content/public/browser/url_data_source.h"
115 #include "content/public/common/content_constants.h" 115 #include "content/public/common/content_constants.h"
116 #include "content/public/common/page_zoom.h" 116 #include "content/public/common/page_zoom.h"
117 #include "extensions/features/features.h" 117 #include "extensions/features/features.h"
118 #include "mojo/public/cpp/bindings/strong_binding.h"
118 #include "ppapi/features/features.h" 119 #include "ppapi/features/features.h"
119 #include "printing/features/features.h" 120 #include "printing/features/features.h"
120 #include "services/identity/identity_service.h" 121 #include "services/identity/identity_service.h"
121 #include "services/identity/public/interfaces/constants.mojom.h" 122 #include "services/identity/public/interfaces/constants.mojom.h"
122 #include "services/preferences/public/cpp/pref_service_main.h" 123 #include "services/preferences/public/cpp/pref_service_main.h"
123 #include "services/preferences/public/interfaces/preferences.mojom.h" 124 #include "services/preferences/public/interfaces/preferences.mojom.h"
124 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h" 125 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h"
125 #include "services/service_manager/public/cpp/service.h" 126 #include "services/service_manager/public/cpp/service.h"
126 #include "ui/base/l10n/l10n_util.h" 127 #include "ui/base/l10n/l10n_util.h"
127 128
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 SupervisedUserSettingsService* supervised_user_settings = nullptr; 479 SupervisedUserSettingsService* supervised_user_settings = nullptr;
479 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 480 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
480 supervised_user_settings = 481 supervised_user_settings =
481 SupervisedUserSettingsServiceFactory::GetForProfile(this); 482 SupervisedUserSettingsServiceFactory::GetForProfile(this);
482 supervised_user_settings->Init( 483 supervised_user_settings->Init(
483 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); 484 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS);
484 #endif 485 #endif
485 486
486 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( 487 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service(
487 g_browser_process->safe_browsing_service()); 488 g_browser_process->safe_browsing_service());
489 prefs::mojom::TrackedPreferenceValidationDelegatePtr pref_validation_delegate;
488 if (safe_browsing_service.get()) { 490 if (safe_browsing_service.get()) {
489 pref_validation_delegate_ = 491 auto pref_validation_delegate_impl =
490 safe_browsing_service->CreatePreferenceValidationDelegate(this); 492 safe_browsing_service->CreatePreferenceValidationDelegate(this);
493 if (pref_validation_delegate_impl) {
494 mojo::MakeStrongBinding(std::move(pref_validation_delegate_impl),
495 mojo::MakeRequest(&pref_validation_delegate));
496 }
491 } 497 }
492 498
493 content::BrowserContext::Initialize(this, path_); 499 content::BrowserContext::Initialize(this, path_);
494 500
495 { 501 {
496 service_manager::Connector* connector = nullptr; 502 service_manager::Connector* connector = nullptr;
497 if (features::PrefServiceEnabled()) { 503 if (features::PrefServiceEnabled()) {
498 connector = content::BrowserContext::GetConnectorFor(this); 504 connector = content::BrowserContext::GetConnectorFor(this);
499 } 505 }
500 prefs_ = chrome_prefs::CreateProfilePrefs( 506 prefs_ = chrome_prefs::CreateProfilePrefs(
501 path_, sequenced_task_runner, pref_validation_delegate_.get(), 507 path_, std::move(pref_validation_delegate),
502 profile_policy_connector_->policy_service(), supervised_user_settings, 508 profile_policy_connector_->policy_service(), supervised_user_settings,
503 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs, 509 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs,
504 connector); 510 connector);
505 // Register on BrowserContext. 511 // Register on BrowserContext.
506 user_prefs::UserPrefs::Set(this, prefs_.get()); 512 user_prefs::UserPrefs::Set(this, prefs_.get());
507 } 513 }
508 514
509 if (async_prefs) { 515 if (async_prefs) {
510 // Wait for the notification that prefs has been loaded 516 // Wait for the notification that prefs has been loaded
511 // (successfully or not). Note that we can use base::Unretained 517 // (successfully or not). Note that we can use base::Unretained
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); 1350 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>();
1345 1351
1346 return service->CreateMonitor( 1352 return service->CreateMonitor(
1347 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); 1353 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
1348 } 1354 }
1349 1355
1350 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { 1356 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() {
1351 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); 1357 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this);
1352 return base::MakeUnique<identity::IdentityService>(signin_manager); 1358 return base::MakeUnique<identity::IdentityService>(signin_manager);
1353 } 1359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698