Chromium Code Reviews| 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.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; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); | 343 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); |
| 344 // 'metricsReportingEnabled' element is only present on Chrome branded | 344 // 'metricsReportingEnabled' element is only present on Chrome branded |
| 345 // builds, and the 'metricsReportingCheckboxAction' message is only | 345 // builds, and the 'metricsReportingCheckboxAction' message is only |
| 346 // handled on ChromeOS. | 346 // handled on ChromeOS. |
| 347 if ($('metricsReportingEnabled') && cr.isChromeOS) { | 347 if ($('metricsReportingEnabled') && cr.isChromeOS) { |
| 348 $('metricsReportingEnabled').onclick = function(event) { | 348 $('metricsReportingEnabled').onclick = function(event) { |
| 349 chrome.send('metricsReportingCheckboxAction', | 349 chrome.send('metricsReportingCheckboxAction', |
| 350 [String(event.currentTarget.checked)]); | 350 [String(event.currentTarget.checked)]); |
| 351 }; | 351 }; |
| 352 } | 352 } |
| 353 if ($('metricsReportingEnabled') && !cr.isChromeOS) { | |
| 354 // The localized string has the | symbol on each side of the text that | |
| 355 // needs to be made into a button to restart Chrome. We parse the text | |
| 356 // and build the button from that. | |
| 357 var restartTextFragments = | |
| 358 loadTimeData.getString('metricsReportingResetRestart').split('|'); | |
| 359 // Assume structure is something like "starting text |link text| ending | |
| 360 // text" where both starting text and ending text may or may not be | |
| 361 // present, but the split should always be in three pieces. | |
| 362 $('metrics-reporting-reset-restart-starting-text').textContent = | |
|
Evan Stade
2014/07/31 19:32:31
nit: you don't need IDs on all these elements (giv
luken
2014/08/01 00:53:57
Done.
| |
| 363 restartTextFragments[0]; | |
| 364 $('metrics-reporting-reset-restart-button').textContent = | |
| 365 restartTextFragments[1]; | |
| 366 $('metrics-reporting-reset-restart-button').onclick = function(event) { | |
| 367 chrome.send('restartBrowser'); | |
| 368 }; | |
| 369 $('metrics-reporting-reset-restart-ending-text').textContent = | |
| 370 restartTextFragments[2]; | |
| 371 var updateMetricsRestartButton = function() { | |
| 372 $('metrics-reporting-reset-restart').hidden = | |
| 373 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == | |
| 374 $('metricsReportingEnabled').checked; | |
| 375 }; | |
| 376 Preferences.getInstance().addEventListener( | |
| 377 $('metricsReportingEnabled').getAttribute('pref'), | |
| 378 updateMetricsRestartButton); | |
| 379 updateMetricsRestartButton(); | |
| 380 } | |
| 353 | 381 |
| 354 // Bluetooth (CrOS only). | 382 // Bluetooth (CrOS only). |
| 355 if (cr.isChromeOS) { | 383 if (cr.isChromeOS) { |
| 356 options.system.bluetooth.BluetoothDeviceList.decorate( | 384 options.system.bluetooth.BluetoothDeviceList.decorate( |
| 357 $('bluetooth-paired-devices-list')); | 385 $('bluetooth-paired-devices-list')); |
| 358 | 386 |
| 359 $('bluetooth-add-device').onclick = | 387 $('bluetooth-add-device').onclick = |
| 360 this.handleAddBluetoothDevice_.bind(this); | 388 this.handleAddBluetoothDevice_.bind(this); |
| 361 | 389 |
| 362 $('enable-bluetooth').onchange = function(event) { | 390 $('enable-bluetooth').onchange = function(event) { |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1883 BrowserOptions.getLoggedInUsername = function() { | 1911 BrowserOptions.getLoggedInUsername = function() { |
| 1884 return BrowserOptions.getInstance().username_; | 1912 return BrowserOptions.getInstance().username_; |
| 1885 }; | 1913 }; |
| 1886 } | 1914 } |
| 1887 | 1915 |
| 1888 // Export | 1916 // Export |
| 1889 return { | 1917 return { |
| 1890 BrowserOptions: BrowserOptions | 1918 BrowserOptions: BrowserOptions |
| 1891 }; | 1919 }; |
| 1892 }); | 1920 }); |
| OLD | NEW |