| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 explicit DefaultApps(PrefService* prefs); | 39 explicit DefaultApps(PrefService* prefs); |
| 40 ~DefaultApps(); | 40 ~DefaultApps(); |
| 41 | 41 |
| 42 // Gets the list of default apps that should be installed. Can return NULL if | 42 // Gets the list of default apps that should be installed. Can return NULL if |
| 43 // no apps need to be installed. | 43 // no apps need to be installed. |
| 44 const ExtensionIdSet* GetAppsToInstall() const; | 44 const ExtensionIdSet* GetAppsToInstall() const; |
| 45 | 45 |
| 46 // Gets the list of default apps. | 46 // Gets the list of default apps. |
| 47 const ExtensionIdSet* GetDefaultApps() const; | 47 const ExtensionIdSet* GetDefaultApps() const; |
| 48 | 48 |
| 49 // Returns true if the default apps have been installed. False otherwise. |
| 50 bool GetDefaultAppsInstalled() const; |
| 51 |
| 49 // Should be called after each app is installed. Once installed_ids contains | 52 // Should be called after each app is installed. Once installed_ids contains |
| 50 // all the default apps, GetAppsToInstall() will start returning NULL. | 53 // all the default apps, GetAppsToInstall() will start returning NULL. |
| 51 void DidInstallApp(const ExtensionIdSet& installed_ids); | 54 void DidInstallApp(const ExtensionIdSet& installed_ids); |
| 52 | 55 |
| 53 // Returns true if the apps promo should be displayed in the launcher. | 56 // Returns true if the apps promo should be displayed in the launcher. |
| 54 // | 57 // |
| 55 // NOTE: If the default apps have been installed, but |installed_ids| is | 58 // NOTE: If the default apps have been installed, but |installed_ids| is |
| 56 // different than GetDefaultApps(), this will permanently expire the promo. | 59 // different than GetDefaultApps(), this will permanently expire the promo. |
| 57 bool CheckShouldShowPromo(const ExtensionIdSet& installed_ids); | 60 bool CheckShouldShowPromo(const ExtensionIdSet& installed_ids); |
| 58 | 61 |
| 59 // Should be called after each time the promo is installed. | 62 // Should be called after each time the promo is installed. |
| 60 void DidShowPromo(); | 63 void DidShowPromo(); |
| 61 | 64 |
| 62 // Force the promo to be hidden. | 65 // Force the promo to be hidden. |
| 63 void SetPromoHidden(); | 66 void SetPromoHidden(); |
| 64 | 67 |
| 65 private: | 68 private: |
| 66 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, Basics); | 69 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, Basics); |
| 67 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HidePromo); | 70 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HidePromo); |
| 68 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, InstallingAnAppHidesPromo); | 71 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, InstallingAnAppHidesPromo); |
| 69 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, | 72 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, |
| 70 ManualAppInstalledWhileInstallingDefaultApps); | 73 ManualAppInstalledWhileInstallingDefaultApps); |
| 71 | 74 |
| 72 bool GetDefaultAppsInstalled() const; | |
| 73 void SetDefaultAppsInstalled(bool val); | 75 void SetDefaultAppsInstalled(bool val); |
| 74 | 76 |
| 75 int GetPromoCounter() const; | 77 int GetPromoCounter() const; |
| 76 void SetPromoCounter(int val); | 78 void SetPromoCounter(int val); |
| 77 | 79 |
| 78 // Our permanent state is stored in this PrefService instance. | 80 // Our permanent state is stored in this PrefService instance. |
| 79 PrefService* prefs_; | 81 PrefService* prefs_; |
| 80 | 82 |
| 81 // The set of default extensions. Initialized to a static list in the | 83 // The set of default extensions. Initialized to a static list in the |
| 82 // constructor. | 84 // constructor. |
| 83 ExtensionIdSet ids_; | 85 ExtensionIdSet ids_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(DefaultApps); | 87 DISALLOW_COPY_AND_ASSIGN(DefaultApps); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ | 90 #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ |
| OLD | NEW |