Chromium Code Reviews| Index: chrome/browser/resources/policy.js |
| diff --git a/chrome/browser/resources/policy.js b/chrome/browser/resources/policy.js |
| index 5c26d8b08b406c2e8d157b1d5afd87651dbc2ea8..a47e93715cf1a45c18c862baee97b88acfea2b29 100644 |
| --- a/chrome/browser/resources/policy.js |
| +++ b/chrome/browser/resources/policy.js |
| @@ -10,9 +10,6 @@ var policyDataFormat = { |
| // Whether any of the policies in 'policies' have a value. |
| 'anyPoliciesSet': true, |
| - // False if the policy information is being sent due to an initial page load |
| - // and true if it is being sent due to a change of policy values. |
| - 'isPolicyUpdate': false, |
| 'policies': [ |
| { |
| 'level': 'managed', |
| @@ -55,6 +52,13 @@ cr.define('policies', function() { |
| noActivePolicies_: false, |
| /** |
| + * True if the UI is waiting for the initial policy data to be provided by |
| + * the PolicyUIHandler. |
| + * @type {boolean} |
| + */ |
| + waitingForInitialData_: true, |
| + |
| + /** |
| * The current search term for filtering of the policy table. |
| * @type {string} |
| * @private |
| @@ -216,18 +220,28 @@ cr.define('policies', function() { |
| * by the policyDataFormat. |
| */ |
| Policy.returnData = function(policyData) { |
| - if (policyData.isPolicyUpdate) { |
| - Policy.getInstance().collapseExpandedCells(); |
| - Policy.getInstance().renderTemplate(policyData); |
| - Policy.getInstance().updatePolicyVisibility(); |
| + var policy = Policy.getInstance(); |
| + var isFirstLoad = policy.waitingForInitialData_; |
| + policy.waitingForInitialData_ = false; |
| - $('fetch-policies-button').disabled = false; |
| + if (isFirstLoad) { |
| + policy.renderTemplate(policyData); |
| } else { |
| - Policy.getInstance().renderTemplate(policyData); |
| + policy.collapseExpandedCells(); |
| + policy.renderTemplate(policyData); |
| + policy.updatePolicyVisibility(); |
|
Mattias Nissler (ping if slow)
2012/04/27 12:52:58
Any reason why we need the isFirstLoad distinction
Joao da Silva
2012/04/27 13:26:43
I didn't look at first. This was the original code
|
| } |
| }; |
| /** |
| + * Called by the C++ PolicyUIHandler when a requested policy refresh has |
| + * completed. |
| + */ |
| + Policy.refreshDone = function() { |
| + $('fetch-policies-button').disabled = false; |
| + }; |
| + |
| + /** |
| * Asks the C++ PolicyUIHandler to re-fetch policy information. |
| */ |
| Policy.triggerPolicyFetch = function() { |