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 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
| 7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 const RepeatingButton = cr.ui.RepeatingButton; | 8 const RepeatingButton = cr.ui.RepeatingButton; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 217 |
| 218 // Under the hood section. | 218 // Under the hood section. |
| 219 $('advancedOptionsButton').addEventListener('click', function(event) { | 219 $('advancedOptionsButton').addEventListener('click', function(event) { |
| 220 OptionsPage.navigateToPage('advanced'); | 220 OptionsPage.navigateToPage('advanced'); |
| 221 chrome.send('coreOptionsUserMetricsAction', | 221 chrome.send('coreOptionsUserMetricsAction', |
| 222 ['Options_OpenUnderTheHood']); | 222 ['Options_OpenUnderTheHood']); |
| 223 }); | 223 }); |
| 224 }, | 224 }, |
| 225 | 225 |
| 226 /** | 226 /** |
| 227 * Updates managed banner visibility state. This function iterates over | |
| 228 * all input fields of all subpages and if any of these is marked as managed | |
| 229 * it triggers the managed banner to be visible. The banner can be enforced | |
|
James Hawkins
2012/02/05 05:13:10
enforced? Do you mean 'forced' here?
Tyler Breisacher (Chromium)
2012/02/06 18:46:50
This part of the comment is copied from the origin
Tyler Breisacher (Chromium)
2012/02/06 19:08:58
I'm not sure what the 'managed flag of this class'
| |
| 230 * being on through the managed flag of this class but it can not be forced | |
| 231 * being off if managed items exist. | |
| 232 */ | |
| 233 updateManagedBannerVisibility_: function() { | |
|
James Hawkins
2012/02/05 05:13:10
If this applies to all sub-pages, why is the imple
Tyler Breisacher (Chromium)
2012/02/06 18:46:50
The banner only *shows* on the BrowserOptions page
| |
| 234 var bannerDiv = $('managed-prefs-banner'); | |
| 235 | |
| 236 var controlledByPolicy = false; | |
| 237 var controlledByExtension = false; | |
| 238 var inputElements = document.querySelectorAll('input[controlled-by]'); | |
| 239 var mainPages = document.querySelectorAll('#page-container .page'); | |
| 240 for (var i = 0, len = inputElements.length; i < len; i++) { | |
| 241 if (inputElements[i].controlledBy == 'policy') | |
| 242 controlledByPolicy = true; | |
| 243 else if (inputElements[i].controlledBy == 'extension') | |
| 244 controlledByExtension = true; | |
| 245 } | |
| 246 if (!controlledByPolicy && !controlledByExtension) { | |
| 247 bannerDiv.classList.add('hidden'); | |
| 248 for (var i = 0; i < mainPages.length; i++) | |
| 249 mainPages[i].classList.remove('under-managed-prefs-banner'); | |
| 250 } else { | |
| 251 bannerDiv.classList.remove('hidden'); | |
| 252 for (var i = 0; i < mainPages.length; i++) | |
| 253 mainPages[i].classList.add('under-managed-prefs-banner'); | |
| 254 | |
| 255 if (controlledByPolicy && !controlledByExtension) { | |
| 256 $('managed-prefs-text').textContent = | |
| 257 templateData.policyManagedPrefsBannerText; | |
| 258 } else if (!controlledByPolicy && controlledByExtension) { | |
| 259 $('managed-prefs-text').textContent = | |
| 260 templateData.extensionManagedPrefsBannerText; | |
| 261 } else if (controlledByPolicy && controlledByExtension) { | |
| 262 $('managed-prefs-text').textContent = | |
| 263 templateData.policyAndExtensionManagedPrefsBannerText; | |
| 264 } | |
| 265 } | |
| 266 }, | |
| 267 | |
| 268 /** | |
| 227 * Initializes a button for controlling screen brightness. | 269 * Initializes a button for controlling screen brightness. |
| 228 * @param {string} id Button ID. | 270 * @param {string} id Button ID. |
| 229 * @param {string} callback Name of the callback function. | 271 * @param {string} callback Name of the callback function. |
| 230 */ | 272 */ |
| 231 initBrightnessButton_: function(id, callback) { | 273 initBrightnessButton_: function(id, callback) { |
| 232 var button = $(id); | 274 var button = $(id); |
| 233 cr.ui.decorate(button, RepeatingButton); | 275 cr.ui.decorate(button, RepeatingButton); |
| 234 button.repeatInterval = 300; | 276 button.repeatInterval = 300; |
| 235 button.addEventListener(RepeatingButton.Event.BUTTON_HELD, function(e) { | 277 button.addEventListener(RepeatingButton.Event.BUTTON_HELD, function(e) { |
| 236 chrome.send(callback); | 278 chrome.send(callback); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 'setSyncActionLinkEnabled', | 623 'setSyncActionLinkEnabled', |
| 582 'setSyncActionLinkLabel', | 624 'setSyncActionLinkLabel', |
| 583 'setSyncEnabled', | 625 'setSyncEnabled', |
| 584 'setSyncSetupCompleted', | 626 'setSyncSetupCompleted', |
| 585 'setSyncStatus', | 627 'setSyncStatus', |
| 586 'setSyncStatusErrorVisible', | 628 'setSyncStatusErrorVisible', |
| 587 'setThemesResetButtonEnabled', | 629 'setThemesResetButtonEnabled', |
| 588 'updateAccountPicture', | 630 'updateAccountPicture', |
| 589 'updateAutocompleteSuggestions', | 631 'updateAutocompleteSuggestions', |
| 590 'updateHomePageLabel', | 632 'updateHomePageLabel', |
| 633 'updateManagedBannerVisibility', | |
| 591 'updateSearchEngines', | 634 'updateSearchEngines', |
| 592 'updateStartupPages', | 635 'updateStartupPages', |
| 593 ].forEach(function(name) { | 636 ].forEach(function(name) { |
| 594 BrowserOptions[name] = function() { | 637 BrowserOptions[name] = function() { |
| 595 var instance = BrowserOptions.getInstance(); | 638 var instance = BrowserOptions.getInstance(); |
| 596 return instance[name + '_'].apply(instance, arguments); | 639 return instance[name + '_'].apply(instance, arguments); |
| 597 }; | 640 }; |
| 598 }); | 641 }); |
| 599 | 642 |
| 600 BrowserOptions.updateDefaultBrowserState = function(statusString, isDefault, | 643 BrowserOptions.updateDefaultBrowserState = function(statusString, isDefault, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 616 return BrowserOptions.getInstance().username_; | 659 return BrowserOptions.getInstance().username_; |
| 617 }; | 660 }; |
| 618 } | 661 } |
| 619 | 662 |
| 620 // Export | 663 // Export |
| 621 return { | 664 return { |
| 622 BrowserOptions: BrowserOptions | 665 BrowserOptions: BrowserOptions |
| 623 }; | 666 }; |
| 624 | 667 |
| 625 }); | 668 }); |
| OLD | NEW |