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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 | 13 |
14 class CrxInstaller; | |
15 class ExtensionInstallPrompt; | 14 class ExtensionInstallPrompt; |
16 class Profile; | 15 class Profile; |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class DownloadItem; | 18 class DownloadItem; |
20 } | 19 } |
21 | 20 |
| 21 namespace extensions { |
| 22 class CrxInstaller; |
| 23 } |
| 24 |
22 namespace download_crx_util { | 25 namespace download_crx_util { |
23 | 26 |
24 // Allow tests to install a mock ExtensionInstallPrompt object, to fake | 27 // Allow tests to install a mock ExtensionInstallPrompt object, to fake |
25 // user clicks on the permissions dialog. Each installed mock object | 28 // user clicks on the permissions dialog. Each installed mock object |
26 // is only used once. If you want to return a mock for two different | 29 // is only used once. If you want to return a mock for two different |
27 // installs, you need to call this function once before the first | 30 // installs, you need to call this function once before the first |
28 // install, and again after the first install and before the second. | 31 // install, and again after the first install and before the second. |
29 void SetMockInstallPromptForTesting(ExtensionInstallPrompt* mock_prompt); | 32 void SetMockInstallPromptForTesting(ExtensionInstallPrompt* mock_prompt); |
30 | 33 |
31 // Start installing a downloaded item item as a CRX (extension, theme, app, | 34 // Start installing a downloaded item item as a CRX (extension, theme, app, |
32 // ...). The installer does work on the file thread, so the installation | 35 // ...). The installer does work on the file thread, so the installation |
33 // is not complete when this function returns. Returns the object managing | 36 // is not complete when this function returns. Returns the object managing |
34 // the installation. | 37 // the installation. |
35 scoped_refptr<CrxInstaller> OpenChromeExtension( | 38 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( |
36 Profile* profile, | 39 Profile* profile, |
37 const content::DownloadItem& download_item); | 40 const content::DownloadItem& download_item); |
38 | 41 |
39 // Returns true if this is an extension download. This also considers user | 42 // Returns true if this is an extension download. This also considers user |
40 // scripts to be extension downloads, since we convert those automatically. | 43 // scripts to be extension downloads, since we convert those automatically. |
41 bool IsExtensionDownload(const content::DownloadItem& download_item); | 44 bool IsExtensionDownload(const content::DownloadItem& download_item); |
42 | 45 |
43 } // namespace download_crx_util | 46 } // namespace download_crx_util |
44 | 47 |
45 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 48 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
OLD | NEW |