| 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 <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (!profile_manager) | 184 if (!profile_manager) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 ExtensionState state = NO_EXTENSIONS; | 187 ExtensionState state = NO_EXTENSIONS; |
| 188 | 188 |
| 189 // The off-store metric includes information from all loaded profiles at the | 189 // The off-store metric includes information from all loaded profiles at the |
| 190 // time when this metric is generated. | 190 // time when this metric is generated. |
| 191 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 191 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
| 192 for (size_t i = 0u; i < profiles.size() && state < OFF_STORE; ++i) { | 192 for (size_t i = 0u; i < profiles.size() && state < OFF_STORE; ++i) { |
| 193 extensions::InstallVerifier* verifier = | 193 extensions::InstallVerifier* verifier = |
| 194 extensions::ExtensionSystem::Get(profiles[i])->install_verifier(); | 194 extensions::InstallVerifier::Get(profiles[i]); |
| 195 | 195 |
| 196 scoped_ptr<extensions::ExtensionSet> extensions( | 196 scoped_ptr<extensions::ExtensionSet> extensions( |
| 197 GetInstalledExtensions(profiles[i])); | 197 GetInstalledExtensions(profiles[i])); |
| 198 if (!extensions) | 198 if (!extensions) |
| 199 continue; | 199 continue; |
| 200 | 200 |
| 201 // Combine the state from each profile, always favoring the higher state as | 201 // Combine the state from each profile, always favoring the higher state as |
| 202 // defined by the order of ExtensionState. | 202 // defined by the order of ExtensionState. |
| 203 state = std::max(state, CheckForOffStore(*extensions.get(), *verifier)); | 203 state = std::max(state, CheckForOffStore(*extensions.get(), *verifier)); |
| 204 } | 204 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 226 it != extensions->end(); | 226 it != extensions->end(); |
| 227 ++it) { | 227 ++it) { |
| 228 buckets.insert(HashExtension((*it)->id(), client_key)); | 228 buckets.insert(HashExtension((*it)->id(), client_key)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 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(); |
| 232 ++it) { | 232 ++it) { |
| 233 system_profile->add_occupied_extension_bucket(*it); | 233 system_profile->add_occupied_extension_bucket(*it); |
| 234 } | 234 } |
| 235 } | 235 } |
| OLD | NEW |