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

Unified Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to PrefRegistrySyncable and PrefServiceSyncable to let sync know of pre-registered prefs. Created 7 years, 10 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
Index: chrome/browser/printing/print_dialog_cloud.cc
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 831cb1f31c0bc4464b5f817d0b52bf82ec8266df..83ccee66c1cb59018f129c58e8e7af9cdeb441d4 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -15,6 +15,7 @@
#include "base/values.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/prefs/pref_registry_syncable.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/profiles/profile.h"
@@ -530,22 +531,25 @@ void GetDialogWidthAndHeightFromPrefs(content::BrowserContext* browser_context,
return;
}
- Profile* profile = Profile::FromBrowserContext(browser_context);
- if (!profile->GetPrefs()->FindPreference(prefs::kCloudPrintDialogWidth)) {
- profile->GetPrefs()->RegisterIntegerPref(
+ // TODO(joi): Do registration up front.
+ PrefService* prefs = Profile::FromBrowserContext(browser_context)->GetPrefs();
+ scoped_refptr<PrefRegistrySyncable> registry(
+ static_cast<PrefRegistrySyncable*>(prefs->DeprecatedGetPrefRegistry()));
+ if (!prefs->FindPreference(prefs::kCloudPrintDialogWidth)) {
+ registry->RegisterIntegerPref(
prefs::kCloudPrintDialogWidth,
kDefaultWidth,
- PrefServiceSyncable::UNSYNCABLE_PREF);
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
}
- if (!profile->GetPrefs()->FindPreference(prefs::kCloudPrintDialogHeight)) {
- profile->GetPrefs()->RegisterIntegerPref(
+ if (!prefs->FindPreference(prefs::kCloudPrintDialogHeight)) {
+ registry->RegisterIntegerPref(
prefs::kCloudPrintDialogHeight,
kDefaultHeight,
- PrefServiceSyncable::UNSYNCABLE_PREF);
+ PrefRegistrySyncable::UNSYNCABLE_PREF);
}
- *width = profile->GetPrefs()->GetInteger(prefs::kCloudPrintDialogWidth);
- *height = profile->GetPrefs()->GetInteger(prefs::kCloudPrintDialogHeight);
+ *width = prefs->GetInteger(prefs::kCloudPrintDialogWidth);
+ *height = prefs->GetInteger(prefs::kCloudPrintDialogHeight);
}
void CloudPrintWebDialogDelegate::Init(content::BrowserContext* browser_context,

Powered by Google App Engine
This is Rietveld 408576698