OLD | NEW |
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/extensions/installed_loader.h" | 5 #include "chrome/browser/extensions/installed_loader.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return; | 222 return; |
223 } | 223 } |
224 | 224 |
225 if (write_to_prefs) | 225 if (write_to_prefs) |
226 extension_prefs_->UpdateManifest(extension.get()); | 226 extension_prefs_->UpdateManifest(extension.get()); |
227 | 227 |
228 extension_service_->AddExtension(extension.get()); | 228 extension_service_->AddExtension(extension.get()); |
229 } | 229 } |
230 | 230 |
231 void InstalledLoader::LoadAllExtensions() { | 231 void InstalledLoader::LoadAllExtensions() { |
| 232 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
232 TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions"); | 233 TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions"); |
233 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 234 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.LoadAllTime2"); |
234 | |
235 base::TimeTicks start_time = base::TimeTicks::Now(); | 235 base::TimeTicks start_time = base::TimeTicks::Now(); |
236 | 236 |
237 Profile* profile = extension_service_->profile(); | 237 Profile* profile = extension_service_->profile(); |
238 scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info( | 238 scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info( |
239 extension_prefs_->GetInstalledExtensionsInfo()); | 239 extension_prefs_->GetInstalledExtensionsInfo()); |
240 | 240 |
241 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0); | 241 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0); |
242 bool should_write_prefs = false; | 242 bool should_write_prefs = false; |
243 | 243 |
244 for (size_t i = 0; i < extensions_info->size(); ++i) { | 244 for (size_t i = 0; i < extensions_info->size(); ++i) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadUnpackedDir", | 298 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadUnpackedDir", |
299 reload_reason_counts[UNPACKED_DIR]); | 299 reload_reason_counts[UNPACKED_DIR]); |
300 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadNeedsRelocalization", | 300 UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadNeedsRelocalization", |
301 reload_reason_counts[NEEDS_RELOCALIZATION]); | 301 reload_reason_counts[NEEDS_RELOCALIZATION]); |
302 | 302 |
303 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAll", | 303 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAll", |
304 extension_registry_->enabled_extensions().size()); | 304 extension_registry_->enabled_extensions().size()); |
305 UMA_HISTOGRAM_COUNTS_100("Extensions.Disabled", | 305 UMA_HISTOGRAM_COUNTS_100("Extensions.Disabled", |
306 extension_registry_->disabled_extensions().size()); | 306 extension_registry_->disabled_extensions().size()); |
307 | 307 |
| 308 // TODO(rkaplow): Obsolete this when verified similar to LoadAllTime2. |
308 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", | 309 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", |
309 base::TimeTicks::Now() - start_time); | 310 base::TimeTicks::Now() - start_time); |
| 311 RecordExtensionsMetrics(); |
| 312 } |
| 313 |
| 314 void InstalledLoader::RecordExtensionsMetrics() { |
| 315 Profile* profile = extension_service_->profile(); |
310 | 316 |
311 int app_user_count = 0; | 317 int app_user_count = 0; |
312 int app_external_count = 0; | 318 int app_external_count = 0; |
313 int hosted_app_count = 0; | 319 int hosted_app_count = 0; |
314 int legacy_packaged_app_count = 0; | 320 int legacy_packaged_app_count = 0; |
315 int platform_app_count = 0; | 321 int platform_app_count = 0; |
316 int user_script_count = 0; | 322 int user_script_count = 0; |
317 int content_pack_count = 0; | 323 int content_pack_count = 0; |
318 int extension_user_count = 0; | 324 int extension_user_count = 0; |
319 int extension_external_count = 0; | 325 int extension_external_count = 0; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 583 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
578 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 584 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
579 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 585 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
580 flags |= Extension::REQUIRE_KEY; | 586 flags |= Extension::REQUIRE_KEY; |
581 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 587 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
582 flags |= Extension::ALLOW_FILE_ACCESS; | 588 flags |= Extension::ALLOW_FILE_ACCESS; |
583 return flags; | 589 return flags; |
584 } | 590 } |
585 | 591 |
586 } // namespace extensions | 592 } // namespace extensions |
OLD | NEW |