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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 policy::BrowserPolicyConnector* connector = |
119 g_browser_process->browser_policy_connector(); | 119 g_browser_process->browser_policy_connector(); |
120 connector->FetchDevicePolicy(); | 120 connector->FetchCloudPolicy(); |
Mattias Nissler (ping if slow)
2011/11/18 11:00:25
Can we just issue a RefreshPolicies() call here? M
Joao da Silva
2011/11/18 14:03:30
Done.
| |
121 connector->FetchUserPolicy(); | |
122 } | 121 } |
123 | 122 |
124 void PolicyUIHandler::SendDataToUI(bool is_policy_update) { | 123 void PolicyUIHandler::SendDataToUI(bool is_policy_update) { |
125 DictionaryValue results; | 124 DictionaryValue results; |
126 bool any_policies_set; | 125 bool any_policies_set; |
127 ListValue* list = policy_status_->GetPolicyStatusList(&any_policies_set); | 126 ListValue* list = policy_status_->GetPolicyStatusList(&any_policies_set); |
128 results.Set("policies", list); | 127 results.Set("policies", list); |
129 results.SetBoolean("anyPoliciesSet", any_policies_set); | 128 results.SetBoolean("anyPoliciesSet", any_policies_set); |
130 DictionaryValue* dict = GetStatusData(); | 129 DictionaryValue* dict = GetStatusData(); |
131 results.Set("status", dict); | 130 results.Set("status", dict); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) { | 235 PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) { |
237 AddMessageHandler((new PolicyUIHandler)->Attach(this)); | 236 AddMessageHandler((new PolicyUIHandler)->Attach(this)); |
238 | 237 |
239 // Set up the chrome://policy/ source. | 238 // Set up the chrome://policy/ source. |
240 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 239 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
241 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); | 240 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); |
242 } | 241 } |
243 | 242 |
244 PolicyUI::~PolicyUI() { | 243 PolicyUI::~PolicyUI() { |
245 } | 244 } |
OLD | NEW |