[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 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, ...). |
| 6 | |
| 7 | #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
| 8 | #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #include "base/basictypes.h" |
[email protected] | bf2fcd5 | 2012-04-16 22:59:39 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 14 | |
| 15 | class CrxInstaller; |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 16 | class ExtensionInstallUI; |
| 17 | class Profile; |
| 18 | |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 19 | namespace content { |
| 20 | class DownloadItem; |
| 21 | } |
| 22 | |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 23 | namespace download_crx_util { |
| 24 | |
| 25 | // Allow tests to install a mock extension install UI object, to fake |
| 26 | // 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 |
| 28 | // installs, you need to call this function once before the first |
| 29 | // install, and again after the first install and before the second. |
| 30 | void SetMockInstallUIForTesting(ExtensionInstallUI* mock_ui); |
| 31 | |
[email protected] | adcf0f0 | 2012-05-02 20:24:50 | [diff] [blame^] | 32 | // Returns true if the specified download_item containing an extension should be |
| 33 | // automatically installed. This is typically true in the case of webstore |
| 34 | // installations. |
| 35 | bool ShouldOpenExtensionDownload(const content::DownloadItem& download_item); |
| 36 | |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 37 | // Start installing a downloaded item item as a CRX (extension, theme, app, |
| 38 | // ...). The installer does work on the file thread, so the installation |
| 39 | // is not complete when this function returns. Returns the object managing |
| 40 | // the installation. |
| 41 | scoped_refptr<CrxInstaller> OpenChromeExtension( |
| 42 | Profile* profile, |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 43 | const content::DownloadItem& download_item); |
[email protected] | 7054b59 | 2011-06-22 14:46:42 | [diff] [blame] | 44 | |
| 45 | } // namespace download_crx_util |
| 46 | |
| 47 | #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |