| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 int app_external_count = 0; | 192 int app_external_count = 0; |
| 193 int hosted_app_count = 0; | 193 int hosted_app_count = 0; |
| 194 int packaged_app_count = 0; | 194 int packaged_app_count = 0; |
| 195 int user_script_count = 0; | 195 int user_script_count = 0; |
| 196 int extension_user_count = 0; | 196 int extension_user_count = 0; |
| 197 int extension_external_count = 0; | 197 int extension_external_count = 0; |
| 198 int theme_count = 0; | 198 int theme_count = 0; |
| 199 int page_action_count = 0; | 199 int page_action_count = 0; |
| 200 int browser_action_count = 0; | 200 int browser_action_count = 0; |
| 201 int disabled_for_permissions_count = 0; | 201 int disabled_for_permissions_count = 0; |
| 202 int item_user_count = 0; |
| 202 const ExtensionSet* extensions = extension_service_->extensions(); | 203 const ExtensionSet* extensions = extension_service_->extensions(); |
| 203 ExtensionSet::const_iterator ex; | 204 ExtensionSet::const_iterator ex; |
| 204 for (ex = extensions->begin(); ex != extensions->end(); ++ex) { | 205 for (ex = extensions->begin(); ex != extensions->end(); ++ex) { |
| 205 Extension::Location location = (*ex)->location(); | 206 Extension::Location location = (*ex)->location(); |
| 206 Extension::Type type = (*ex)->GetType(); | 207 Extension::Type type = (*ex)->GetType(); |
| 207 if ((*ex)->is_app()) { | 208 if ((*ex)->is_app()) { |
| 208 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLocation", | 209 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLocation", |
| 209 location, 100); | 210 location, 100); |
| 210 } else if (type == Extension::TYPE_EXTENSION) { | 211 } else if (type == Extension::TYPE_EXTENSION) { |
| 211 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation", | 212 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation", |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 break; | 252 break; |
| 252 case Extension::TYPE_EXTENSION: | 253 case Extension::TYPE_EXTENSION: |
| 253 default: | 254 default: |
| 254 if (Extension::IsExternalLocation(location)) { | 255 if (Extension::IsExternalLocation(location)) { |
| 255 ++extension_external_count; | 256 ++extension_external_count; |
| 256 } else { | 257 } else { |
| 257 ++extension_user_count; | 258 ++extension_user_count; |
| 258 } | 259 } |
| 259 break; | 260 break; |
| 260 } | 261 } |
| 262 if (!Extension::IsExternalLocation((*ex)->location())) |
| 263 ++item_user_count; |
| 261 if ((*ex)->page_action() != NULL) | 264 if ((*ex)->page_action() != NULL) |
| 262 ++page_action_count; | 265 ++page_action_count; |
| 263 if ((*ex)->browser_action() != NULL) | 266 if ((*ex)->browser_action() != NULL) |
| 264 ++browser_action_count; | 267 ++browser_action_count; |
| 265 | 268 |
| 266 extension_service_->RecordPermissionMessagesHistogram( | 269 extension_service_->RecordPermissionMessagesHistogram( |
| 267 *ex, "Extensions.Permissions_Load"); | 270 *ex, "Extensions.Permissions_Load"); |
| 268 } | 271 } |
| 269 const ExtensionSet* disabled_extensions = | 272 const ExtensionSet* disabled_extensions = |
| 270 extension_service_->disabled_extensions(); | 273 extension_service_->disabled_extensions(); |
| 271 for (ex = disabled_extensions->begin(); | 274 for (ex = disabled_extensions->begin(); |
| 272 ex != disabled_extensions->end(); ++ex) { | 275 ex != disabled_extensions->end(); ++ex) { |
| 273 if (extension_service_->extension_prefs()-> | 276 if (extension_service_->extension_prefs()-> |
| 274 DidExtensionEscalatePermissions((*ex)->id())) { | 277 DidExtensionEscalatePermissions((*ex)->id())) { |
| 275 ++disabled_for_permissions_count; | 278 ++disabled_for_permissions_count; |
| 276 } | 279 } |
| 277 } | 280 } |
| 281 |
| 282 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAllUser", item_user_count); |
| 278 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadApp", | 283 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadApp", |
| 279 app_user_count + app_external_count); | 284 app_user_count + app_external_count); |
| 280 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppUser", app_user_count); | 285 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppUser", app_user_count); |
| 281 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppExternal", app_external_count); | 286 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppExternal", app_external_count); |
| 282 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadHostedApp", hosted_app_count); | 287 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadHostedApp", hosted_app_count); |
| 283 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPackagedApp", packaged_app_count); | 288 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPackagedApp", packaged_app_count); |
| 284 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtension", | 289 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtension", |
| 285 extension_user_count + extension_external_count); | 290 extension_user_count + extension_external_count); |
| 286 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionUser", | 291 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadExtensionUser", |
| 287 extension_user_count); | 292 extension_user_count); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 303 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 308 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 304 flags |= Extension::ALLOW_FILE_ACCESS; | 309 flags |= Extension::ALLOW_FILE_ACCESS; |
| 305 if (extension_prefs_->IsFromWebStore(info->extension_id)) | 310 if (extension_prefs_->IsFromWebStore(info->extension_id)) |
| 306 flags |= Extension::FROM_WEBSTORE; | 311 flags |= Extension::FROM_WEBSTORE; |
| 307 if (extension_prefs_->IsFromBookmark(info->extension_id)) | 312 if (extension_prefs_->IsFromBookmark(info->extension_id)) |
| 308 flags |= Extension::FROM_BOOKMARK; | 313 flags |= Extension::FROM_BOOKMARK; |
| 309 return flags; | 314 return flags; |
| 310 } | 315 } |
| 311 | 316 |
| 312 } // namespace extensions | 317 } // namespace extensions |
| OLD | NEW |