OLD | NEW |
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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
9 | 9 |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 class CrxInstaller; | 23 class CrxInstaller; |
24 } | 24 } |
25 | 25 |
26 namespace download_crx_util { | 26 namespace download_crx_util { |
27 | 27 |
28 // Allow tests to install a mock ExtensionInstallPrompt object, to fake | 28 // Allow tests to install a mock ExtensionInstallPrompt object, to fake |
29 // user clicks on the permissions dialog. | 29 // user clicks on the permissions dialog. |
30 void SetMockInstallPromptForTesting( | 30 void SetMockInstallPromptForTesting( |
31 scoped_ptr<ExtensionInstallPrompt> mock_prompt); | 31 scoped_ptr<ExtensionInstallPrompt> mock_prompt); |
32 | 32 |
| 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); |
| 37 |
33 // Start installing a downloaded item item as a CRX (extension, theme, app, | 38 // Start installing a downloaded item item as a CRX (extension, theme, app, |
34 // ...). The installer does work on the file thread, so the installation | 39 // ...). The installer does work on the file thread, so the installation |
35 // is not complete when this function returns. Returns the object managing | 40 // is not complete when this function returns. Returns the object managing |
36 // the installation. | 41 // the installation. |
37 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( | 42 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( |
38 Profile* profile, | 43 Profile* profile, |
39 const content::DownloadItem& download_item); | 44 const content::DownloadItem& download_item); |
40 | 45 |
41 // Returns true if this is an extension download. This also considers user | 46 // Returns true if this is an extension download. This also considers user |
42 // scripts to be extension downloads, since we convert those automatically. | 47 // scripts to be extension downloads, since we convert those automatically. |
43 bool IsExtensionDownload(const content::DownloadItem& download_item); | 48 bool IsExtensionDownload(const content::DownloadItem& download_item); |
44 | 49 |
45 // Checks whether an extension download should be allowed to proceed because the | 50 // Checks whether an extension download should be allowed to proceed because the |
46 // installation site is whitelisted in prefs. | 51 // installation site is whitelisted in prefs. |
47 bool OffStoreInstallAllowedByPrefs(Profile* profile, | 52 bool OffStoreInstallAllowedByPrefs(Profile* profile, |
48 const content::DownloadItem& item); | 53 const content::DownloadItem& item); |
49 | 54 |
50 } // namespace download_crx_util | 55 } // namespace download_crx_util |
51 | 56 |
52 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 57 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
OLD | NEW |