Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / download / download_crx_util.h
blobcc99c1956c8dfc8c2208e9d28b6cf4b659aaee5d
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.
4 //
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;
16 class Profile;
18 namespace content {
19 class DownloadItem;
22 namespace extensions {
23 class CrxInstaller;
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 // Create and pre-configure a CrxInstaller for a given |download_item|.
34 scoped_refptr<extensions::CrxInstaller> CreateCrxInstaller(
35 Profile* profile,
36 const content::DownloadItem& download_item);
38 // Start installing a downloaded item item as a CRX (extension, theme, app,
39 // ...). The installer does work on the file thread, so the installation
40 // is not complete when this function returns. Returns the object managing
41 // the installation.
42 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension(
43 Profile* profile,
44 const content::DownloadItem& download_item);
46 // Returns true if this is an extension download. This also considers user
47 // scripts to be extension downloads, since we convert those automatically.
48 bool IsExtensionDownload(const content::DownloadItem& download_item);
50 // Checks whether an extension download should be allowed to proceed because the
51 // installation site is whitelisted in prefs.
52 bool OffStoreInstallAllowedByPrefs(Profile* profile,
53 const content::DownloadItem& item);
55 } // namespace download_crx_util
57 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_