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 var restartElements = |
| 363 $('metrics-reporting-reset-restart').querySelectorAll('*'); |
| 364 for (var i = 0; i < restartTextFragments.length; i++) { |
| 365 restartElements[i].textContent = restartTextFragments[i]; |
| 366 } |
| 367 restartElements[1].onclick = function(event) { |
| 368 chrome.send('restartBrowser'); |
| 369 }; |
| 370 var updateMetricsRestartButton = function() { |
| 371 $('metrics-reporting-reset-restart').hidden = |
| 372 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
| 373 $('metricsReportingEnabled').checked; |
| 374 }; |
| 375 Preferences.getInstance().addEventListener( |
| 376 $('metricsReportingEnabled').getAttribute('pref'), |
| 377 updateMetricsRestartButton); |
| 378 updateMetricsRestartButton(); |
| 379 } |
353 | 380 |
354 // Bluetooth (CrOS only). | 381 // Bluetooth (CrOS only). |
355 if (cr.isChromeOS) { | 382 if (cr.isChromeOS) { |
356 options.system.bluetooth.BluetoothDeviceList.decorate( | 383 options.system.bluetooth.BluetoothDeviceList.decorate( |
357 $('bluetooth-paired-devices-list')); | 384 $('bluetooth-paired-devices-list')); |
358 | 385 |
359 $('bluetooth-add-device').onclick = | 386 $('bluetooth-add-device').onclick = |
360 this.handleAddBluetoothDevice_.bind(this); | 387 this.handleAddBluetoothDevice_.bind(this); |
361 | 388 |
362 $('enable-bluetooth').onchange = function(event) { | 389 $('enable-bluetooth').onchange = function(event) { |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 BrowserOptions.getLoggedInUsername = function() { | 1910 BrowserOptions.getLoggedInUsername = function() { |
1884 return BrowserOptions.getInstance().username_; | 1911 return BrowserOptions.getInstance().username_; |
1885 }; | 1912 }; |
1886 } | 1913 } |
1887 | 1914 |
1888 // Export | 1915 // Export |
1889 return { | 1916 return { |
1890 BrowserOptions: BrowserOptions | 1917 BrowserOptions: BrowserOptions |
1891 }; | 1918 }; |
1892 }); | 1919 }); |
OLD | NEW |