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(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
Yoyo Zhou
2015/02/25 19:34:29
DCHECK_CURRENTLY_ON()
rkaplow
2015/02/25 19:59:50
Done.
| |
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", | 308 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", |
309 base::TimeTicks::Now() - start_time); | 309 base::TimeTicks::Now() - start_time); |
310 RecordExtensionsMetrics(); | |
311 } | |
312 | |
313 void InstalledLoader::RecordExtensionsMetrics() { | |
314 Profile* profile = extension_service_->profile(); | |
310 | 315 |
311 int app_user_count = 0; | 316 int app_user_count = 0; |
312 int app_external_count = 0; | 317 int app_external_count = 0; |
313 int hosted_app_count = 0; | 318 int hosted_app_count = 0; |
314 int legacy_packaged_app_count = 0; | 319 int legacy_packaged_app_count = 0; |
315 int platform_app_count = 0; | 320 int platform_app_count = 0; |
316 int user_script_count = 0; | 321 int user_script_count = 0; |
317 int content_pack_count = 0; | 322 int content_pack_count = 0; |
318 int extension_user_count = 0; | 323 int extension_user_count = 0; |
319 int extension_external_count = 0; | 324 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) { | 582 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
578 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 583 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
579 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 584 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
580 flags |= Extension::REQUIRE_KEY; | 585 flags |= Extension::REQUIRE_KEY; |
581 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 586 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
582 flags |= Extension::ALLOW_FILE_ACCESS; | 587 flags |= Extension::ALLOW_FILE_ACCESS; |
583 return flags; | 588 return flags; |
584 } | 589 } |
585 | 590 |
586 } // namespace extensions | 591 } // namespace extensions |
OLD | NEW |