| OLD | NEW |
| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * childUser: (boolean|undefined), | 9 * childUser: (boolean|undefined), |
| 10 * hasError: (boolean|undefined), | 10 * hasError: (boolean|undefined), |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 429 } |
| 430 | 430 |
| 431 // Default browser section. | 431 // Default browser section. |
| 432 if (!cr.isChromeOS) { | 432 if (!cr.isChromeOS) { |
| 433 if (!loadTimeData.getBoolean('showSetDefault')) { | 433 if (!loadTimeData.getBoolean('showSetDefault')) { |
| 434 $('set-default-browser-section').hidden = true; | 434 $('set-default-browser-section').hidden = true; |
| 435 } | 435 } |
| 436 $('set-as-default-browser').onclick = function(event) { | 436 $('set-as-default-browser').onclick = function(event) { |
| 437 chrome.send('becomeDefaultBrowser'); | 437 chrome.send('becomeDefaultBrowser'); |
| 438 }; | 438 }; |
| 439 | |
| 440 $('auto-launch').onclick = this.handleAutoLaunchChanged_; | |
| 441 } | 439 } |
| 442 | 440 |
| 443 // Privacy section. | 441 // Privacy section. |
| 444 $('privacyContentSettingsButton').onclick = function(event) { | 442 $('privacyContentSettingsButton').onclick = function(event) { |
| 445 PageManager.showPageByName('content'); | 443 PageManager.showPageByName('content'); |
| 446 OptionsPage.showTab($('cookies-nav-tab')); | 444 OptionsPage.showTab($('cookies-nav-tab')); |
| 447 chrome.send('coreOptionsUserMetricsAction', | 445 chrome.send('coreOptionsUserMetricsAction', |
| 448 ['Options_ContentSettings']); | 446 ['Options_ContentSettings']); |
| 449 }; | 447 }; |
| 450 $('privacyClearDataButton').onclick = function(event) { | 448 $('privacyClearDataButton').onclick = function(event) { |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 /** | 1317 /** |
| 1320 * Removes the 'http://' from a URL, like the omnibox does. If the string | 1318 * Removes the 'http://' from a URL, like the omnibox does. If the string |
| 1321 * doesn't start with 'http://' it is returned unchanged. | 1319 * doesn't start with 'http://' it is returned unchanged. |
| 1322 * @param {string} url The url to be processed | 1320 * @param {string} url The url to be processed |
| 1323 * @return {string} The url with the 'http://' removed. | 1321 * @return {string} The url with the 'http://' removed. |
| 1324 */ | 1322 */ |
| 1325 stripHttp_: function(url) { | 1323 stripHttp_: function(url) { |
| 1326 return url.replace(/^http:\/\//, ''); | 1324 return url.replace(/^http:\/\//, ''); |
| 1327 }, | 1325 }, |
| 1328 | 1326 |
| 1329 /** | |
| 1330 * Shows the autoLaunch preference and initializes its checkbox value. | |
| 1331 * @param {boolean} enabled Whether autolaunch is enabled or or not. | |
| 1332 * @private | |
| 1333 */ | |
| 1334 updateAutoLaunchState_: function(enabled) { | |
| 1335 $('auto-launch-option').hidden = false; | |
| 1336 $('auto-launch').checked = enabled; | |
| 1337 }, | |
| 1338 | |
| 1339 /** | 1327 /** |
| 1340 * Called when the value of the download.default_directory preference | 1328 * Called when the value of the download.default_directory preference |
| 1341 * changes. | 1329 * changes. |
| 1342 * @param {Event} event Change event. | 1330 * @param {Event} event Change event. |
| 1343 * @private | 1331 * @private |
| 1344 */ | 1332 */ |
| 1345 onDefaultDownloadDirectoryChanged_: function(event) { | 1333 onDefaultDownloadDirectoryChanged_: function(event) { |
| 1346 $('downloadLocationPath').value = event.value.value; | 1334 $('downloadLocationPath').value = event.value.value; |
| 1347 if (cr.isChromeOS) { | 1335 if (cr.isChromeOS) { |
| 1348 // On ChromeOS, replace /special/drive-<hash>/root with "Google Drive" | 1336 // On ChromeOS, replace /special/drive-<hash>/root with "Google Drive" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 */ | 1408 */ |
| 1421 setDefaultSearchEngine_: function() { | 1409 setDefaultSearchEngine_: function() { |
| 1422 var engineSelect = $('default-search-engine'); | 1410 var engineSelect = $('default-search-engine'); |
| 1423 var selectedIndex = engineSelect.selectedIndex; | 1411 var selectedIndex = engineSelect.selectedIndex; |
| 1424 if (selectedIndex >= 0) { | 1412 if (selectedIndex >= 0) { |
| 1425 var selection = engineSelect.options[selectedIndex]; | 1413 var selection = engineSelect.options[selectedIndex]; |
| 1426 chrome.send('setDefaultSearchEngine', [String(selection.value)]); | 1414 chrome.send('setDefaultSearchEngine', [String(selection.value)]); |
| 1427 } | 1415 } |
| 1428 }, | 1416 }, |
| 1429 | 1417 |
| 1430 /** | |
| 1431 * Sets or clear whether Chrome should Auto-launch on computer startup. | |
| 1432 * @private | |
| 1433 */ | |
| 1434 handleAutoLaunchChanged_: function() { | |
| 1435 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); | |
| 1436 }, | |
| 1437 | |
| 1438 /** | 1418 /** |
| 1439 * Get the selected profile item from the profile list. This also works | 1419 * Get the selected profile item from the profile list. This also works |
| 1440 * correctly if the list is not displayed. | 1420 * correctly if the list is not displayed. |
| 1441 * @return {?Object} The profile item object, or null if nothing is | 1421 * @return {?Object} The profile item object, or null if nothing is |
| 1442 * selected. | 1422 * selected. |
| 1443 * @private | 1423 * @private |
| 1444 */ | 1424 */ |
| 1445 getSelectedProfileItem_: function() { | 1425 getSelectedProfileItem_: function() { |
| 1446 var profilesList = $('profiles-list'); | 1426 var profilesList = $('profiles-list'); |
| 1447 if (profilesList.hidden) { | 1427 if (profilesList.hidden) { |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 } | 2251 } |
| 2272 button.textContent = loadTimeData.getString(strId); | 2252 button.textContent = loadTimeData.getString(strId); |
| 2273 }; | 2253 }; |
| 2274 } | 2254 } |
| 2275 | 2255 |
| 2276 // Export | 2256 // Export |
| 2277 return { | 2257 return { |
| 2278 BrowserOptions: BrowserOptions | 2258 BrowserOptions: BrowserOptions |
| 2279 }; | 2259 }; |
| 2280 }); | 2260 }); |
| OLD | NEW |