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
3 // found in the LICENSE file.
5 // Download code which handles CRX files (extensions, themes, apps, ...).
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
15 class ExtensionInstallPrompt
;
22 namespace extensions
{
26 namespace download_crx_util
{
28 // Allow tests to install a mock ExtensionInstallPrompt object, to fake
29 // user clicks on the permissions dialog.
30 void SetMockInstallPromptForTesting(
31 scoped_ptr
<ExtensionInstallPrompt
> mock_prompt
);
33 // Start installing a downloaded item item as a CRX (extension, theme, app,
34 // ...). The installer does work on the file thread, so the installation
35 // is not complete when this function returns. Returns the object managing
37 scoped_refptr
<extensions::CrxInstaller
> OpenChromeExtension(
39 const content::DownloadItem
& download_item
);
41 // Returns true if this is an extension download. This also considers user
42 // scripts to be extension downloads, since we convert those automatically.
43 bool IsExtensionDownload(const content::DownloadItem
& download_item
);
45 // Checks whether an extension download should be allowed to proceed because the
46 // installation site is whitelisted in prefs.
47 bool OffStoreInstallAllowedByPrefs(Profile
* profile
,
48 const content::DownloadItem
& item
);
50 } // namespace download_crx_util
52 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_