OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/webui/policy_ui.h" | 5 #include "chrome/browser/ui/webui/policy_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void PolicyUIHandler::OnPolicyValuesChanged() { | 109 void PolicyUIHandler::OnPolicyValuesChanged() { |
110 SendDataToUI(true); | 110 SendDataToUI(true); |
111 } | 111 } |
112 | 112 |
113 void PolicyUIHandler::HandleRequestData(const ListValue* args) { | 113 void PolicyUIHandler::HandleRequestData(const ListValue* args) { |
114 SendDataToUI(false); | 114 SendDataToUI(false); |
115 } | 115 } |
116 | 116 |
117 void PolicyUIHandler::HandleFetchPolicy(const ListValue* args) { | 117 void PolicyUIHandler::HandleFetchPolicy(const ListValue* args) { |
118 policy::BrowserPolicyConnector* connector = | 118 g_browser_process->browser_policy_connector()->RefreshPolicies(); |
119 g_browser_process->browser_policy_connector(); | |
120 connector->FetchDevicePolicy(); | |
121 connector->FetchUserPolicy(); | |
122 } | 119 } |
123 | 120 |
124 void PolicyUIHandler::SendDataToUI(bool is_policy_update) { | 121 void PolicyUIHandler::SendDataToUI(bool is_policy_update) { |
125 DictionaryValue results; | 122 DictionaryValue results; |
126 bool any_policies_set; | 123 bool any_policies_set; |
127 ListValue* list = policy_status_->GetPolicyStatusList(&any_policies_set); | 124 ListValue* list = policy_status_->GetPolicyStatusList(&any_policies_set); |
128 results.Set("policies", list); | 125 results.Set("policies", list); |
129 results.SetBoolean("anyPoliciesSet", any_policies_set); | 126 results.SetBoolean("anyPoliciesSet", any_policies_set); |
130 DictionaryValue* dict = GetStatusData(); | 127 DictionaryValue* dict = GetStatusData(); |
131 results.Set("status", dict); | 128 results.Set("status", dict); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) { | 233 PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) { |
237 AddMessageHandler((new PolicyUIHandler)->Attach(this)); | 234 AddMessageHandler((new PolicyUIHandler)->Attach(this)); |
238 | 235 |
239 // Set up the chrome://policy/ source. | 236 // Set up the chrome://policy/ source. |
240 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 237 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
241 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); | 238 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); |
242 } | 239 } |
243 | 240 |
244 PolicyUI::~PolicyUI() { | 241 PolicyUI::~PolicyUI() { |
245 } | 242 } |
OLD | NEW |