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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 2860683002: WIP: Pref service: use the incognito support from Chrome
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/off_the_record_profile_impl.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index bb8a7557554ea261270e17ea527822bee0cde027..2d3a179df3c40b62406700341097a94dd6faaea8 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -14,6 +14,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "build/build_config.h"
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/background_sync/background_sync_controller_factory.h"
@@ -31,6 +32,7 @@
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_prefs.h"
+#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service_syncable_util.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -40,6 +42,7 @@
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/features.h"
@@ -60,6 +63,9 @@
#include "net/http/http_server_properties.h"
#include "net/http/transport_security_state.h"
#include "ppapi/features/features.h"
+#include "services/preferences/public/cpp/pref_service_main.h"
+#include "services/preferences/public/interfaces/preferences.mojom.h"
+#include "services/service_manager/public/cpp/service.h"
#include "storage/browser/database/database_tracker.h"
#if defined(OS_ANDROID)
@@ -115,9 +121,15 @@ void NotifyOTRProfileDestroyedOnIOThread(void* original_profile,
OffTheRecordProfileImpl::OffTheRecordProfileImpl(Profile* real_profile)
: profile_(real_profile),
- prefs_(PrefServiceSyncableIncognitoFromProfile(real_profile)),
start_time_(Time::Now()) {
+ // Must happen before we ask for prefs as prefs needs the connection to the
+ // service manager, which is set up in Initialize.
BrowserContext::Initialize(this, profile_->GetPath());
+ service_manager::Connector* otr_connector = nullptr;
+ if (features::PrefServiceEnabled()) {
+ otr_connector = content::BrowserContext::GetConnectorFor(this);
+ }
+ prefs_ = real_profile->CreateOffTheRecordPrefs(otr_connector);
// Register on BrowserContext.
user_prefs::UserPrefs::Set(this, prefs_);
}
@@ -337,6 +349,20 @@ OffTheRecordProfileImpl::CreateMediaRequestContextForStoragePartition(
.get();
}
+void OffTheRecordProfileImpl::RegisterInProcessServices(
+ StaticServiceMap* services) {
+ if (features::PrefServiceEnabled()) {
+ content::ServiceInfo info;
+ info.factory = base::Bind(
+ // &prefs::CreatePrefService, std::move(expected),
+ &prefs::CreatePrefService, chrome::ExpectedIncognitoPrefStores(),
+ make_scoped_refptr(content::BrowserThread::GetBlockingPool()));
+ info.task_runner = content::BrowserThread::GetTaskRunnerForThread(
+ content::BrowserThread::IO);
+ services->insert(std::make_pair(prefs::mojom::kServiceName, info));
+ }
+}
+
net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
return GetDefaultStoragePartition(this)->GetURLRequestContext();
}
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698