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

Side by Side Diff: chrome/browser/ui/webui/policy_ui.cc

Issue 10386097: Refactored ConfigurationPolicyProvider to provide PolicyBundles instead of PolicyMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/proxy_policy_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 base::Bind(&PolicyUIHandler::OnRefreshDone, 185 base::Bind(&PolicyUIHandler::OnRefreshDone,
186 weak_factory_.GetWeakPtr())); 186 weak_factory_.GetWeakPtr()));
187 } 187 }
188 188
189 void PolicyUIHandler::OnRefreshDone() { 189 void PolicyUIHandler::OnRefreshDone() {
190 web_ui()->CallJavascriptFunction("Policy.refreshDone"); 190 web_ui()->CallJavascriptFunction("Policy.refreshDone");
191 } 191 }
192 192
193 void PolicyUIHandler::SendDataToUI() { 193 void PolicyUIHandler::SendDataToUI() {
194 policy::PolicyService* service = g_browser_process->policy_service(); 194 policy::PolicyService* service = g_browser_process->policy_service();
195 const policy::PolicyMap* policies =
196 service->GetPolicies(policy::POLICY_DOMAIN_CHROME, "");
197 bool any_policies_set = false; 195 bool any_policies_set = false;
198 base::ListValue* list; 196 scoped_ptr<base::ListValue> list(
James Hawkins 2012/05/15 16:33:32 nit: No need to use a scoped_ptr here.
Joao da Silva 2012/05/15 16:42:17 Done.
199 if (policies) 197 GetPolicyStatusList(
200 list = GetPolicyStatusList(*policies, &any_policies_set).release(); 198 service->GetPolicies(policy::POLICY_DOMAIN_CHROME, ""),
James Hawkins 2012/05/15 16:33:32 nit: "" should either be string16() or std::string
Joao da Silva 2012/05/15 16:42:17 Done.
201 else 199 &any_policies_set));
202 list = new base::ListValue();
203 200
204 base::DictionaryValue results; 201 base::DictionaryValue results;
205 results.Set("policies", list); 202 results.Set("policies", list.release());
206 results.SetBoolean("anyPoliciesSet", any_policies_set); 203 results.SetBoolean("anyPoliciesSet", any_policies_set);
207 base::DictionaryValue* dict = GetStatusData(); 204 base::DictionaryValue* dict = GetStatusData();
208 results.Set("status", dict); 205 results.Set("status", dict);
209 web_ui()->CallJavascriptFunction("Policy.returnData", results); 206 web_ui()->CallJavascriptFunction("Policy.returnData", results);
210 } 207 }
211 208
212 // static 209 // static
213 string16 PolicyUIHandler::GetPolicyScopeString(policy::PolicyScope scope) { 210 string16 PolicyUIHandler::GetPolicyScopeString(policy::PolicyScope scope) {
214 switch (scope) { 211 switch (scope) {
215 case policy::POLICY_SCOPE_USER: 212 case policy::POLICY_SCOPE_USER:
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { 368 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) {
372 web_ui->AddMessageHandler(new PolicyUIHandler); 369 web_ui->AddMessageHandler(new PolicyUIHandler);
373 370
374 // Set up the chrome://policy/ source. 371 // Set up the chrome://policy/ source.
375 Profile* profile = Profile::FromWebUI(web_ui); 372 Profile* profile = Profile::FromWebUI(web_ui);
376 ChromeURLDataManager::AddDataSource(profile, CreatePolicyUIHTMLSource()); 373 ChromeURLDataManager::AddDataSource(profile, CreatePolicyUIHTMLSource());
377 } 374 }
378 375
379 PolicyUI::~PolicyUI() { 376 PolicyUI::~PolicyUI() {
380 } 377 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/proxy_policy_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698