| 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; | 15 class CrxInstaller; |
| 16 class ExtensionInstallUI; | 16 class ExtensionInstallUI; |
| 17 class ExtensionService; |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class DownloadItem; | 21 class DownloadItem; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace download_crx_util { | 24 namespace download_crx_util { |
| 24 | 25 |
| 25 // Allow tests to install a mock extension install UI object, to fake | 26 // Allow tests to install a mock extension install UI object, to fake |
| 26 // user clicks on the permissions dialog. Each installed mock object | 27 // 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 // 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 // installs, you need to call this function once before the first |
| 29 // install, and again after the first install and before the second. | 30 // install, and again after the first install and before the second. |
| 30 void SetMockInstallUIForTesting(ExtensionInstallUI* mock_ui); | 31 void SetMockInstallUIForTesting(ExtensionInstallUI* mock_ui); |
| 31 | 32 |
| 32 // Returns true if the specified download_item containing an extension should be | 33 // 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 // automatically installed. This is typically true in the case of webstore |
| 34 // installations. | 35 // installations. |
| 35 bool ShouldOpenExtensionDownload(const content::DownloadItem& download_item); | 36 bool ShouldOpenExtensionDownload(ExtensionService* service, |
| 37 const content::DownloadItem& download_item); |
| 36 | 38 |
| 37 // Start installing a downloaded item item as a CRX (extension, theme, app, | 39 // Start installing a downloaded item item as a CRX (extension, theme, app, |
| 38 // ...). The installer does work on the file thread, so the installation | 40 // ...). The installer does work on the file thread, so the installation |
| 39 // is not complete when this function returns. Returns the object managing | 41 // is not complete when this function returns. Returns the object managing |
| 40 // the installation. | 42 // the installation. |
| 41 scoped_refptr<CrxInstaller> OpenChromeExtension( | 43 scoped_refptr<CrxInstaller> OpenChromeExtension( |
| 42 Profile* profile, | 44 Profile* profile, |
| 43 const content::DownloadItem& download_item); | 45 const content::DownloadItem& download_item); |
| 44 | 46 |
| 45 } // namespace download_crx_util | 47 } // namespace download_crx_util |
| 46 | 48 |
| 47 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 49 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
| OLD | NEW |