Chromium Code Reviews| 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "content/public/browser/resource_dispatcher_host.h" | 42 #include "content/public/browser/resource_dispatcher_host.h" |
| 43 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 44 #include "extensions/browser/extension_prefs.h" | 44 #include "extensions/browser/extension_prefs.h" |
| 45 #include "extensions/browser/extension_registry.h" | 45 #include "extensions/browser/extension_registry.h" |
| 46 #include "extensions/browser/extension_system.h" | 46 #include "extensions/browser/extension_system.h" |
| 47 #include "extensions/browser/install/crx_install_error.h" | 47 #include "extensions/browser/install/crx_install_error.h" |
| 48 #include "extensions/browser/install/extension_install_ui.h" | 48 #include "extensions/browser/install/extension_install_ui.h" |
| 49 #include "extensions/browser/install_flag.h" | 49 #include "extensions/browser/install_flag.h" |
| 50 #include "extensions/browser/notification_types.h" | 50 #include "extensions/browser/notification_types.h" |
| 51 #include "extensions/common/extension_icon_set.h" | 51 #include "extensions/common/extension_icon_set.h" |
| 52 #include "extensions/common/feature_switch.h" | |
| 53 #include "extensions/common/file_util.h" | 52 #include "extensions/common/file_util.h" |
| 54 #include "extensions/common/manifest.h" | 53 #include "extensions/common/manifest.h" |
| 55 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 54 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 56 #include "extensions/common/manifest_handlers/shared_module_info.h" | 55 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 57 #include "extensions/common/manifest_url_handlers.h" | 56 #include "extensions/common/manifest_url_handlers.h" |
| 58 #include "extensions/common/permissions/permission_message_provider.h" | 57 #include "extensions/common/permissions/permission_message_provider.h" |
| 59 #include "extensions/common/permissions/permission_set.h" | 58 #include "extensions/common/permissions/permission_set.h" |
| 60 #include "extensions/common/permissions/permissions_data.h" | 59 #include "extensions/common/permissions/permissions_data.h" |
| 61 #include "extensions/common/user_script.h" | 60 #include "extensions/common/user_script.h" |
| 62 #include "extensions/strings/grit/extensions_strings.h" | 61 #include "extensions/strings/grit/extensions_strings.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 return CrxInstallError(); | 319 return CrxInstallError(); |
| 321 } | 320 } |
| 322 | 321 |
| 323 if (!extensions_enabled_) { | 322 if (!extensions_enabled_) { |
| 324 return CrxInstallError( | 323 return CrxInstallError( |
| 325 CrxInstallError::ERROR_DECLINED, | 324 CrxInstallError::ERROR_DECLINED, |
| 326 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED)); | 325 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED)); |
| 327 } | 326 } |
| 328 | 327 |
| 329 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { | 328 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { |
| 330 if (FeatureSwitch::easy_off_store_install()->IsEnabled()) { | 329 // TODO(devlin): It appears that these histograms are never logged. We |
| 331 const char kHistogramName[] = "Extensions.OffStoreInstallDecisionEasy"; | 330 // should either add them to histograms.xml or delete them. |
|
lazyboy
2017/02/01 20:12:13
We should also consider dropping the "Hard" suffix
| |
| 332 if (is_gallery_install()) { | 331 const char kHistogramName[] = "Extensions.OffStoreInstallDecisionHard"; |
| 333 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OnStoreInstall, | 332 if (is_gallery_install()) { |
| 334 NumOffStoreInstallDecision); | 333 UMA_HISTOGRAM_ENUMERATION(kHistogramName, |
| 335 } else { | 334 OffStoreInstallDecision::OnStoreInstall, |
| 336 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, | 335 NumOffStoreInstallDecision); |
| 337 NumOffStoreInstallDecision); | 336 } else if (off_store_install_allow_reason_ != OffStoreInstallDisallowed) { |
| 338 } | 337 UMA_HISTOGRAM_ENUMERATION(kHistogramName, |
| 338 OffStoreInstallDecision::OffStoreInstallAllowed, | |
| 339 NumOffStoreInstallDecision); | |
| 340 UMA_HISTOGRAM_ENUMERATION("Extensions.OffStoreInstallAllowReason", | |
| 341 off_store_install_allow_reason_, | |
| 342 NumOffStoreInstallAllowReasons); | |
| 339 } else { | 343 } else { |
| 340 const char kHistogramName[] = "Extensions.OffStoreInstallDecisionHard"; | 344 UMA_HISTOGRAM_ENUMERATION( |
| 341 if (is_gallery_install()) { | 345 kHistogramName, OffStoreInstallDecision::OffStoreInstallDisallowed, |
| 342 UMA_HISTOGRAM_ENUMERATION(kHistogramName, | 346 NumOffStoreInstallDecision); |
| 343 OffStoreInstallDecision::OnStoreInstall, | 347 // Don't delete source in this case so that the user can install |
| 344 NumOffStoreInstallDecision); | 348 // manually if they want. |
| 345 } else if (off_store_install_allow_reason_ != OffStoreInstallDisallowed) { | 349 delete_source_ = false; |
| 346 UMA_HISTOGRAM_ENUMERATION( | 350 did_handle_successfully_ = false; |
| 347 kHistogramName, OffStoreInstallDecision::OffStoreInstallAllowed, | |
| 348 NumOffStoreInstallDecision); | |
| 349 UMA_HISTOGRAM_ENUMERATION("Extensions.OffStoreInstallAllowReason", | |
| 350 off_store_install_allow_reason_, | |
| 351 NumOffStoreInstallAllowReasons); | |
| 352 } else { | |
| 353 UMA_HISTOGRAM_ENUMERATION( | |
| 354 kHistogramName, OffStoreInstallDecision::OffStoreInstallDisallowed, | |
| 355 NumOffStoreInstallDecision); | |
| 356 // Don't delete source in this case so that the user can install | |
| 357 // manually if they want. | |
| 358 delete_source_ = false; | |
| 359 did_handle_successfully_ = false; | |
| 360 | 351 |
| 361 return CrxInstallError(CrxInstallError::ERROR_OFF_STORE, | 352 return CrxInstallError( |
| 362 l10n_util::GetStringUTF16( | 353 CrxInstallError::ERROR_OFF_STORE, |
| 363 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE)); | 354 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE)); |
| 364 } | |
| 365 } | 355 } |
| 366 } | 356 } |
| 367 | 357 |
| 368 if (install_checker_.extension()->is_app()) { | 358 if (install_checker_.extension()->is_app()) { |
| 369 // If the app was downloaded, apps_require_extension_mime_type_ | 359 // If the app was downloaded, apps_require_extension_mime_type_ |
| 370 // will be set. In this case, check that it was served with the | 360 // will be set. In this case, check that it was served with the |
| 371 // right mime type. Make an exception for file URLs, which come | 361 // right mime type. Make an exception for file URLs, which come |
| 372 // from the users computer and have no headers. | 362 // from the users computer and have no headers. |
| 373 if (!download_url_.SchemeIsFile() && | 363 if (!download_url_.SchemeIsFile() && |
| 374 apps_require_extension_mime_type_ && | 364 apps_require_extension_mime_type_ && |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 918 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( | 908 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( |
| 919 service->profile(), extension()); | 909 service->profile(), extension()); |
| 920 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this), | 910 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this), |
| 921 extension(), nullptr, | 911 extension(), nullptr, |
| 922 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), | 912 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), |
| 923 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 913 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| 924 } | 914 } |
| 925 } | 915 } |
| 926 | 916 |
| 927 } // namespace extensions | 917 } // namespace extensions |
| OLD | NEW |