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

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: Nit. 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..5789801ebc1581c7caf8b11b8f39d0558ae662c0 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -49,6 +49,9 @@ Polymer({
value: function() {
return {
type: chrome.settingsPrivate.PrefType.NUMBER,
+ /* Needed such that the pref can be initialized without unnecessarily
+ * invoking chrome.settingsPrivate.setDefaultZoomPercent(). */
+ initialized: false,
michaelpg 2016/10/11 03:47:33 We probably shouldn't "overload" this value more t
dpapad 2016/10/11 17:30:17 Done.
};
},
},
@@ -213,6 +216,14 @@ Polymer({
// The |percent| may be undefined on startup.
if (percent === undefined)
return;
+
+ if (!this.defaultZoomLevel_.initialized) {
michaelpg 2016/10/11 03:47:33 Since we only use this here, I wouldn't be averse
dpapad 2016/10/11 17:30:17 What do you mean defining it only here? Here in th
michaelpg 2016/10/11 22:01:10 Oh, I was just saying, this is JS, we don't have t
dpapad 2016/10/11 22:05:54 Ah, got it now. Personally I don't prefer augmenti
+ // Simply mark this pref as initialized, no actual change was requested by
+ // the user.
+ this.defaultZoomLevel_.initialized = 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