Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: chrome/browser/resources/policy.js

Issue 10236003: Added RefreshPolicies to PolicyService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed ui/js messages, addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/proxy_policy_unittest.cc ('k') | chrome/browser/ui/webui/policy_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/browser/prefs/proxy_policy_unittest.cc ('k') | chrome/browser/ui/webui/policy_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698