| 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", | 236 UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime", |
| 237 base::TimeTicks::Now() - start_time); | 237 base::TimeTicks::Now() - start_time); |
| 238 | 238 |
| 239 int app_user_count = 0; | 239 int app_user_count = 0; |
| 240 int app_external_count = 0; | 240 int app_external_count = 0; |
| 241 int hosted_app_count = 0; | 241 int hosted_app_count = 0; |
| 242 int legacy_packaged_app_count = 0; | 242 int legacy_packaged_app_count = 0; |
| 243 int platform_app_count = 0; | 243 int platform_app_count = 0; |
| 244 int user_script_count = 0; | 244 int user_script_count = 0; |
| 245 int content_pack_count = 0; |
| 245 int extension_user_count = 0; | 246 int extension_user_count = 0; |
| 246 int extension_external_count = 0; | 247 int extension_external_count = 0; |
| 247 int theme_count = 0; | 248 int theme_count = 0; |
| 248 int page_action_count = 0; | 249 int page_action_count = 0; |
| 249 int browser_action_count = 0; | 250 int browser_action_count = 0; |
| 250 int disabled_for_permissions_count = 0; | 251 int disabled_for_permissions_count = 0; |
| 251 int item_user_count = 0; | 252 int item_user_count = 0; |
| 252 const ExtensionSet* extensions = extension_service_->extensions(); | 253 const ExtensionSet* extensions = extension_service_->extensions(); |
| 253 ExtensionSet::const_iterator ex; | 254 ExtensionSet::const_iterator ex; |
| 254 for (ex = extensions->begin(); ex != extensions->end(); ++ex) { | 255 for (ex = extensions->begin(); ex != extensions->end(); ++ex) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 319 } |
| 319 if (!Extension::IsExternalLocation((*ex)->location())) | 320 if (!Extension::IsExternalLocation((*ex)->location())) |
| 320 ++item_user_count; | 321 ++item_user_count; |
| 321 ExtensionActionManager* extension_action_manager = | 322 ExtensionActionManager* extension_action_manager = |
| 322 ExtensionActionManager::Get(extension_service_->profile()); | 323 ExtensionActionManager::Get(extension_service_->profile()); |
| 323 if (extension_action_manager->GetPageAction(**ex)) | 324 if (extension_action_manager->GetPageAction(**ex)) |
| 324 ++page_action_count; | 325 ++page_action_count; |
| 325 if (extension_action_manager->GetBrowserAction(**ex)) | 326 if (extension_action_manager->GetBrowserAction(**ex)) |
| 326 ++browser_action_count; | 327 ++browser_action_count; |
| 327 | 328 |
| 329 if (!(*ex)->is_content_pack()) |
| 330 ++content_pack_count; |
| 331 |
| 328 extension_service_->RecordPermissionMessagesHistogram( | 332 extension_service_->RecordPermissionMessagesHistogram( |
| 329 *ex, "Extensions.Permissions_Load"); | 333 *ex, "Extensions.Permissions_Load"); |
| 330 } | 334 } |
| 331 const ExtensionSet* disabled_extensions = | 335 const ExtensionSet* disabled_extensions = |
| 332 extension_service_->disabled_extensions(); | 336 extension_service_->disabled_extensions(); |
| 333 for (ex = disabled_extensions->begin(); | 337 for (ex = disabled_extensions->begin(); |
| 334 ex != disabled_extensions->end(); ++ex) { | 338 ex != disabled_extensions->end(); ++ex) { |
| 335 if (extension_service_->extension_prefs()-> | 339 if (extension_service_->extension_prefs()-> |
| 336 DidExtensionEscalatePermissions((*ex)->id())) { | 340 DidExtensionEscalatePermissions((*ex)->id())) { |
| 337 ++disabled_for_permissions_count; | 341 ++disabled_for_permissions_count; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 351 extension_user_count + extension_external_count); | 355 extension_user_count + extension_external_count); |
| 352 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionUser", | 356 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionUser", |
| 353 extension_user_count); | 357 extension_user_count); |
| 354 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionExternal", | 358 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionExternal", |
| 355 extension_external_count); | 359 extension_external_count); |
| 356 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadUserScript", user_script_count); | 360 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadUserScript", user_script_count); |
| 357 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadTheme", theme_count); | 361 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadTheme", theme_count); |
| 358 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPageAction", page_action_count); | 362 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPageAction", page_action_count); |
| 359 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadBrowserAction", | 363 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadBrowserAction", |
| 360 browser_action_count); | 364 browser_action_count); |
| 365 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadContentPack", content_pack_count); |
| 361 UMA_HISTOGRAM_COUNTS_100("Extensions.DisabledForPermissions", | 366 UMA_HISTOGRAM_COUNTS_100("Extensions.DisabledForPermissions", |
| 362 disabled_for_permissions_count); | 367 disabled_for_permissions_count); |
| 363 } | 368 } |
| 364 | 369 |
| 365 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 370 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
| 366 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 371 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
| 367 if (info->extension_location != Extension::LOAD) | 372 if (info->extension_location != Extension::LOAD) |
| 368 flags |= Extension::REQUIRE_KEY; | 373 flags |= Extension::REQUIRE_KEY; |
| 369 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 374 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 370 flags |= Extension::ALLOW_FILE_ACCESS; | 375 flags |= Extension::ALLOW_FILE_ACCESS; |
| 371 return flags; | 376 return flags; |
| 372 } | 377 } |
| 373 | 378 |
| 374 } // namespace extensions | 379 } // namespace extensions |
| OLD | NEW |