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

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

Issue 557633002: Add public API generation with cr.makePublic() and handle it in compiler pass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_3
Patch Set: manually handle exported methods declared in base class Created 6 years, 3 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 = { 12 var NetworkPredictionOptions = {
13 ALWAYS: 0, 13 ALWAYS: 0,
14 WIFI_ONLY: 1, 14 WIFI_ONLY: 1,
15 NEVER: 2, 15 NEVER: 2,
16 UNSET: 3, 16 UNSET: 3,
17 DEFAULT: 1 17 DEFAULT: 1
18 }; 18 };
19 19
20 // 20 /**
21 // BrowserOptions class 21 * Encapsulated handling of browser options page.
22 // Encapsulated handling of browser options page. 22 * @constructor
23 // 23 * @extends {cr.ui.pageManager.Page}
24 */
24 function BrowserOptions() { 25 function BrowserOptions() {
25 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'), 26 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'),
26 'settings'); 27 'settings');
27 } 28 }
28 29
29 cr.addSingletonGetter(BrowserOptions); 30 cr.addSingletonGetter(BrowserOptions);
30 31
31 /** 32 /**
32 * @param {HTMLElement} section The section to show or hide. 33 * @param {HTMLElement} section The section to show or hide.
33 * @return {boolean} Whether the section should be shown. 34 * @return {boolean} Whether the section should be shown.
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1422
1422 /** 1423 /**
1423 * Propmpts user to confirm deletion of the profile for this browser 1424 * Propmpts user to confirm deletion of the profile for this browser
1424 * window. 1425 * window.
1425 * @private 1426 * @private
1426 */ 1427 */
1427 deleteCurrentProfile_: function() { 1428 deleteCurrentProfile_: function() {
1428 ManageProfileOverlay.showDeleteDialog(this.getCurrentProfile_()); 1429 ManageProfileOverlay.showDeleteDialog(this.getCurrentProfile_());
1429 }, 1430 },
1430 1431
1432 /**
1433 * @param {boolean} enabled
1434 */
1431 setNativeThemeButtonEnabled_: function(enabled) { 1435 setNativeThemeButtonEnabled_: function(enabled) {
1432 var button = $('themes-native-button'); 1436 var button = $('themes-native-button');
1433 if (button) 1437 if (button)
1434 button.disabled = !enabled; 1438 button.disabled = !enabled;
1435 }, 1439 },
1436 1440
1441 /**
1442 * @param {boolean} enabled
1443 */
1437 setThemesResetButtonEnabled_: function(enabled) { 1444 setThemesResetButtonEnabled_: function(enabled) {
1438 $('themes-reset').disabled = !enabled; 1445 $('themes-reset').disabled = !enabled;
1439 }, 1446 },
1440 1447
1448 /**
1449 * @param {boolean} managed
1450 */
1441 setAccountPictureManaged_: function(managed) { 1451 setAccountPictureManaged_: function(managed) {
1442 var picture = $('account-picture'); 1452 var picture = $('account-picture');
1443 if (managed || UIAccountTweaks.loggedInAsGuest()) { 1453 if (managed || UIAccountTweaks.loggedInAsGuest()) {
1444 picture.disabled = true; 1454 picture.disabled = true;
1445 ChangePictureOptions.closeOverlay(); 1455 ChangePictureOptions.closeOverlay();
1446 } else { 1456 } else {
1447 picture.disabled = false; 1457 picture.disabled = false;
1448 } 1458 }
1449 1459
1450 // Create a synthetic pref change event decorated as 1460 // Create a synthetic pref change event decorated as
(...skipping 11 matching lines...) Expand all
1462 * @private 1472 * @private
1463 */ 1473 */
1464 updateAccountPicture_: function() { 1474 updateAccountPicture_: function() {
1465 var picture = $('account-picture'); 1475 var picture = $('account-picture');
1466 if (picture) { 1476 if (picture) {
1467 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + 1477 picture.src = 'chrome://userimage/' + this.username_ + '?id=' +
1468 Date.now(); 1478 Date.now();
1469 } 1479 }
1470 }, 1480 },
1471 1481
1482 /**
1483 * @param {boolean} managed
1484 */
1472 setWallpaperManaged_: function(managed) { 1485 setWallpaperManaged_: function(managed) {
1473 var button = $('set-wallpaper'); 1486 var button = $('set-wallpaper');
1474 button.disabled = !!managed; 1487 button.disabled = !!managed;
1475 1488
1476 // Create a synthetic pref change event decorated as 1489 // Create a synthetic pref change event decorated as
1477 // CoreOptionsHandler::CreateValueForPref() does. 1490 // CoreOptionsHandler::CreateValueForPref() does.
1478 var event = new Event('wallpaper'); 1491 var event = new Event('wallpaper');
1479 if (managed) 1492 if (managed)
1480 event.value = { controlledBy: 'policy' }; 1493 event.value = { controlledBy: 'policy' };
1481 else 1494 else
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 1918
1906 /** 1919 /**
1907 * Handle the 'set date and time' button click. 1920 * Handle the 'set date and time' button click.
1908 * @private 1921 * @private
1909 */ 1922 */
1910 handleSetTime_: function() { 1923 handleSetTime_: function() {
1911 chrome.send('showSetTime'); 1924 chrome.send('showSetTime');
1912 }, 1925 },
1913 }; 1926 };
1914 1927
1928 /**
1929 * Fake declaration made for Closure Compiler. Actual method definition is
1930 * in the base class.
1931 * @param {Array} pages List of startup pages.
1932 * @private
1933 */
1934 BrowserOptions.prototype.updateStartupPages_;
Dan Beam 2014/09/10 19:26:27 please minimize the amount of useless code we writ
Vitaly Pavlenko 2014/09/10 20:25:21 For this feature I need exactly these three fake d
Tyler Breisacher (Chromium) 2014/09/10 20:50:32 Hang on, if this is a private method of the base c
Dan Beam 2014/09/10 21:08:19 see other comments on this review
Dan Beam 2014/09/12 00:57:51 no, if possible, don't add them
Vitaly Pavlenko 2014/09/12 18:38:07 Ok, then I'd like to remove that as a dead code :)
1935
1915 //Forward public APIs to private implementations. 1936 //Forward public APIs to private implementations.
1916 [ 1937 cr.makePublic(BrowserOptions, [
1917 'addBluetoothDevice', 1938 'addBluetoothDevice',
1918 'deleteCurrentProfile', 1939 'deleteCurrentProfile',
1919 'enableCertificateButton', 1940 'enableCertificateButton',
1920 'enableFactoryResetSection', 1941 'enableFactoryResetSection',
1921 'getCurrentProfile', 1942 'getCurrentProfile',
1922 'getStartStopSyncButton', 1943 'getStartStopSyncButton',
1923 'hideBluetoothSettings', 1944 'hideBluetoothSettings',
1924 'notifyInitializationComplete', 1945 'notifyInitializationComplete',
1925 'removeBluetoothDevice', 1946 'removeBluetoothDevice',
1926 'scrollToSection', 1947 'scrollToSection',
(...skipping 26 matching lines...) Expand all
1953 'showTouchpadControls', 1974 'showTouchpadControls',
1954 'toggleExtensionIndicators', 1975 'toggleExtensionIndicators',
1955 'updateAccountPicture', 1976 'updateAccountPicture',
1956 'updateAutoLaunchState', 1977 'updateAutoLaunchState',
1957 'updateDefaultBrowserState', 1978 'updateDefaultBrowserState',
1958 'updateEasyUnlock', 1979 'updateEasyUnlock',
1959 'updateManagesSupervisedUsers', 1980 'updateManagesSupervisedUsers',
1960 'updateSearchEngines', 1981 'updateSearchEngines',
1961 'updateStartupPages', 1982 'updateStartupPages',
1962 'updateSyncState', 1983 'updateSyncState',
1963 ].forEach(function(name) { 1984 ]);
1964 BrowserOptions[name] = function() {
1965 var instance = BrowserOptions.getInstance();
1966 return instance[name + '_'].apply(instance, arguments);
1967 };
1968 });
1969 1985
1970 if (cr.isChromeOS) { 1986 if (cr.isChromeOS) {
1971 /** 1987 /**
1972 * Returns username (canonical email) of the user logged in (ChromeOS only). 1988 * Returns username (canonical email) of the user logged in (ChromeOS only).
1973 * @return {string} user email. 1989 * @return {string} user email.
1974 */ 1990 */
1975 // TODO(jhawkins): Investigate the use case for this method. 1991 // TODO(jhawkins): Investigate the use case for this method.
1976 BrowserOptions.getLoggedInUsername = function() { 1992 BrowserOptions.getLoggedInUsername = function() {
1977 return BrowserOptions.getInstance().username_; 1993 return BrowserOptions.getInstance().username_;
1978 }; 1994 };
1979 } 1995 }
1980 1996
1981 // Export 1997 // Export
1982 return { 1998 return {
1983 BrowserOptions: BrowserOptions 1999 BrowserOptions: BrowserOptions
1984 }; 2000 };
1985 }); 2001 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698