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

Unified Diff: chrome/browser/policy/policy_statistics_collector.cc

Issue 58313002: Removed the PolicyDefinitionList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-10-use-registry
Patch Set: Created 7 years, 1 month 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
Index: chrome/browser/policy/policy_statistics_collector.cc
diff --git a/chrome/browser/policy/policy_statistics_collector.cc b/chrome/browser/policy/policy_statistics_collector.cc
index e2f59b98bda5bbaa1a8ef17a3e9d4f925d105d7b..65b6e727b59b7fdcbe27596eef3ecf3346d6ced6 100644
--- a/chrome/browser/policy/policy_statistics_collector.cc
+++ b/chrome/browser/policy/policy_statistics_collector.cc
@@ -15,7 +15,6 @@
#include "base/task_runner.h"
#include "chrome/browser/policy/policy_service.h"
#include "components/policy/core/common/policy_pref_names.h"
-#include "policy/policy_constants.h"
namespace policy {
@@ -23,10 +22,14 @@ const int PolicyStatisticsCollector::kStatisticsUpdateRate =
24 * 60 * 60 * 1000; // 24 hours.
PolicyStatisticsCollector::PolicyStatisticsCollector(
+ const GetChromePolicyDetailsCallback& get_details,
+ const Schema& chrome_schema,
PolicyService* policy_service,
PrefService* prefs,
const scoped_refptr<base::TaskRunner>& task_runner)
- : policy_service_(policy_service),
+ : get_details_(get_details),
+ chrome_schema_(chrome_schema),
+ policy_service_(policy_service),
prefs_(prefs),
task_runner_(task_runner) {
}
@@ -58,16 +61,19 @@ void PolicyStatisticsCollector::RecordPolicyUse(int id) {
}
void PolicyStatisticsCollector::CollectStatistics() {
- const policy::PolicyDefinitionList* policy_list =
- policy::GetChromePolicyDefinitionList();
const PolicyMap& policies = policy_service_->GetPolicies(
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
// Collect statistics.
- for (const policy::PolicyDefinitionList::Entry* policy = policy_list->begin;
- policy != policy_list->end; ++policy) {
- if (policies.Get(policy->name))
- RecordPolicyUse(policy->id);
+ for (Schema::Iterator it(chrome_schema_.GetPropertiesIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ if (policies.Get(it.key())) {
+ const PolicyDetails* details = get_details_.Run(it.key());
+ if (details)
+ RecordPolicyUse(details->id);
+ else
+ NOTREACHED();
bartfab (slow) 2013/11/05 18:18:33 Nit: #include "base/logging.h"
Joao da Silva 2013/11/07 20:27:27 Done.
+ }
}
// Take care of next update.

Powered by Google App Engine
This is Rietveld 408576698