| 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 | 9 |
| 10 // | 10 // |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 }; | 121 }; |
| 122 $('instant-field-trial-control').onchange = function(evt) { | 122 $('instant-field-trial-control').onchange = function(evt) { |
| 123 this.checked = true; | 123 this.checked = true; |
| 124 chrome.send('disableInstant'); | 124 chrome.send('disableInstant'); |
| 125 }; | 125 }; |
| 126 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', | 126 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', |
| 127 this.onInstantConfirmDialogShownChanged_.bind(this)); | 127 this.onInstantConfirmDialogShownChanged_.bind(this)); |
| 128 Preferences.getInstance().addEventListener('instant.enabled', | 128 Preferences.getInstance().addEventListener('instant.enabled', |
| 129 this.onInstantEnabledChanged_.bind(this)); | 129 this.onInstantEnabledChanged_.bind(this)); |
| 130 Preferences.getInstance().addEventListener( | 130 Preferences.getInstance().addEventListener( |
| 131 "session.restore_on_startup", | 131 'session.restore_on_startup', |
| 132 this.onSessionRestoreSelectedChanged_.bind(this)); | 132 this.onSessionRestoreSelectedChanged_.bind(this)); |
| 133 Preferences.getInstance().addEventListener( | 133 Preferences.getInstance().addEventListener( |
| 134 "restore_session_state.dialog_shown", | 134 'restore_session_state.dialog_shown', |
| 135 this.onSessionRestoreDialogShownChanged_.bind(this)); | 135 this.onSessionRestoreDialogShownChanged_.bind(this)); |
| 136 | 136 |
| 137 // Text fields may change widths when the window changes size, so make | 137 // Text fields may change widths when the window changes size, so make |
| 138 // sure the suggestion list stays in sync. | 138 // sure the suggestion list stays in sync. |
| 139 var self = this; | 139 var self = this; |
| 140 window.addEventListener('resize', function() { | 140 window.addEventListener('resize', function() { |
| 141 self.autocompleteList_.syncWidthToInput(); | 141 self.autocompleteList_.syncWidthToInput(); |
| 142 }); | 142 }); |
| 143 | 143 |
| 144 var suggestionList = new cr.ui.AutocompleteList(); | 144 var suggestionList = new cr.ui.AutocompleteList(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 }, | 338 }, |
| 339 | 339 |
| 340 /** | 340 /** |
| 341 * Called to set the Instant field trial status. | 341 * Called to set the Instant field trial status. |
| 342 * @param {boolean} enabled If true, the experiment is enabled. | 342 * @param {boolean} enabled If true, the experiment is enabled. |
| 343 * @private | 343 * @private |
| 344 */ | 344 */ |
| 345 setInstantFieldTrialStatus_: function(enabled) { | 345 setInstantFieldTrialStatus_: function(enabled) { |
| 346 $('instant-enabled-control').hidden = enabled; | 346 $('instant-enabled-control').hidden = enabled; |
| 347 $('instant-field-trial-control').hidden = !enabled; | 347 $('instant-field-trial-control').hidden = !enabled; |
| 348 $('instant-label').htmlFor = enabled ? 'instant-field-trial-control' | 348 $('instant-label').htmlFor = enabled ? 'instant-field-trial-control' : |
| 349 : 'instant-enabled-control'; | 349 'instant-enabled-control'; |
| 350 }, | 350 }, |
| 351 | 351 |
| 352 onSessionRestoreSelectedChanged_ : function(event) { | 352 onSessionRestoreSelectedChanged_: function(event) { |
| 353 this.sessionRestoreSelected_ = event.value['value'] == 1; | 353 this.sessionRestoreSelected_ = event.value['value'] == 1; |
| 354 this.maybeShowSessionRestoreDialog_(); | 354 this.maybeShowSessionRestoreDialog_(); |
| 355 }, | 355 }, |
| 356 | 356 |
| 357 onSessionRestoreDialogShownChanged_ : function(event) { | 357 onSessionRestoreDialogShownChanged_: function(event) { |
| 358 this.sessionRestoreDialogShown_ = event.value['value']; | 358 this.sessionRestoreDialogShown_ = event.value['value']; |
| 359 this.maybeShowSessionRestoreDialog_(); | 359 this.maybeShowSessionRestoreDialog_(); |
| 360 }, | 360 }, |
| 361 | 361 |
| 362 maybeShowSessionRestoreDialog_ : function() { | 362 maybeShowSessionRestoreDialog_: function() { |
| 363 // If either of the needed two preferences hasn't been read yet, the | 363 // If either of the needed two preferences hasn't been read yet, the |
| 364 // corresponding member variable will be undefined and we won't display | 364 // corresponding member variable will be undefined and we won't display |
| 365 // the dialog yet. | 365 // the dialog yet. |
| 366 if (this.sessionRestoreEnabled_ && this.sessionRestoreSelected_ && | 366 if (this.sessionRestoreEnabled_ && this.sessionRestoreSelected_ && |
| 367 this.sessionRestoreDialogShown_ === false) { | 367 this.sessionRestoreDialogShown_ === false) { |
| 368 this.sessionRestoreDialogShown_ = true; | 368 this.sessionRestoreDialogShown_ = true; |
| 369 Preferences.setBooleanPref('restore_session_state.dialog_shown', true); | 369 Preferences.setBooleanPref('restore_session_state.dialog_shown', true); |
| 370 OptionsPage.navigateToPage('sessionRestoreOverlay'); | 370 OptionsPage.navigateToPage('sessionRestoreOverlay'); |
| 371 } | 371 } |
| 372 }, | 372 }, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 var option = new Option(engine['name'], engine['index']); | 414 var option = new Option(engine['name'], engine['index']); |
| 415 if (defaultValue == option.value) | 415 if (defaultValue == option.value) |
| 416 defaultIndex = i; | 416 defaultIndex = i; |
| 417 engineSelect.appendChild(option); | 417 engineSelect.appendChild(option); |
| 418 } | 418 } |
| 419 if (defaultIndex >= 0) | 419 if (defaultIndex >= 0) |
| 420 engineSelect.selectedIndex = defaultIndex; | 420 engineSelect.selectedIndex = defaultIndex; |
| 421 }, | 421 }, |
| 422 | 422 |
| 423 /** | 423 /** |
| 424 * Returns true if the custom startup page control block should | 424 * Returns true if the custom startup page control block should be enabled. |
| 425 * be enabled. | 425 * @return {boolean} Whether the startup page controls should be enabled. |
| 426 * @returns {boolean} Whether the startup page controls should be | |
| 427 * enabled. | |
| 428 */ | 426 */ |
| 429 shouldEnableCustomStartupPageControls: function(pages) { | 427 shouldEnableCustomStartupPageControls: function(pages) { |
| 430 return $('startup-show-pages').checked && | 428 return $('startup-show-pages').checked && |
| 431 !this.startup_pages_pref_.disabled; | 429 !this.startup_pages_pref_.disabled; |
| 432 }, | 430 }, |
| 433 | 431 |
| 434 /** | 432 /** |
| 435 * Sets the enabled state of the custom startup page list controls | 433 * Sets the enabled state of the custom startup page list controls |
| 436 * based on the current startup radio button selection. | 434 * based on the current startup radio button selection. |
| 437 * @private | 435 * @private |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 $('profiles-list').hidden = hasSingleProfile; | 533 $('profiles-list').hidden = hasSingleProfile; |
| 536 $('profiles-single-message').hidden = !hasSingleProfile; | 534 $('profiles-single-message').hidden = !hasSingleProfile; |
| 537 $('profiles-manage').hidden = hasSingleProfile; | 535 $('profiles-manage').hidden = hasSingleProfile; |
| 538 $('profiles-delete').textContent = hasSingleProfile ? | 536 $('profiles-delete').textContent = hasSingleProfile ? |
| 539 templateData.profilesDeleteSingle : | 537 templateData.profilesDeleteSingle : |
| 540 templateData.profilesDelete; | 538 templateData.profilesDelete; |
| 541 }, | 539 }, |
| 542 | 540 |
| 543 /** | 541 /** |
| 544 * Adds all |profiles| to the list. | 542 * Adds all |profiles| to the list. |
| 545 * @param {Array.<Object>} An array of profile info objects. | 543 * @param {Array.<Object>} profiles An array of profile info objects. |
| 546 * each object is of the form: | 544 * each object is of the form: |
| 547 * profileInfo = { | 545 * profileInfo = { |
| 548 * name: "Profile Name", | 546 * name: "Profile Name", |
| 549 * iconURL: "chrome://path/to/icon/image", | 547 * iconURL: "chrome://path/to/icon/image", |
| 550 * filePath: "/path/to/profile/data/on/disk", | 548 * filePath: "/path/to/profile/data/on/disk", |
| 551 * isCurrentProfile: false | 549 * isCurrentProfile: false |
| 552 * }; | 550 * }; |
| 553 * @private | 551 * @private |
| 554 */ | 552 */ |
| 555 setProfilesInfo_: function(profiles) { | 553 setProfilesInfo_: function(profiles) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 BrowserOptions.getLoggedInUsername = function() { | 630 BrowserOptions.getLoggedInUsername = function() { |
| 633 return BrowserOptions.getInstance().username_; | 631 return BrowserOptions.getInstance().username_; |
| 634 }; | 632 }; |
| 635 } | 633 } |
| 636 | 634 |
| 637 // Export | 635 // Export |
| 638 return { | 636 return { |
| 639 BrowserOptions: BrowserOptions | 637 BrowserOptions: BrowserOptions |
| 640 }; | 638 }; |
| 641 }); | 639 }); |
| OLD | NEW |