Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/extensions/default_apps.h

Issue 6162006: Changes to default apps promo per ui leads: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 13
14 class PrefService; 14 class PrefService;
15 15
16 // Encapsulates business logic for: 16 // Encapsulates business logic for:
17 // - Whether to install default apps on Chrome startup 17 // - Whether to install default apps on Chrome startup
18 // - Whether to show the app launcher 18 // - Whether to show the app launcher
19 // - Whether to show the apps promo in the launcher 19 // - Whether to show the apps promo in the launcher
20 class DefaultApps { 20 class DefaultApps {
21 public: 21 public:
22 // The maximum number of times to show the apps promo. 22 // The maximum number of times to show the apps promo. The promo counter
23 // actually goes up to this number + 1 because we need to differentiate
24 // between the first time we overflow and subsequent times.
23 static const int kAppsPromoCounterMax; 25 static const int kAppsPromoCounterMax;
24 26
25 // Register our preferences. 27 // Register our preferences.
26 static void RegisterUserPrefs(PrefService* prefs); 28 static void RegisterUserPrefs(PrefService* prefs);
27 29
28 explicit DefaultApps(PrefService* prefs, 30 explicit DefaultApps(PrefService* prefs,
29 const std::string& application_locale); 31 const std::string& application_locale);
30 ~DefaultApps(); 32 ~DefaultApps();
31 33
32 // Gets the set of default apps. 34 // Gets the set of default apps.
33 const ExtensionIdSet& default_apps() const; 35 const ExtensionIdSet& default_apps() const;
34 36
35 // Returns true if the default apps should be installed. 37 // Returns true if the default apps should be installed.
36 bool ShouldInstallDefaultApps(const ExtensionIdSet& installed_ids); 38 bool ShouldInstallDefaultApps(const ExtensionIdSet& installed_ids);
37 39
38 // Returns true if the app launcher in the NTP should be shown. 40 // Returns true if the app launcher in the NTP should be shown.
39 bool ShouldShowAppLauncher(const ExtensionIdSet& installed_ids); 41 bool ShouldShowAppLauncher(const ExtensionIdSet& installed_ids);
40 42
41 // Returns true if the apps promo should be displayed in the launcher. 43 // Returns true if the apps promo should be displayed in the launcher.
42 // 44 //
43 // NOTE: If the default apps have been installed, but |installed_ids| is 45 // NOTE: If the default apps have been installed, but |installed_ids| is
44 // different than GetDefaultApps(), this will permanently expire the promo. 46 // different than GetDefaultApps(), this will permanently expire the promo.
45 bool ShouldShowPromo(const ExtensionIdSet& installed_ids); 47 bool ShouldShowPromo(const ExtensionIdSet& installed_ids, bool* just_expired);
46 48
47 // Should be called after each app is installed. Once installed_ids contains 49 // Should be called after each app is installed. Once installed_ids contains
48 // all the default apps, GetAppsToInstall() will start returning NULL. 50 // all the default apps, GetAppsToInstall() will start returning NULL.
49 void DidInstallApp(const ExtensionIdSet& installed_ids); 51 void DidInstallApp(const ExtensionIdSet& installed_ids);
50 52
51 // Should be called after each time the promo is installed.
52 void DidShowPromo();
53
54 // Force the promo to be hidden. 53 // Force the promo to be hidden.
55 void SetPromoHidden(); 54 void SetPromoHidden();
56 55
57 private: 56 private:
58 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HappyPath); 57 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HappyPath);
59 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, UnsupportedLocale); 58 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, UnsupportedLocale);
60 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HidePromo); 59 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HidePromo);
61 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, InstallingAnAppHidesPromo); 60 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, InstallingAnAppHidesPromo);
62 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, 61 FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps,
63 ManualAppInstalledWhileInstallingDefaultApps); 62 ManualAppInstalledWhileInstallingDefaultApps);
(...skipping 16 matching lines...) Expand all
80 std::string application_locale_; 79 std::string application_locale_;
81 80
82 // The set of default extensions. Initialized to a static list in the 81 // The set of default extensions. Initialized to a static list in the
83 // constructor. 82 // constructor.
84 ExtensionIdSet ids_; 83 ExtensionIdSet ids_;
85 84
86 DISALLOW_COPY_AND_ASSIGN(DefaultApps); 85 DISALLOW_COPY_AND_ASSIGN(DefaultApps);
87 }; 86 };
88 87
89 #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_ 88 #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_H_
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/shown_sections_handler.cc ('k') | chrome/browser/extensions/default_apps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698