[email protected] | 5df038b | 2012-07-16 19:03:27 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [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 | #ifndef CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 7 | |
avi | a2f4804a | 2015-12-24 23:11:13 | [diff] [blame] | 8 | #include "base/macros.h" |
Matthew Denton | ef83a62 | 2019-08-30 02:07:00 | [diff] [blame] | 9 | #include "base/memory/scoped_refptr.h" |
[email protected] | 5df038b | 2012-07-16 19:03:27 | [diff] [blame] | 10 | #include "chrome/browser/extensions/external_provider_impl.h" |
[email protected] | d42c1115 | 2013-08-22 19:36:32 | [diff] [blame] | 11 | #include "extensions/common/manifest.h" |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 12 | |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 13 | class Profile; |
| 14 | |
[email protected] | 937cf9d | 2012-08-30 03:51:55 | [diff] [blame] | 15 | namespace base { |
| 16 | class DictionaryValue; |
| 17 | } |
| 18 | |
[email protected] | 443e931 | 2013-05-06 06:17:34 | [diff] [blame] | 19 | namespace user_prefs { |
| 20 | class PrefRegistrySyncable; |
| 21 | } |
| 22 | |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 23 | // Functions and types related to installing default apps. |
| 24 | namespace default_apps { |
| 25 | |
| 26 | // These enum values are persisted in the user preferences, so they should not |
| 27 | // be changed. |
| 28 | enum InstallState { |
| 29 | kUnknown, |
[email protected] | 910f72ce | 2012-08-24 01:38:35 | [diff] [blame] | 30 | // Now unused, left for backward compatibility. |
| 31 | kProvideLegacyDefaultApps, |
| 32 | kNeverInstallDefaultApps, |
| 33 | kAlreadyInstalledDefaultApps |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | // Register preference properties used by default apps to maintain |
| 37 | // install state. |
[email protected] | 37ca3fe0 | 2013-07-05 15:32:44 | [diff] [blame] | 38 | void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 39 | |
[email protected] | 5df038b | 2012-07-16 19:03:27 | [diff] [blame] | 40 | // A specialization of the ExternalProviderImpl that conditionally installs apps |
| 41 | // from the chrome::DIR_DEFAULT_APPS location based on a preference in the |
| 42 | // profile. |
| 43 | class Provider : public extensions::ExternalProviderImpl { |
[email protected] | d190cef | 2011-11-09 02:09:24 | [diff] [blame] | 44 | public: |
| 45 | Provider(Profile* profile, |
| 46 | VisitorInterface* service, |
Matthew Denton | ef83a62 | 2019-08-30 02:07:00 | [diff] [blame] | 47 | scoped_refptr<extensions::ExternalLoader> loader, |
[email protected] | 1d5e58b | 2013-01-31 08:41:40 | [diff] [blame] | 48 | extensions::Manifest::Location crx_location, |
| 49 | extensions::Manifest::Location download_location, |
[email protected] | d190cef | 2011-11-09 02:09:24 | [diff] [blame] | 50 | int creation_flags); |
| 51 | |
[email protected] | 937cf9d | 2012-08-30 03:51:55 | [diff] [blame] | 52 | bool ShouldInstallInProfile(); |
| 53 | |
[email protected] | 5df038b | 2012-07-16 19:03:27 | [diff] [blame] | 54 | // ExternalProviderImpl overrides: |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 55 | void VisitRegisteredExtension() override; |
Istiaque Ahmed | a7431b3 | 2017-08-20 18:33:37 | [diff] [blame] | 56 | void SetPrefs(std::unique_ptr<base::DictionaryValue> prefs) override; |
[email protected] | d190cef | 2011-11-09 02:09:24 | [diff] [blame] | 57 | |
| 58 | private: |
| 59 | Profile* profile_; |
[email protected] | 937cf9d | 2012-08-30 03:51:55 | [diff] [blame] | 60 | bool is_migration_; |
[email protected] | d190cef | 2011-11-09 02:09:24 | [diff] [blame] | 61 | |
| 62 | DISALLOW_COPY_AND_ASSIGN(Provider); |
| 63 | }; |
| 64 | |
[email protected] | 86c6b9e3 | 2011-10-25 17:09:10 | [diff] [blame] | 65 | } // namespace default_apps |
| 66 | |
| 67 | #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |