Chromium Code Reviews| Index: chrome/browser/resources/gesture_config.js |
| diff --git a/chrome/browser/resources/gesture_config.js b/chrome/browser/resources/gesture_config.js |
| index 2b16ad6d5b355dac91ad1dba4c339d294163bc95..23d6a33842ed85d99adb46f69c432c9c6ed44b1d 100644 |
| --- a/chrome/browser/resources/gesture_config.js |
| +++ b/chrome/browser/resources/gesture_config.js |
| @@ -318,6 +318,70 @@ function OverscrollConfig() { |
| } |
| /** |
| + * Returns a GeneralConfig for configuring workspace_cycler.* preferences. |
| + * @return {object} A GeneralConfig object. |
| + */ |
| +function WorkspaceCyclerConfig() { |
| + var WORKSPACE_CYCLER_TITLE = 'Workspace Cycler Configuration'; |
| + |
| + var WORKSPACE_CYCLER_PREFIX = 'workspace_cycler.'; |
| + |
| + var WORKSPACE_CYCLER_FIELDS = [ |
| + { |
| + key: 'selected_scale', |
| + label: 'Scale of the selected workspace', |
| + units: '%' |
| + }, |
| + { |
| + key: 'min_scale', |
| + label: 'Minimum workspace scale (scale of deepest workspace)', |
| + units: '%' |
| + }, |
| + { |
| + key: 'max_scale', |
| + label: 'Maximimum workspace scale (scale of shallowest workspace)', |
| + units: '%' |
| + }, |
| + { |
| + key: 'min_brightness', |
| + label: 'Minimum workspace brightness (deepest & shallowest workspace)', |
| + units: '%' |
| + }, |
| + { |
| + key: 'background_opacity', |
| + label: 'Desktop background opacity when cycling through workspaces', |
| + units: '%' |
| + }, |
| + { |
| + key: 'distance_to_initiate_cycling', |
| + label: 'Vertical distance to scroll to initiate cycling', |
| + units: 'pixels' |
| + }, |
| + { |
| + key: 'scroll_distance_to_cycle_to_next_workspace', |
| + label: 'Vertical distance to scroll to cycle to the next workspace', |
| + units: 'pixels' |
| + }, |
| + { key: 'cycler_step_animation_duration_ratio', |
| + label: 'Cycler step animation duration ratio', |
| + units: 'ms / pixels vertical scroll' |
| + }, |
| + { key: 'start_cycler_animation_duration', |
| + label: 'Duration of the animations to start cycling', |
| + units: 'ms' |
| + }, |
| + { key: 'stop_cycler_animation_duration', |
| + label: 'Duration of the animations to stop cycling', |
| + units: 'ms' |
| + } |
| + ]; |
| + |
| + return new GeneralConfig(WORKSPACE_CYCLER_TITLE, |
| + WORKSPACE_CYCLER_PREFIX, |
| + WORKSPACE_CYCLER_FIELDS); |
| +} |
| + |
| +/** |
| * WebUI instance for configuring gesture.* and overscroll.* preference values |
| * used by Chrome's gesture recognition system. |
| */ |
| @@ -333,6 +397,10 @@ var gesture_config = (function() { |
| var o = OverscrollConfig(); |
| o.buildAll(); |
| + // Asynchronously check whether the workspace cycler configuration should |
| + // be added. If it should be, add it in the callback. |
| + checkShouldAddWorkspaceCyclerConfiguration(); |
| + |
|
sadrul
2013/02/11 16:41:19
This isn't necessary. Just add the config here. Th
|
| $('reset-button').onclick = function() { |
| g.onReset(); |
| o.onReset(); |
| @@ -340,6 +408,15 @@ var gesture_config = (function() { |
| } |
| /** |
| + * Asynchronously checks whether the workspace cycler configuration should |
| + * be added to the form. If it should be, it is added to the form in the |
| + * callback. |
| + */ |
| + function checkShouldAddWorkspaceCyclerConfiguration() { |
| + chrome.send('checkShouldAddWorkspaceCyclerConfiguration'); |
| + } |
| + |
| + /** |
| * Handle callback from call to getPreferenceValue. |
| * @param {string} prefName The name of the requested preference value. |
| * @param {value} value The current value associated with prefName. |
| @@ -349,9 +426,25 @@ var gesture_config = (function() { |
| $(prefName).value = value; |
| } |
| + /** |
| + * Handle callback from call to checkShouldAddWorkspaceCyclerConfiguration. |
| + * @param {bool} should_add Whether the workspace cycler configuration should |
| + * be added to the form. |
| + */ |
| + function checkShouldAddWorkspaceCyclerConfigurationResult(should_add) { |
| + if (should_add) { |
| + var c = WorkspaceCyclerConfig(); |
| + c.buildAll(); |
| + } |
| + } |
| + |
| return { |
| initialize: initialize, |
| - getPreferenceValueResult: getPreferenceValueResult |
| + checkShouldAddWorkspaceCyclerConfiguration: |
| + checkShouldAddWorkspaceCyclerConfiguration, |
| + getPreferenceValueResult: getPreferenceValueResult, |
| + checkShouldAddWorkspaceCyclerConfigurationResult: |
| + checkShouldAddWorkspaceCyclerConfigurationResult |
| }; |
| })(); |