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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 // Don't count unpacked extensions, since they're a developer-specific | 296 // Don't count unpacked extensions, since they're a developer-specific |
297 // feature. | 297 // feature. |
298 if (Manifest::IsUnpackedLocation(location)) | 298 if (Manifest::IsUnpackedLocation(location)) |
299 continue; | 299 continue; |
300 | 300 |
301 UMA_HISTOGRAM_ENUMERATION("Extensions.ManifestVersion", | 301 UMA_HISTOGRAM_ENUMERATION("Extensions.ManifestVersion", |
302 (*ex)->manifest_version(), 10); | 302 (*ex)->manifest_version(), 10); |
303 | 303 |
304 if (type == Manifest::TYPE_EXTENSION) { | 304 if (type == Manifest::TYPE_EXTENSION) { |
305 BackgroundPageType background_page_type = GetBackgroundPageType(*ex); | 305 BackgroundPageType background_page_type = |
306 UMA_HISTOGRAM_ENUMERATION("Extensions.BackgroundPageType", | 306 GetBackgroundPageType(ex->get()); |
307 background_page_type, 10); | 307 UMA_HISTOGRAM_ENUMERATION( |
| 308 "Extensions.BackgroundPageType", background_page_type, 10); |
308 } | 309 } |
309 | 310 |
310 // Using an enumeration shows us the total installed ratio across all users. | 311 // Using an enumeration shows us the total installed ratio across all users. |
311 // Using the totals per user at each startup tells us the distribution of | 312 // Using the totals per user at each startup tells us the distribution of |
312 // usage for each user (e.g. 40% of users have at least one app installed). | 313 // usage for each user (e.g. 40% of users have at least one app installed). |
313 UMA_HISTOGRAM_ENUMERATION("Extensions.LoadType", type, 100); | 314 UMA_HISTOGRAM_ENUMERATION("Extensions.LoadType", type, 100); |
314 switch (type) { | 315 switch (type) { |
315 case Manifest::TYPE_THEME: | 316 case Manifest::TYPE_THEME: |
316 ++theme_count; | 317 ++theme_count; |
317 break; | 318 break; |
(...skipping 30 matching lines...) Expand all Loading... |
348 ++extension_external_count; | 349 ++extension_external_count; |
349 } else { | 350 } else { |
350 ++extension_user_count; | 351 ++extension_user_count; |
351 } | 352 } |
352 break; | 353 break; |
353 } | 354 } |
354 if (!Manifest::IsExternalLocation((*ex)->location())) | 355 if (!Manifest::IsExternalLocation((*ex)->location())) |
355 ++item_user_count; | 356 ++item_user_count; |
356 ExtensionActionManager* extension_action_manager = | 357 ExtensionActionManager* extension_action_manager = |
357 ExtensionActionManager::Get(extension_service_->profile()); | 358 ExtensionActionManager::Get(extension_service_->profile()); |
358 if (extension_action_manager->GetPageAction(**ex)) | 359 if (extension_action_manager->GetPageAction(*ex->get())) |
359 ++page_action_count; | 360 ++page_action_count; |
360 if (extension_action_manager->GetBrowserAction(**ex)) | 361 if (extension_action_manager->GetBrowserAction(*ex->get())) |
361 ++browser_action_count; | 362 ++browser_action_count; |
362 | 363 |
363 if (extensions::ManagedModeInfo::IsContentPack(*ex)) | 364 if (extensions::ManagedModeInfo::IsContentPack(ex->get())) |
364 ++content_pack_count; | 365 ++content_pack_count; |
365 | 366 |
366 extension_service_->RecordPermissionMessagesHistogram( | 367 extension_service_->RecordPermissionMessagesHistogram( |
367 *ex, "Extensions.Permissions_Load"); | 368 ex->get(), "Extensions.Permissions_Load"); |
368 } | 369 } |
369 const ExtensionSet* disabled_extensions = | 370 const ExtensionSet* disabled_extensions = |
370 extension_service_->disabled_extensions(); | 371 extension_service_->disabled_extensions(); |
371 for (ex = disabled_extensions->begin(); | 372 for (ex = disabled_extensions->begin(); |
372 ex != disabled_extensions->end(); ++ex) { | 373 ex != disabled_extensions->end(); ++ex) { |
373 if (extension_service_->extension_prefs()-> | 374 if (extension_service_->extension_prefs()-> |
374 DidExtensionEscalatePermissions((*ex)->id())) { | 375 DidExtensionEscalatePermissions((*ex)->id())) { |
375 ++disabled_for_permissions_count; | 376 ++disabled_for_permissions_count; |
376 } | 377 } |
377 } | 378 } |
(...skipping 26 matching lines...) Expand all Loading... |
404 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 405 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
405 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 406 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
406 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 407 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
407 flags |= Extension::REQUIRE_KEY; | 408 flags |= Extension::REQUIRE_KEY; |
408 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 409 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
409 flags |= Extension::ALLOW_FILE_ACCESS; | 410 flags |= Extension::ALLOW_FILE_ACCESS; |
410 return flags; | 411 return flags; |
411 } | 412 } |
412 | 413 |
413 } // namespace extensions | 414 } // namespace extensions |
OLD | NEW |