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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 extensions_enabled_(frontend_weak->extensions_enabled()), | 91 extensions_enabled_(frontend_weak->extensions_enabled()), |
92 delete_source_(false), | 92 delete_source_(false), |
93 create_app_shortcut_(false), | 93 create_app_shortcut_(false), |
94 frontend_weak_(frontend_weak), | 94 frontend_weak_(frontend_weak), |
95 profile_(frontend_weak->profile()), | 95 profile_(frontend_weak->profile()), |
96 client_(client), | 96 client_(client), |
97 apps_require_extension_mime_type_(false), | 97 apps_require_extension_mime_type_(false), |
98 allow_silent_install_(false), | 98 allow_silent_install_(false), |
99 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 99 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
100 creation_flags_(Extension::NO_FLAGS), | 100 creation_flags_(Extension::NO_FLAGS), |
101 allow_off_store_install_(false) { | 101 off_store_install_allow_reason_(OffStoreInstallDisallowed) { |
102 if (!approval) | 102 if (!approval) |
103 return; | 103 return; |
104 | 104 |
105 CHECK(profile_->IsSameProfile(approval->profile)); | 105 CHECK(profile_->IsSameProfile(approval->profile)); |
106 client_->install_ui()->SetUseAppInstalledBubble( | 106 client_->install_ui()->SetUseAppInstalledBubble( |
107 approval->use_app_installed_bubble); | 107 approval->use_app_installed_bubble); |
108 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui); | 108 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui); |
109 | 109 |
110 if (approval->skip_install_dialog) { | 110 if (approval->skip_install_dialog) { |
111 // Mark the extension as approved, but save the expected manifest and ID | 111 // Mark the extension as approved, but save the expected manifest and ID |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 NumOffStoreInstallDecision); | 253 NumOffStoreInstallDecision); |
254 } else { | 254 } else { |
255 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, | 255 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, |
256 NumOffStoreInstallDecision); | 256 NumOffStoreInstallDecision); |
257 } | 257 } |
258 } else { | 258 } else { |
259 const char* kHistogramName = "Extensions.OffStoreInstallDecisionHard"; | 259 const char* kHistogramName = "Extensions.OffStoreInstallDecisionHard"; |
260 if (is_gallery_install()) { | 260 if (is_gallery_install()) { |
261 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OnStoreInstall, | 261 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OnStoreInstall, |
262 NumOffStoreInstallDecision); | 262 NumOffStoreInstallDecision); |
263 } else if (allow_off_store_install_) { | 263 } else if (off_store_install_allow_reason_ != OffStoreInstallDisallowed) { |
264 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, | 264 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, |
265 NumOffStoreInstallDecision); | 265 NumOffStoreInstallDecision); |
| 266 UMA_HISTOGRAM_ENUMERATION("Extensions.OffStoreInstallAllowReason", |
| 267 off_store_install_allow_reason_, |
| 268 NumOffStoreInstallAllowReasons); |
266 } else { | 269 } else { |
267 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallDisallowed, | 270 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallDisallowed, |
268 NumOffStoreInstallDecision); | 271 NumOffStoreInstallDecision); |
269 *error = l10n_util::GetStringUTF16( | 272 *error = l10n_util::GetStringUTF16( |
270 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE); | 273 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE); |
271 return false; | 274 return false; |
272 } | 275 } |
273 } | 276 } |
274 } | 277 } |
275 | 278 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 // Some users (such as the download shelf) need to know when a | 600 // Some users (such as the download shelf) need to know when a |
598 // CRXInstaller is done. Listening for the EXTENSION_* events | 601 // CRXInstaller is done. Listening for the EXTENSION_* events |
599 // is problematic because they don't know anything about the | 602 // is problematic because they don't know anything about the |
600 // extension before it is unpacked, so they cannot filter based | 603 // extension before it is unpacked, so they cannot filter based |
601 // on the extension. | 604 // on the extension. |
602 content::NotificationService::current()->Notify( | 605 content::NotificationService::current()->Notify( |
603 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 606 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
604 content::Source<CrxInstaller>(this), | 607 content::Source<CrxInstaller>(this), |
605 content::Details<const Extension>(extension)); | 608 content::Details<const Extension>(extension)); |
606 } | 609 } |
OLD | NEW |