OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/extensions_metrics_provider.h" | 5 #include "chrome/browser/metrics/extensions_metrics_provider.h" |
6 | 6 |
| 7 #include <algorithm> |
7 #include <set> | 8 #include <set> |
| 9 #include <vector> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/extensions/install_verifier.h" | 15 #include "chrome/browser/extensions/install_verifier.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "components/metrics/metrics_log.h" | 17 #include "components/metrics/metrics_log.h" |
16 #include "components/metrics/metrics_state_manager.h" | 18 #include "components/metrics/metrics_state_manager.h" |
17 #include "components/metrics/proto/system_profile.pb.h" | 19 #include "components/metrics/proto/system_profile.pb.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return extensions::ExtensionRegistry::Get(profile) | 162 return extensions::ExtensionRegistry::Get(profile) |
161 ->GenerateInstalledExtensionsSet(); | 163 ->GenerateInstalledExtensionsSet(); |
162 } | 164 } |
163 return scoped_ptr<extensions::ExtensionSet>(); | 165 return scoped_ptr<extensions::ExtensionSet>(); |
164 } | 166 } |
165 | 167 |
166 uint64 ExtensionsMetricsProvider::GetClientID() { | 168 uint64 ExtensionsMetricsProvider::GetClientID() { |
167 // TODO(blundell): Create a MetricsLog::ClientIDAsInt() API and call it | 169 // TODO(blundell): Create a MetricsLog::ClientIDAsInt() API and call it |
168 // here as well as in MetricsLog's population of the client_id field of | 170 // here as well as in MetricsLog's population of the client_id field of |
169 // the uma_proto. | 171 // the uma_proto. |
170 return MetricsLog::Hash(metrics_state_manager_->client_id()); | 172 return metrics::MetricsLog::Hash(metrics_state_manager_->client_id()); |
171 } | 173 } |
172 | 174 |
173 void ExtensionsMetricsProvider::ProvideSystemProfileMetrics( | 175 void ExtensionsMetricsProvider::ProvideSystemProfileMetrics( |
174 metrics::SystemProfileProto* system_profile) { | 176 metrics::SystemProfileProto* system_profile) { |
175 ProvideOffStoreMetric(system_profile); | 177 ProvideOffStoreMetric(system_profile); |
176 ProvideOccupiedBucketMetric(system_profile); | 178 ProvideOccupiedBucketMetric(system_profile); |
177 } | 179 } |
178 | 180 |
179 void ExtensionsMetricsProvider::ProvideOffStoreMetric( | 181 void ExtensionsMetricsProvider::ProvideOffStoreMetric( |
180 metrics::SystemProfileProto* system_profile) { | 182 metrics::SystemProfileProto* system_profile) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 it != extensions->end(); | 226 it != extensions->end(); |
225 ++it) { | 227 ++it) { |
226 buckets.insert(HashExtension((*it)->id(), client_key)); | 228 buckets.insert(HashExtension((*it)->id(), client_key)); |
227 } | 229 } |
228 | 230 |
229 for (std::set<int>::const_iterator it = buckets.begin(); it != buckets.end(); | 231 for (std::set<int>::const_iterator it = buckets.begin(); it != buckets.end(); |
230 ++it) { | 232 ++it) { |
231 system_profile->add_occupied_extension_bucket(*it); | 233 system_profile->add_occupied_extension_bucket(*it); |
232 } | 234 } |
233 } | 235 } |
OLD | NEW |