Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 10542048: Add a group policy controlling which sites can install extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 extensions_enabled_(frontend_weak->extensions_enabled()), 90 extensions_enabled_(frontend_weak->extensions_enabled()),
91 delete_source_(false), 91 delete_source_(false),
92 create_app_shortcut_(false), 92 create_app_shortcut_(false),
93 frontend_weak_(frontend_weak), 93 frontend_weak_(frontend_weak),
94 profile_(frontend_weak->profile()), 94 profile_(frontend_weak->profile()),
95 client_(client), 95 client_(client),
96 apps_require_extension_mime_type_(false), 96 apps_require_extension_mime_type_(false),
97 allow_silent_install_(false), 97 allow_silent_install_(false),
98 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), 98 install_cause_(extension_misc::INSTALL_CAUSE_UNSET),
99 creation_flags_(Extension::NO_FLAGS), 99 creation_flags_(Extension::NO_FLAGS),
100 allow_off_store_install_(false) { 100 off_store_install_allow_reason_(OffStoreInstallDisallowed) {
101 if (!approval) 101 if (!approval)
102 return; 102 return;
103 103
104 CHECK(profile_->IsSameProfile(approval->profile)); 104 CHECK(profile_->IsSameProfile(approval->profile));
105 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble); 105 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble);
106 client_->set_skip_post_install_ui(approval->skip_post_install_ui); 106 client_->set_skip_post_install_ui(approval->skip_post_install_ui);
107 107
108 if (approval->skip_install_dialog) { 108 if (approval->skip_install_dialog) {
109 // Mark the extension as approved, but save the expected manifest and ID 109 // Mark the extension as approved, but save the expected manifest and ID
110 // so we can check that they match the CRX's. 110 // so we can check that they match the CRX's.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 NumOffStoreInstallDecision); 251 NumOffStoreInstallDecision);
252 } else { 252 } else {
253 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, 253 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed,
254 NumOffStoreInstallDecision); 254 NumOffStoreInstallDecision);
255 } 255 }
256 } else { 256 } else {
257 const char* kHistogramName = "Extensions.OffStoreInstallDecisionHard"; 257 const char* kHistogramName = "Extensions.OffStoreInstallDecisionHard";
258 if (is_gallery_install()) { 258 if (is_gallery_install()) {
259 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OnStoreInstall, 259 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OnStoreInstall,
260 NumOffStoreInstallDecision); 260 NumOffStoreInstallDecision);
261 } else if (allow_off_store_install_) { 261 } else if (off_store_install_allow_reason_ != OffStoreInstallDisallowed) {
262 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed, 262 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallAllowed,
263 NumOffStoreInstallDecision); 263 NumOffStoreInstallDecision);
264 UMA_HISTOGRAM_ENUMERATION("Extensions.OffStoreInstallAllowReason",
265 off_store_install_allow_reason_,
266 NumOffStoreInstallAllowReasons);
264 } else { 267 } else {
265 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallDisallowed, 268 UMA_HISTOGRAM_ENUMERATION(kHistogramName, OffStoreInstallDisallowed,
266 NumOffStoreInstallDecision); 269 NumOffStoreInstallDecision);
267 *error = l10n_util::GetStringUTF16( 270 *error = l10n_util::GetStringUTF16(
268 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE); 271 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE);
269 return false; 272 return false;
270 } 273 }
271 } 274 }
272 } 275 }
273 276
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // Some users (such as the download shelf) need to know when a 597 // Some users (such as the download shelf) need to know when a
595 // CRXInstaller is done. Listening for the EXTENSION_* events 598 // CRXInstaller is done. Listening for the EXTENSION_* events
596 // is problematic because they don't know anything about the 599 // is problematic because they don't know anything about the
597 // extension before it is unpacked, so they cannot filter based 600 // extension before it is unpacked, so they cannot filter based
598 // on the extension. 601 // on the extension.
599 content::NotificationService::current()->Notify( 602 content::NotificationService::current()->Notify(
600 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 603 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
601 content::Source<CrxInstaller>(this), 604 content::Source<CrxInstaller>(this),
602 content::Details<const Extension>(extension)); 605 content::Details<const Extension>(extension));
603 } 606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698