Index: chrome/browser/extensions/webstore_installer.cc |
=================================================================== |
--- chrome/browser/extensions/webstore_installer.cc (revision 137574) |
+++ chrome/browser/extensions/webstore_installer.cc (working copy) |
@@ -124,30 +124,9 @@ |
WebstoreInstaller::Approval::Approval() |
: profile(NULL), |
use_app_installed_bubble(false), |
- skip_post_install_ui(false), |
- skip_install_dialog(false) { |
+ skip_post_install_ui(false) { |
} |
-scoped_ptr<WebstoreInstaller::Approval> |
-WebstoreInstaller::Approval::CreateWithInstallPrompt(Profile* profile) { |
- scoped_ptr<Approval> result(new Approval()); |
- result->profile = profile; |
- return result.Pass(); |
-} |
- |
-scoped_ptr<WebstoreInstaller::Approval> |
-WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
- Profile* profile, |
- const std::string& extension_id, |
- scoped_ptr<base::DictionaryValue> parsed_manifest) { |
- scoped_ptr<Approval> result(new Approval()); |
- result->extension_id = extension_id; |
- result->profile = profile; |
- result->parsed_manifest = parsed_manifest.Pass(); |
- result->skip_install_dialog = true; |
- return result.Pass(); |
-} |
- |
WebstoreInstaller::Approval::~Approval() {} |
const WebstoreInstaller::Approval* WebstoreInstaller::GetAssociatedApproval( |
@@ -306,6 +285,15 @@ |
return; |
} |
+ // TODO(mihaip): For inline installs, we pretend like the referrer is the |
+ // gallery, even though this could be an inline install, in order to pass the |
+ // checks in ExtensionService::IsDownloadFromGallery. We should instead pass |
+ // the real referrer, track if this is an inline install in the whitelist |
+ // entry and look that up when checking that this is a valid download. |
+ GURL referrer = controller_->GetActiveEntry()->GetURL(); |
+ if (flags_ & FLAG_INLINE_INSTALL) |
+ referrer = GURL(extension_urls::GetWebstoreItemDetailURLPrefix() + id_); |
+ |
content::DownloadSaveInfo save_info; |
save_info.file_path = file; |
@@ -317,7 +305,7 @@ |
scoped_ptr<DownloadUrlParameters> params( |
DownloadUrlParameters::FromWebContents( |
controller_->GetWebContents(), download_url_, save_info)); |
- params->set_referrer(controller_->GetActiveEntry()->GetURL()); |
+ params->set_referrer(referrer); |
params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted, this)); |
profile_->GetDownloadManager()->DownloadUrl(params.Pass()); |
} |