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

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

Issue 10448037: Fix regression when off-store install is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 approved_(false), 76 approved_(false),
77 extensions_enabled_(frontend_weak->extensions_enabled()), 77 extensions_enabled_(frontend_weak->extensions_enabled()),
78 delete_source_(false), 78 delete_source_(false),
79 create_app_shortcut_(false), 79 create_app_shortcut_(false),
80 frontend_weak_(frontend_weak), 80 frontend_weak_(frontend_weak),
81 profile_(frontend_weak->profile()), 81 profile_(frontend_weak->profile()),
82 client_(client), 82 client_(client),
83 apps_require_extension_mime_type_(false), 83 apps_require_extension_mime_type_(false),
84 allow_silent_install_(false), 84 allow_silent_install_(false),
85 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), 85 install_cause_(extension_misc::INSTALL_CAUSE_UNSET),
86 creation_flags_(Extension::NO_FLAGS) { 86 creation_flags_(Extension::NO_FLAGS),
87 allow_off_store_install_(false) {
87 if (!approval) 88 if (!approval)
88 return; 89 return;
89 90
90 CHECK(profile_->IsSameProfile(approval->profile)); 91 CHECK(profile_->IsSameProfile(approval->profile));
91 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble); 92 client_->set_use_app_installed_bubble(approval->use_app_installed_bubble);
92 client_->set_skip_post_install_ui(approval->skip_post_install_ui); 93 client_->set_skip_post_install_ui(approval->skip_post_install_ui);
93 94
94 if (approval->skip_install_dialog) { 95 if (approval->skip_install_dialog) {
95 // Mark the extension as approved, but save the expected manifest and ID 96 // Mark the extension as approved, but save the expected manifest and ID
96 // so we can check that they match the CRX's. 97 // so we can check that they match the CRX's.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension); 186 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension);
186 } 187 }
187 188
188 bool CrxInstaller::AllowInstall(const Extension* extension, 189 bool CrxInstaller::AllowInstall(const Extension* extension,
189 string16* error) { 190 string16* error) {
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
191 DCHECK(error); 192 DCHECK(error);
192 193
193 if (!extension->is_theme() && 194 if (!extension->is_theme() &&
194 !extensions::switch_utils::IsOffStoreInstallEnabled() && 195 !extensions::switch_utils::IsOffStoreInstallEnabled() &&
196 !allow_off_store_install_ &&
195 !is_gallery_install()) { 197 !is_gallery_install()) {
196 *error = l10n_util::GetStringUTF16( 198 *error = l10n_util::GetStringUTF16(
197 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE); 199 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE);
198 return false; 200 return false;
199 } 201 }
200 202
201 // Make sure the expected ID matches if one was supplied or if we want to 203 // Make sure the expected ID matches if one was supplied or if we want to
202 // bypass the prompt. 204 // bypass the prompt.
203 if ((approved_ || !expected_id_.empty()) && 205 if ((approved_ || !expected_id_.empty()) &&
204 expected_id_ != extension->id()) { 206 expected_id_ != extension->id()) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // Some users (such as the download shelf) need to know when a 562 // Some users (such as the download shelf) need to know when a
561 // CRXInstaller is done. Listening for the EXTENSION_* events 563 // CRXInstaller is done. Listening for the EXTENSION_* events
562 // is problematic because they don't know anything about the 564 // is problematic because they don't know anything about the
563 // extension before it is unpacked, so they cannot filter based 565 // extension before it is unpacked, so they cannot filter based
564 // on the extension. 566 // on the extension.
565 content::NotificationService::current()->Notify( 567 content::NotificationService::current()->Notify(
566 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 568 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
567 content::Source<CrxInstaller>(this), 569 content::Source<CrxInstaller>(this),
568 content::Details<const Extension>(extension)); 570 content::Details<const Extension>(extension));
569 } 571 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698