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

Side by Side Diff: chrome/browser/resources/settings/appearance_page/appearance_page.js

Issue 1437543003: [MD settings] adding page zoom options to appearnce settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@appearance50o
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * 'settings-appearance-page' is the settings page containing appearance 6 * 'settings-appearance-page' is the settings page containing appearance
7 * settings. 7 * settings.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 12 matching lines...) Expand all
23 properties: { 23 properties: {
24 /** 24 /**
25 * The current active route. 25 * The current active route.
26 */ 26 */
27 currentRoute: { 27 currentRoute: {
28 notify: true, 28 notify: true,
29 type: Object, 29 type: Object,
30 }, 30 },
31 31
32 /** 32 /**
33 * Preferences state.
34 */
35 prefs: {
36 type: Object,
37 notify: true,
38 },
39
40 /**
33 * @private 41 * @private
34 */ 42 */
35 allowResetTheme_: { 43 allowResetTheme_: {
36 notify: true, 44 notify: true,
37 type: Boolean, 45 type: Boolean,
38 value: false, 46 value: false,
39 }, 47 },
40 48
41 /** 49 /**
50 * @private
51 */
52 defaultZoomLevel_: {
53 notify: true,
54 type: Object,
55 value: function() {
56 return {value: undefined};
57 },
58 },
59
60 /**
42 * List of options for the font size drop-down menu. 61 * List of options for the font size drop-down menu.
43 * The order of entries in this array matches the 62 * The order of entries in this array matches the
44 * prefs.browser.clear_data.time_period.value enum. 63 * prefs.browser.clear_data.time_period.value enum.
45 * @private {!Array<!Array<{0: number, 1: string}>>} 64 * @private {!Array<!Array<number, string>>}
46 */ 65 */
47 fontSizeOptions_: { 66 fontSizeOptions_: {
48 readOnly: true, 67 readOnly: true,
49 type: Array, 68 type: Array,
50 value: function() { 69 value: function() {
51 return [ 70 return [
52 [9, loadTimeData.getString('verySmall')], 71 [9, loadTimeData.getString('verySmall')],
53 [12, loadTimeData.getString('small')], 72 [12, loadTimeData.getString('small')],
54 [16, loadTimeData.getString('medium')], 73 [16, loadTimeData.getString('medium')],
55 [20, loadTimeData.getString('large')], 74 [20, loadTimeData.getString('large')],
56 [24, loadTimeData.getString('veryLarge')], 75 [24, loadTimeData.getString('veryLarge')],
57 ]; 76 ];
58 }, 77 },
59 }, 78 },
79
80 /**
81 * List of options for the page zoom drop-down menu.
82 * The order of entries in this array matches the
83 * prefs.browser.clear_data.time_period.value enum.
michaelpg 2015/11/09 23:59:45 wat
dschuyler 2015/11/10 20:03:39 The same could apply to the fontSizeOptions_ above
84 * @private {!Array<!Array<number, string>>}
85 */
86 pageZoomOptions_: {
87 readOnly: true,
88 type: Array,
89 value: [
90 [25, '25%'],
91 [33, '33%'],
92 [50, '50%'],
93 [67, '67%'],
94 [75, '75%'],
95 [90, '90%'],
96 [100, '100%'],
97 [110, '110%'],
98 [125, '125%'],
99 [150, '150%'],
100 [175, '175%'],
101 [200, '200%'],
102 [300, '300%'],
103 [400, '400%'],
104 [500, '500%'],
105 ],
106 },
60 }, 107 },
61 108
62 behaviors: [ 109 behaviors: [
63 I18nBehavior, 110 I18nBehavior,
64 ], 111 ],
65 112
113 observers: [
114 'zoomLevelChanged_(defaultZoomLevel_.value)',
115 ],
116
66 ready: function() { 117 ready: function() {
67 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 118 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
119 this.$.pageZoom.menuOptions = this.pageZoomOptions_;
120 chrome.settingsPrivate.getDefaultZoomPercent(
121 this.zoomPrefChanged_.bind(this));
68 }, 122 },
69 123
70 /** @override */ 124 /** @override */
71 attached: function() { 125 attached: function() {
72 // Query the initial state. 126 // Query the initial state.
73 cr.sendWithCallback('getResetThemeEnabled', undefined, 127 cr.sendWithCallback('getResetThemeEnabled', undefined,
74 this.setResetThemeEnabled.bind(this)); 128 this.setResetThemeEnabled.bind(this));
75 129
76 // Set up the change event listener. 130 // Set up the change event listener.
77 cr.addWebUIListener('reset-theme-enabled-changed', 131 cr.addWebUIListener('reset-theme-enabled-changed',
78 this.setResetThemeEnabled.bind(this)); 132 this.setResetThemeEnabled.bind(this));
79 }, 133 },
80 134
81 /** 135 /**
82 * @param {boolean} enabled Whether the theme reset is available. 136 * @param {boolean} enabled Whether the theme reset is available.
83 */ 137 */
84 setResetThemeEnabled: function(enabled) { 138 setResetThemeEnabled: function(enabled) {
85 this.allowResetTheme_ = enabled; 139 this.allowResetTheme_ = enabled;
86 }, 140 },
87 141
88 /** @private */ 142 /** @private */
89 onCustomizeFontsTap_: function() { 143 onCustomizeFontsTap_: function() {
90 this.$.pages.setSubpageChain(['appearance-fonts']); 144 this.$.pages.setSubpageChain(['appearance-fonts']);
91 }, 145 },
92 146
93 /** @private */ 147 /** @private */
148 onCustomizeFontsTap_: function() {
michaelpg 2015/11/09 23:59:45 wat
dschuyler 2015/11/10 20:03:39 I seem to have had some trouble merging code. Don
Dan Beam 2015/11/10 22:21:26 the review tools, turns out, can still be used to
149 this.$.pages.setSubpageChain(['appearance-fonts']);
150 },
151
152 /** @private */
94 openThemesGallery_: function() { 153 openThemesGallery_: function() {
95 window.open(loadTimeData.getString('themesGalleryUrl')); 154 window.open(loadTimeData.getString('themesGalleryUrl'));
96 }, 155 },
97 156
98 /** @private */ 157 /** @private */
99 resetTheme_: function() { 158 resetTheme_: function() {
100 chrome.send('resetTheme'); 159 chrome.send('resetTheme');
101 }, 160 },
161
162 zoomPrefChanged_: function(percent) {
163 this.set('defaultZoomLevel_.value', percent);
164 },
165
166 zoomLevelChanged_: function(percent) {
167 // The |percent| may be undefined on startup.
168 if (percent === undefined)
169 return;
170 chrome.settingsPrivate.setDefaultZoomPercent(percent);
171 },
102 }); 172 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698