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

Unified Diff: android_webview/browser/aw_browser_context.cc

Issue 64193003: Clean up PrefServiceBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory ownership bug in ProxyPolicyTest Created 7 years, 1 month 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 | « android_webview/browser/aw_browser_context.h ('k') | android_webview/native/aw_autofill_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_browser_context.cc
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index 70c25070c6a1b542edfeb774a14fb51c54764d2b..2c83ef0b80c0971fb1409af70e756768f4f20d3b 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -15,7 +15,7 @@
#include "base/files/file_path.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
-#include "base/prefs/pref_service_builder.h"
+#include "base/prefs/pref_service_factory.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/sequenced_worker_pool.h"
#include "components/autofill/core/common/autofill_pref_names.h"
@@ -98,8 +98,7 @@ AwBrowserContext::AwBrowserContext(
const FilePath path,
JniDependencyFactory* native_factory)
: context_storage_path_(path),
- native_factory_(native_factory),
- user_pref_service_ready_(false) {
+ native_factory_(native_factory) {
DCHECK(g_browser_context == NULL);
g_browser_context = this;
@@ -199,10 +198,9 @@ AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() {
// Create user pref service for autofill functionality.
void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
- if (user_pref_service_ready_)
+ if (user_pref_service_)
return;
- user_pref_service_ready_ = true;
PrefRegistrySimple* pref_registry = new PrefRegistrySimple();
// We only use the autocomplete feature of the Autofill, which is
// controlled via the manager_delegate. We don't use the rest
@@ -214,12 +212,12 @@ void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
pref_registry->RegisterDoublePref(
autofill::prefs::kAutofillNegativeUploadRate, 0.0);
- PrefServiceBuilder pref_service_builder;
- pref_service_builder.WithUserPrefs(new AwPrefStore());
- pref_service_builder.WithReadErrorCallback(base::Bind(&HandleReadError));
+ base::PrefServiceFactory pref_service_factory;
+ pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore()));
+ pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError));
+ user_pref_service_ = pref_service_factory.Create(pref_registry).Pass();
- user_prefs::UserPrefs::Set(this,
- pref_service_builder.Create(pref_registry));
+ user_prefs::UserPrefs::Set(this, user_pref_service_.get());
}
base::FilePath AwBrowserContext::GetPath() const {
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | android_webview/native/aw_autofill_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698