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

Unified Diff: chrome/browser/resources/settings/appearance_page/appearance_page.js

Issue 2403353002: MD Settings: Stop calling chrome.settingsPrivate.setDefaultZoomLevel on startup. (Closed)
Patch Set: Address comment. Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/appearance_page/appearance_page.js
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_page/appearance_page.js
index 5b7462bd9315bb65beb987e947d9e0919873dba2..82ee396eee94aaf148a118abea317b99da6aa315 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -31,26 +31,29 @@ Polymer({
notify: true,
},
- /**
- * @private
- */
+ /** @private */
allowResetTheme_: {
notify: true,
type: Boolean,
value: false,
},
- /**
- * @private
- */
+ /** @private */
defaultZoomLevel_: {
notify: true,
type: Object,
- value: function() {
- return {
- type: chrome.settingsPrivate.PrefType.NUMBER,
- };
- },
+ value: {type: chrome.settingsPrivate.PrefType.NUMBER},
Dan Beam 2016/10/11 19:03:23 can we just omit the default value and use: defau
dpapad 2016/10/11 19:33:06 Unfortunately that only works when you are setting
Dan Beam 2016/10/11 19:34:48 and the problem with that is what?
Dan Beam 2016/10/11 19:35:50 i.e. why not just change this code:
dpapad 2016/10/11 19:43:24 The problem is that settings-dropdown-menu does no
Dan Beam 2016/10/12 23:56:20 does this work? this.defaultZoomLevel_ = {...}; t
+ },
+
+ /**
+ * Needed such that the |defaultZoomLevel_| pref can be initialized
+ * without unnecessarily invoking
+ * chrome.settingsPrivate.setDefaultZoomPercent().
+ * @private
+ */
+ defaultZoomLevelInitialized_: {
Dan Beam 2016/10/11 19:03:23 fyi, some polymer peeps asked me to use vanilla pr
dpapad 2016/10/11 19:33:06 Done. I was thinking about this myself.
+ type: Boolean,
+ value: false,
},
/**
@@ -213,6 +216,14 @@ Polymer({
// The |percent| may be undefined on startup.
if (percent === undefined)
return;
+
+ if (!this.defaultZoomLevelInitialized_) {
+ // Simply mark this pref as initialized, no actual change was requested by
+ // the user.
+ this.defaultZoomLevelInitialized_ = true;
+ return;
+ }
+
chrome.settingsPrivate.setDefaultZoomPercent(percent);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698