Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 {value: 12, name: loadTimeData.getString('small')}, | 47 {value: 12, name: loadTimeData.getString('small')}, |
| 48 {value: 16, name: loadTimeData.getString('medium')}, | 48 {value: 16, name: loadTimeData.getString('medium')}, |
| 49 {value: 20, name: loadTimeData.getString('large')}, | 49 {value: 20, name: loadTimeData.getString('large')}, |
| 50 {value: 24, name: loadTimeData.getString('veryLarge')}, | 50 {value: 24, name: loadTimeData.getString('veryLarge')}, |
| 51 ]; | 51 ]; |
| 52 }, | 52 }, |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * List of options for the page zoom drop-down menu. | 56 * List of options for the page zoom drop-down menu. |
| 57 * @type {!DropdownMenuOptionList} | 57 * @type {!DropdownMenuOptionList} |
|
dpapad
2016/10/15 00:58:07
Type annotation no longer accurate. Should be !Arr
Dan Beam
2016/10/17 19:20:26
Done.
| |
| 58 */ | 58 */ |
| 59 pageZoomOptions_: { | 59 pageZoomLevels_: { |
| 60 readOnly: true, | 60 readOnly: true, |
| 61 type: Array, | 61 type: Array, |
| 62 value: [ | 62 value: [ |
| 63 {value: 25, name: '25%'}, | 63 // TODO(dbeam): get these dynamically from C++ instead. |
| 64 {value: 33, name: '33%'}, | 64 1 / 4, |
| 65 {value: 50, name: '50%'}, | 65 1 / 3, |
|
michaelpg
2016/10/17 08:46:08
when it comes to repeating decimals, is this safe?
Dan Beam
2016/10/17 19:20:26
safe enough, yes
https://cs.chromium.org/chromium/
michaelpg
2016/10/17 19:58:15
ok, that's good. what about the JS side? we popula
Dan Beam
2016/10/17 21:01:20
i understand your concerns.
i think getting these
| |
| 66 {value: 67, name: '67%'}, | 66 1 / 2, |
| 67 {value: 75, name: '75%'}, | 67 2 / 3, |
| 68 {value: 80, name: '80%'}, | 68 3 / 4, |
| 69 {value: 90, name: '90%'}, | 69 4 / 5, |
| 70 {value: 100, name: '100%'}, | 70 9 / 10, |
| 71 {value: 110, name: '110%'}, | 71 1, |
| 72 {value: 125, name: '125%'}, | 72 11 / 10, |
| 73 {value: 150, name: '150%'}, | 73 5 / 4, |
| 74 {value: 175, name: '175%'}, | 74 3 / 2, |
| 75 {value: 200, name: '200%'}, | 75 7 / 4, |
| 76 {value: 250, name: '250%'}, | 76 2, |
| 77 {value: 300, name: '300%'}, | 77 5 / 2, |
| 78 {value: 400, name: '400%'}, | 78 3, |
| 79 {value: 500, name: '500%'}, | 79 4, |
| 80 5, | |
| 80 ], | 81 ], |
| 81 }, | 82 }, |
| 82 | 83 |
| 83 /** @private */ | 84 /** @private */ |
| 84 themeSublabel_: String, | 85 themeSublabel_: String, |
| 85 | 86 |
| 86 /** | 87 /** |
| 87 * Dictionary defining page visibility. | 88 * Dictionary defining page visibility. |
| 88 * @type {!AppearancePageVisibility} | 89 * @type {!AppearancePageVisibility} |
| 89 */ | 90 */ |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 111 // TODO(dschuyler): Look into adding a listener for the | 112 // TODO(dschuyler): Look into adding a listener for the |
| 112 // default zoom percent. | 113 // default zoom percent. |
| 113 chrome.settingsPrivate.getDefaultZoomPercent(function(value) { | 114 chrome.settingsPrivate.getDefaultZoomPercent(function(value) { |
| 114 // TODO(dpapad): Non-integer values will cause no <option> to be selected | 115 // TODO(dpapad): Non-integer values will cause no <option> to be selected |
| 115 // until crbug.com/655742 is addressed. | 116 // until crbug.com/655742 is addressed. |
| 116 this.$.zoomLevel.value = value; | 117 this.$.zoomLevel.value = value; |
| 117 }.bind(this)); | 118 }.bind(this)); |
| 118 }, | 119 }, |
| 119 | 120 |
| 120 /** | 121 /** |
| 122 * @param {number} zoom | |
| 123 * @return {number} A zoom easier read by users. | |
|
dpapad
2016/10/15 00:58:07
@private
michaelpg
2016/10/17 08:46:08
{string} maybe
Dan Beam
2016/10/17 19:20:26
Done.
Dan Beam
2016/10/17 19:20:26
it's not a string
| |
| 124 */ | |
| 125 formatZoom_: function(zoom) { | |
| 126 return Math.round(zoom * 100); | |
|
michaelpg
2016/10/17 08:46:08
return (zoom * 100).toFixed();
Dan Beam
2016/10/17 19:20:26
what's the functional difference? especially for
michaelpg
2016/10/17 19:58:14
toFixed returns a string. it's mathematically equi
| |
| 127 }, | |
| 128 | |
| 129 /** | |
| 121 * @param {boolean} isNtp Whether to use the NTP as the home page. | 130 * @param {boolean} isNtp Whether to use the NTP as the home page. |
| 122 * @param {string} homepage If not using NTP, use this URL. | 131 * @param {string} homepage If not using NTP, use this URL. |
| 123 * @return {string} The sub-label. | 132 * @return {string} The sub-label. |
| 124 * @private | 133 * @private |
| 125 */ | 134 */ |
| 126 getShowHomeSubLabel_: function(isNtp, homepage) { | 135 getShowHomeSubLabel_: function(isNtp, homepage) { |
| 127 if (isNtp) | 136 if (isNtp) |
| 128 return this.i18n('homePageNtp'); | 137 return this.i18n('homePageNtp'); |
| 129 return homepage || this.i18n('exampleDotCom'); | 138 return homepage || this.i18n('exampleDotCom'); |
| 130 }, | 139 }, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 | 234 |
| 226 /** | 235 /** |
| 227 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. | 236 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. |
| 228 * @return {string} 'first' if the argument is false or empty otherwise. | 237 * @return {string} 'first' if the argument is false or empty otherwise. |
| 229 * @private | 238 * @private |
| 230 */ | 239 */ |
| 231 getFirst_: function(bookmarksBarVisible) { | 240 getFirst_: function(bookmarksBarVisible) { |
| 232 return !bookmarksBarVisible ? 'first' : ''; | 241 return !bookmarksBarVisible ? 'first' : ''; |
| 233 } | 242 } |
| 234 }); | 243 }); |
| OLD | NEW |