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

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

Issue 6825052: Update the web store promo to be clearer and configurable at run-time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate feedback. Update feed format. Remove first run tip for most visited section. Created 9 years, 8 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
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_APPS_PROMO_H_
6 #define CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11
12 #include "base/gtest_prod_util.h"
13 #include "chrome/common/extensions/extension.h"
14
15 class PrefService;
16
17 // This encapsulates business logic for:
18 // - Whether to show the apps promo in the launcher
19 // - Whether to expire existing default apps
20 class AppsPromo {
21 public:
22 // Register our preferences. Parts of the promo content are stored in Local
23 // State since they're independent of the user profile.
24 static void RegisterPrefs(PrefService* local_state);
25 static void RegisterUserPrefs(PrefService* prefs);
26
27 // Removes the current promo data.
28 static void ClearPromo();
29
30 // Gets the ID of the current promo.
31 static std::string GetPromoId();
32
33 // Gets the text for the promo button.
34 static std::string GetPromoButtonText();
35
36 // Gets the text for the promo header.
37 static std::string GetPromoHeaderText();
38
39 // Gets the promo link.
40 static GURL GetPromoLink();
41
42 // Gets the text for the promo "hide this" link.
43 static std::string GetPromoExpireText();
44
45 // Called to set the current promo data.
46 static void SetPromo(const std::string& id,
47 const std::string& header_text,
48 const std::string& button_text,
49 const GURL& link,
50 const std::string& expire_text);
51
52 explicit AppsPromo(PrefService* prefs);
53 ~AppsPromo();
54
55 // Gets the set of default apps that may have been installed by previous
56 // versions of Chrome.
57 const ExtensionIdSet& default_apps() const { return ids_; }
58
59 // Halts the special treatment of the default apps. The default apps may be
60 // removed by the caller after calling this method. If the apps remain
61 // installed, AppsPromo will no longer consider the apps "default".
62 void ExpireDefaultApps();
63
64 // Called to hide the promo from the apps section.
65 void HidePromo();
66
67 // Maximizes the apps section the first time this is called for a given promo.
68 void MaximizeAppsIfFirstView();
69
70 // Returns true if the app launcher should be displayed on the NTP.
71 bool ShouldShowAppLauncher(const ExtensionIdSet& installed_ids);
72
73 // Returns true if the apps promo should be displayed in the launcher.
74 bool ShouldShowPromo(const ExtensionIdSet& installed_ids,
75 bool* just_expired);
76
77 private:
78 FRIEND_TEST_ALL_PREFIXES(ExtensionAppsPromo, HappyPath);
79 FRIEND_TEST_ALL_PREFIXES(ExtensionAppsPromo, PromoPrefs);
80 FRIEND_TEST_ALL_PREFIXES(ExtensionAppsPromo, UpdatePromoFocus);
81
82 // The maximum number of times to show the apps promo. The promo counter
83 // actually goes up to this number + 1 because we need to differentiate
84 // between the first time we overflow and subsequent times.
85 static const int kDefaultAppsCounterMax;
86
87 // Returns true if a promo is available for the current locale.
88 static bool IsPromoSupportedForLocale();
89
90 bool GetDefaultAppsInstalled() const;
91
92 // Gets/sets the ID of the last promo shown.
93 std::string GetLastPromoId();
94 void SetLastPromoId(const std::string& id);
95
96 // Gets/sets the number of times the promo has been viewed. Promo views are
97 // only counted when the default apps are installed.
98 int GetPromoCounter() const;
99 void SetPromoCounter(int val);
100
101 // Our permanent state is stored in this PrefService instance.
102 PrefService* prefs_;
103
104 // The set of default extensions. Initialized to a static list in the
105 // constructor.
106 ExtensionIdSet ids_;
Aaron Boodman 2011/04/14 19:07:09 Since the primary purpose of this class is no long
107
108 DISALLOW_COPY_AND_ASSIGN(AppsPromo);
109 };
110
111 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698