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

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

Issue 2740493002: Pref service: create service at browser startup (Closed)
Patch Set: Rename the capability provided by the service Created 3 years, 9 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "chrome/browser/push_messaging/push_messaging_service_factory.h" 69 #include "chrome/browser/push_messaging/push_messaging_service_factory.h"
70 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" 70 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
71 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 71 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
72 #include "chrome/browser/sessions/session_service_factory.h" 72 #include "chrome/browser/sessions/session_service_factory.h"
73 #include "chrome/browser/signin/signin_manager_factory.h" 73 #include "chrome/browser/signin/signin_manager_factory.h"
74 #include "chrome/browser/signin/signin_ui_util.h" 74 #include "chrome/browser/signin/signin_ui_util.h"
75 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 75 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
76 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 76 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
77 #include "chrome/browser/ui/startup/startup_browser_creator.h" 77 #include "chrome/browser/ui/startup/startup_browser_creator.h"
78 #include "chrome/common/chrome_constants.h" 78 #include "chrome/common/chrome_constants.h"
79 #include "chrome/common/chrome_features.h"
79 #include "chrome/common/chrome_paths.h" 80 #include "chrome/common/chrome_paths.h"
80 #include "chrome/common/chrome_paths_internal.h" 81 #include "chrome/common/chrome_paths_internal.h"
81 #include "chrome/common/chrome_switches.h" 82 #include "chrome/common/chrome_switches.h"
82 #include "chrome/common/features.h" 83 #include "chrome/common/features.h"
83 #include "chrome/common/pref_names.h" 84 #include "chrome/common/pref_names.h"
84 #include "chrome/common/url_constants.h" 85 #include "chrome/common/url_constants.h"
85 #include "chrome/grit/chromium_strings.h" 86 #include "chrome/grit/chromium_strings.h"
86 #include "components/bookmarks/browser/bookmark_model.h" 87 #include "components/bookmarks/browser/bookmark_model.h"
87 #include "components/content_settings/core/browser/cookie_settings.h" 88 #include "components/content_settings/core/browser/cookie_settings.h"
88 #include "components/content_settings/core/browser/host_content_settings_map.h" 89 #include "components/content_settings/core/browser/host_content_settings_map.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( 482 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service(
482 g_browser_process->safe_browsing_service()); 483 g_browser_process->safe_browsing_service());
483 if (safe_browsing_service.get()) { 484 if (safe_browsing_service.get()) {
484 pref_validation_delegate_ = 485 pref_validation_delegate_ =
485 safe_browsing_service->CreatePreferenceValidationDelegate(this); 486 safe_browsing_service->CreatePreferenceValidationDelegate(this);
486 } 487 }
487 488
488 content::BrowserContext::Initialize(this, path_); 489 content::BrowserContext::Initialize(this, path_);
489 490
490 { 491 {
492 service_manager::Connector* connector = nullptr;
493 if (base::FeatureList::IsEnabled(features::kPrefService)) {
494 connector = content::BrowserContext::GetConnectorFor(this);
495 }
491 prefs_ = chrome_prefs::CreateProfilePrefs( 496 prefs_ = chrome_prefs::CreateProfilePrefs(
492 path_, sequenced_task_runner, pref_validation_delegate_.get(), 497 path_, sequenced_task_runner, pref_validation_delegate_.get(),
493 profile_policy_connector_->policy_service(), supervised_user_settings, 498 profile_policy_connector_->policy_service(), supervised_user_settings,
494 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs); 499 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs,
500 connector);
495 // Register on BrowserContext. 501 // Register on BrowserContext.
496 user_prefs::UserPrefs::Set(this, prefs_.get()); 502 user_prefs::UserPrefs::Set(this, prefs_.get());
497 } 503 }
498 504
499 if (async_prefs) { 505 if (async_prefs) {
500 // Wait for the notification that prefs has been loaded 506 // Wait for the notification that prefs has been loaded
501 // (successfully or not). Note that we can use base::Unretained 507 // (successfully or not). Note that we can use base::Unretained
502 // because the PrefService is owned by this class and lives on 508 // because the PrefService is owned by this class and lives on
503 // the same thread. 509 // the same thread.
504 prefs_->AddPrefInitObserver(base::Bind( 510 prefs_->AddPrefInitObserver(base::Bind(
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { 1298 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
1293 domain_reliability::DomainReliabilityService* service = 1299 domain_reliability::DomainReliabilityService* service =
1294 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1300 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1295 GetForBrowserContext(this); 1301 GetForBrowserContext(this);
1296 if (!service) 1302 if (!service)
1297 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); 1303 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>();
1298 1304
1299 return service->CreateMonitor( 1305 return service->CreateMonitor(
1300 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); 1306 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
1301 } 1307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698