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

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 421653006: Update "Predict network actions" UI setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var Page = cr.ui.pageManager.Page; 7 var Page = cr.ui.pageManager.Page;
8 var PageManager = cr.ui.pageManager.PageManager; 8 var PageManager = cr.ui.pageManager.PageManager;
9 var ArrayDataModel = cr.ui.ArrayDataModel; 9 var ArrayDataModel = cr.ui.ArrayDataModel;
10 var RepeatingButton = cr.ui.RepeatingButton; 10 var RepeatingButton = cr.ui.RepeatingButton;
11 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; 11 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator;
12 var NetworkPredictionOptions = {
13 ALWAYS: 0,
14 WIFI_ONLY: 1,
15 NEVER: 2,
16 UNSET: 3,
17 DEFAULT: 1
18 };
12 19
13 // 20 //
14 // BrowserOptions class 21 // BrowserOptions class
15 // Encapsulated handling of browser options page. 22 // Encapsulated handling of browser options page.
16 // 23 //
17 function BrowserOptions() { 24 function BrowserOptions() {
18 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'), 25 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'),
19 'settings'); 26 'settings');
20 } 27 }
21 28
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 var updateMetricsRestartButton = function() { 377 var updateMetricsRestartButton = function() {
371 $('metrics-reporting-reset-restart').hidden = 378 $('metrics-reporting-reset-restart').hidden =
372 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == 379 loadTimeData.getBoolean('metricsReportingEnabledAtStart') ==
373 $('metricsReportingEnabled').checked; 380 $('metricsReportingEnabled').checked;
374 }; 381 };
375 Preferences.getInstance().addEventListener( 382 Preferences.getInstance().addEventListener(
376 $('metricsReportingEnabled').getAttribute('pref'), 383 $('metricsReportingEnabled').getAttribute('pref'),
377 updateMetricsRestartButton); 384 updateMetricsRestartButton);
378 updateMetricsRestartButton(); 385 updateMetricsRestartButton();
379 } 386 }
387 $('networkPredictionOptions').onchange = function(event) {
388 var value = (event.target.checked ?
389 NetworkPredictionOptions.WIFI_ONLY :
390 NetworkPredictionOptions.NEVER);
391 var metric = event.target.metric;
392 Preferences.setIntegerPref(
393 'net.network_prediction_options',
394 value,
395 true,
396 metric);
397 };
380 398
381 // Bluetooth (CrOS only). 399 // Bluetooth (CrOS only).
382 if (cr.isChromeOS) { 400 if (cr.isChromeOS) {
383 options.system.bluetooth.BluetoothDeviceList.decorate( 401 options.system.bluetooth.BluetoothDeviceList.decorate(
384 $('bluetooth-paired-devices-list')); 402 $('bluetooth-paired-devices-list'));
385 403
386 $('bluetooth-add-device').onclick = 404 $('bluetooth-add-device').onclick =
387 this.handleAddBluetoothDevice_.bind(this); 405 this.handleAddBluetoothDevice_.bind(this);
388 406
389 $('enable-bluetooth').onchange = function(event) { 407 $('enable-bluetooth').onchange = function(event) {
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 * @private 1496 * @private
1479 */ 1497 */
1480 setMetricsReportingSettingVisibility_: function(visible) { 1498 setMetricsReportingSettingVisibility_: function(visible) {
1481 if (visible) 1499 if (visible)
1482 $('metricsReportingSetting').style.display = 'block'; 1500 $('metricsReportingSetting').style.display = 'block';
1483 else 1501 else
1484 $('metricsReportingSetting').style.display = 'none'; 1502 $('metricsReportingSetting').style.display = 'none';
1485 }, 1503 },
1486 1504
1487 /** 1505 /**
1506 * Set network prediction checkbox value.
1507 *
1508 * @param {Object} pref Information about network prediction options.
1509 * @param {number} pref.value The value of network prediction options.
1510 * @param {boolean} pref.disabled If the pref is not user modifiable.
1511 * @private
1512 */
1513 setNetworkPredictionValue_: function(pref) {
1514 var checkbox = $('networkPredictionOptions');
1515 checkbox.disabled = pref.disabled;
1516 if (pref.value == NetworkPredictionOptions.UNSET) {
1517 checkbox.checked = !(NetworkPredictionOptions.DEFAULT ==
stevenjb 2014/08/05 15:51:56 DEFAULT != NEVER
Bence 2014/08/06 19:38:16 Done.
1518 NetworkPredictionOptions.NEVER);
1519 } else {
1520 checkbox.checked = !(pref.value == NetworkPredictionOptions.NEVER);
stevenjb 2014/08/05 15:51:56 value != NEVER
Bence 2014/08/06 19:38:16 Done.
1521 }
1522 },
1523
1524 /**
1488 * Set the font size selected item. This item actually reflects two 1525 * Set the font size selected item. This item actually reflects two
1489 * preferences: the default font size and the default fixed font size. 1526 * preferences: the default font size and the default fixed font size.
1490 * 1527 *
1491 * @param {Object} pref Information about the font size preferences. 1528 * @param {Object} pref Information about the font size preferences.
1492 * @param {number} pref.value The value of the default font size pref. 1529 * @param {number} pref.value The value of the default font size pref.
1493 * @param {boolean} pref.disabled True if either pref not user modifiable. 1530 * @param {boolean} pref.disabled True if either pref not user modifiable.
1494 * @param {string} pref.controlledBy The source of the pref value(s) if 1531 * @param {string} pref.controlledBy The source of the pref value(s) if
1495 * either pref is currently not controlled by the user. 1532 * either pref is currently not controlled by the user.
1496 * @private 1533 * @private
1497 */ 1534 */
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 'notifyInitializationComplete', 1897 'notifyInitializationComplete',
1861 'removeBluetoothDevice', 1898 'removeBluetoothDevice',
1862 'scrollToSection', 1899 'scrollToSection',
1863 'setAccountPictureManaged', 1900 'setAccountPictureManaged',
1864 'setWallpaperManaged', 1901 'setWallpaperManaged',
1865 'setAutoOpenFileTypesDisplayed', 1902 'setAutoOpenFileTypesDisplayed',
1866 'setBluetoothState', 1903 'setBluetoothState',
1867 'setCanSetTime', 1904 'setCanSetTime',
1868 'setFontSize', 1905 'setFontSize',
1869 'setNativeThemeButtonEnabled', 1906 'setNativeThemeButtonEnabled',
1907 'setNetworkPredictionValue',
1870 'setHighContrastCheckboxState', 1908 'setHighContrastCheckboxState',
1871 'setMetricsReportingCheckboxState', 1909 'setMetricsReportingCheckboxState',
1872 'setMetricsReportingSettingVisibility', 1910 'setMetricsReportingSettingVisibility',
1873 'setProfilesInfo', 1911 'setProfilesInfo',
1874 'setSpokenFeedbackCheckboxState', 1912 'setSpokenFeedbackCheckboxState',
1875 'setThemesResetButtonEnabled', 1913 'setThemesResetButtonEnabled',
1876 'setVirtualKeyboardCheckboxState', 1914 'setVirtualKeyboardCheckboxState',
1877 'setupPageZoomSelector', 1915 'setupPageZoomSelector',
1878 'setupProxySettingsButton', 1916 'setupProxySettingsButton',
1879 'showBluetoothSettings', 1917 'showBluetoothSettings',
(...skipping 30 matching lines...) Expand all
1910 BrowserOptions.getLoggedInUsername = function() { 1948 BrowserOptions.getLoggedInUsername = function() {
1911 return BrowserOptions.getInstance().username_; 1949 return BrowserOptions.getInstance().username_;
1912 }; 1950 };
1913 } 1951 }
1914 1952
1915 // Export 1953 // Export
1916 return { 1954 return {
1917 BrowserOptions: BrowserOptions 1955 BrowserOptions: BrowserOptions
1918 }; 1956 };
1919 }); 1957 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698