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

Side by Side Diff: chrome/browser/download/download_crx_util.cc

Issue 1090323003: [chrome/browser/download] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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 // Download code which handles CRX files (extensions, themes, apps, ...). 5 // Download code which handles CRX files (extensions, themes, apps, ...).
6 6
7 #include "chrome/browser/download/download_crx_util.h" 7 #include "chrome/browser/download/download_crx_util.h"
8 8
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/crx_installer.h" 10 #include "chrome/browser/extensions/crx_installer.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); 87 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);
88 installer->set_original_mime_type(download_item.GetOriginalMimeType()); 88 installer->set_original_mime_type(download_item.GetOriginalMimeType());
89 installer->set_apps_require_extension_mime_type(true); 89 installer->set_apps_require_extension_mime_type(true);
90 90
91 return installer; 91 return installer;
92 } 92 }
93 93
94 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( 94 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension(
95 Profile* profile, 95 Profile* profile,
96 const DownloadItem& download_item) { 96 const DownloadItem& download_item) {
97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 97 DCHECK_CURRENTLY_ON(BrowserThread::UI);
98 98
99 scoped_refptr<extensions::CrxInstaller> installer( 99 scoped_refptr<extensions::CrxInstaller> installer(
100 CreateCrxInstaller(profile, download_item)); 100 CreateCrxInstaller(profile, download_item));
101 101
102 if (OffStoreInstallAllowedByPrefs(profile, download_item)) { 102 if (OffStoreInstallAllowedByPrefs(profile, download_item)) {
103 installer->set_off_store_install_allow_reason( 103 installer->set_off_store_install_allow_reason(
104 extensions::CrxInstaller::OffStoreInstallAllowedBecausePref); 104 extensions::CrxInstaller::OffStoreInstallAllowedBecausePref);
105 } 105 }
106 106
107 if (extensions::UserScript::IsURLUserScript(download_item.GetURL(), 107 if (extensions::UserScript::IsURLUserScript(download_item.GetURL(),
(...skipping 24 matching lines...) Expand all
132 132
133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { 133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
134 // TODO(aa): RefererURL is cleared in some cases, for example when going 134 // TODO(aa): RefererURL is cleared in some cases, for example when going
135 // between secure and non-secure URLs. It would be better if DownloadItem 135 // between secure and non-secure URLs. It would be better if DownloadItem
136 // tracked the initiating page explicitly. 136 // tracked the initiating page explicitly.
137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) 137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); 138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
139 } 139 }
140 140
141 } // namespace download_crx_util 141 } // namespace download_crx_util
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698