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 ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
10 | 10 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); | 341 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); |
342 // 'metricsReportingEnabled' element is only present on Chrome branded | 342 // 'metricsReportingEnabled' element is only present on Chrome branded |
343 // builds, and the 'metricsReportingCheckboxAction' message is only | 343 // builds, and the 'metricsReportingCheckboxAction' message is only |
344 // handled on ChromeOS. | 344 // handled on ChromeOS. |
345 if ($('metricsReportingEnabled') && cr.isChromeOS) { | 345 if ($('metricsReportingEnabled') && cr.isChromeOS) { |
346 $('metricsReportingEnabled').onclick = function(event) { | 346 $('metricsReportingEnabled').onclick = function(event) { |
347 chrome.send('metricsReportingCheckboxAction', | 347 chrome.send('metricsReportingCheckboxAction', |
348 [String(event.currentTarget.checked)]); | 348 [String(event.currentTarget.checked)]); |
349 }; | 349 }; |
350 } | 350 } |
| 351 if ($('metricsReportingEnabled') && !cr.isChromeOS) { |
| 352 // The localized string has the | symbol on each side of the text that |
| 353 // needs to be made into a button to restart Chrome. We parse the text |
| 354 // and build the button from that. |
| 355 var restartTextFragments = |
| 356 loadTimeData.getString('metricsReportingResetRestart').split('|'); |
| 357 // Assume structure is something like "starting text |link text| ending |
| 358 // text" where both starting text and ending text may or may not be |
| 359 // present, but the split should always be in three pieces. |
| 360 var startingTextSpan = document.createElement('span'); |
| 361 startingTextSpan.textContent = restartTextFragments[0]; |
| 362 $('metrics-reporting-reset-restart').appendChild(startingTextSpan); |
| 363 var restartButton = document.createElement('button'); |
| 364 restartButton.setAttribute('id', |
| 365 'metrics-reporting-reset-restart-button'); |
| 366 restartButton.setAttribute('class', |
| 367 'link-button standalone-link-button'); |
| 368 restartButton.textContent = restartTextFragments[1]; |
| 369 restartButton.onclick = function(event) { |
| 370 chrome.send('restartBrowser'); |
| 371 }; |
| 372 $('metrics-reporting-reset-restart').appendChild(restartButton); |
| 373 var endingTextSpan = document.createElement('span'); |
| 374 endingTextSpan.textContent = restartTextFragments[2]; |
| 375 $('metrics-reporting-reset-restart').appendChild(endingTextSpan); |
| 376 var updateMetricsRestartButton = function() { |
| 377 $('metrics-reporting-reset-restart').hidden = |
| 378 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
| 379 $('metricsReportingEnabled').checked; |
| 380 }; |
| 381 Preferences.getInstance().addEventListener( |
| 382 $('metricsReportingEnabled').getAttribute('pref'), |
| 383 updateMetricsRestartButton); |
| 384 updateMetricsRestartButton(); |
| 385 } |
351 | 386 |
352 // Bluetooth (CrOS only). | 387 // Bluetooth (CrOS only). |
353 if (cr.isChromeOS) { | 388 if (cr.isChromeOS) { |
354 options.system.bluetooth.BluetoothDeviceList.decorate( | 389 options.system.bluetooth.BluetoothDeviceList.decorate( |
355 $('bluetooth-paired-devices-list')); | 390 $('bluetooth-paired-devices-list')); |
356 | 391 |
357 $('bluetooth-add-device').onclick = | 392 $('bluetooth-add-device').onclick = |
358 this.handleAddBluetoothDevice_.bind(this); | 393 this.handleAddBluetoothDevice_.bind(this); |
359 | 394 |
360 $('enable-bluetooth').onchange = function(event) { | 395 $('enable-bluetooth').onchange = function(event) { |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 BrowserOptions.getLoggedInUsername = function() { | 1916 BrowserOptions.getLoggedInUsername = function() { |
1882 return BrowserOptions.getInstance().username_; | 1917 return BrowserOptions.getInstance().username_; |
1883 }; | 1918 }; |
1884 } | 1919 } |
1885 | 1920 |
1886 // Export | 1921 // Export |
1887 return { | 1922 return { |
1888 BrowserOptions: BrowserOptions | 1923 BrowserOptions: BrowserOptions |
1889 }; | 1924 }; |
1890 }); | 1925 }); |
OLD | NEW |