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