| 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 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/auto_reset.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 | 14 |
| 14 class ExtensionInstallPrompt; | 15 class ExtensionInstallPrompt; |
| 15 class Profile; | 16 class Profile; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class DownloadItem; | 19 class DownloadItem; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 // 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 |
| 46 // scripts to be extension downloads, since we convert those automatically. | 47 // scripts to be extension downloads, since we convert those automatically. |
| 47 bool IsExtensionDownload(const content::DownloadItem& download_item); | 48 bool IsExtensionDownload(const content::DownloadItem& download_item); |
| 48 | 49 |
| 49 // 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 |
| 50 // installation site is whitelisted in prefs. | 51 // installation site is whitelisted in prefs. |
| 51 bool OffStoreInstallAllowedByPrefs(Profile* profile, | 52 bool OffStoreInstallAllowedByPrefs(Profile* profile, |
| 52 const content::DownloadItem& item); | 53 const content::DownloadItem& item); |
| 53 | 54 |
| 55 // Allows tests to override whether offstore extension installs are allowed |
| 56 // for testing purposes. |
| 57 std::unique_ptr<base::AutoReset<bool>> OverrideOffstoreInstallAllowedForTesting( |
| 58 bool allowed); |
| 59 |
| 54 } // namespace download_crx_util | 60 } // namespace download_crx_util |
| 55 | 61 |
| 56 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ | 62 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_ |
| OLD | NEW |