OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_UI_WEBUI_SYNC_PROMO_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 class PrefService; | 12 class PrefService; |
13 | 13 |
14 // The Web UI handler for chrome://syncpromo. | 14 // The Web UI handler for chrome://syncpromo. |
15 class SyncPromoUI : public ChromeWebUI { | 15 class SyncPromoUI : public ChromeWebUI { |
16 public: | 16 public: |
17 // Constructs a SyncPromoUI. |contents| is the TabContents that this WebUI is | 17 // Constructs a SyncPromoUI. |contents| is the TabContents that this WebUI is |
18 // associated with. |contents| may not be NULL. | 18 // associated with. |contents| may not be NULL. |
19 explicit SyncPromoUI(TabContents* contents); | 19 explicit SyncPromoUI(TabContents* contents); |
20 | 20 |
21 // Returns true if the sync promo should be visible. | 21 // Returns true if the sync promo should be visible. |
22 // |profile| is the profile of the tab the promo would be shown on. | 22 // |profile| is the profile of the tab the promo would be shown on. |
23 static bool ShouldShowSyncPromo(Profile* profile); | 23 static bool ShouldShowSyncPromo(Profile* profile); |
24 | 24 |
25 // Returns true if we should show the sync promo at startup. | 25 // Returns true if we should show the sync promo at startup. |
26 static bool ShouldShowSyncPromoAtStartup(Profile* profile, | 26 static bool ShouldShowSyncPromoAtStartup(Profile* profile, |
27 bool is_new_profile); | 27 bool is_new_profile); |
28 | 28 |
29 // Called when the sync promo has been shown so that we can keep track | 29 // Called when the sync promo has been shown so that we can keep track |
30 // of the number of times we've displayed it. | 30 // of the number of times we've displayed it. |
31 static void DidShowSyncPromoAtStartup(Profile* profile); | 31 static void DidShowSyncPromoAtStartup(Profile* profile); |
32 | 32 |
| 33 // Returns true if a user has seen the sync promo at startup previously. |
| 34 static bool HasShownPromoAtStartup(Profile* profile); |
| 35 |
33 // Returns true if the user has previously skipped the sync promo. | 36 // Returns true if the user has previously skipped the sync promo. |
34 static bool HasUserSkippedSyncPromo(Profile* profile); | 37 static bool HasUserSkippedSyncPromo(Profile* profile); |
35 | 38 |
36 // Registers the fact that the user has skipped the sync promo. | 39 // Registers the fact that the user has skipped the sync promo. |
37 static void SetUserSkippedSyncPromo(Profile* profile); | 40 static void SetUserSkippedSyncPromo(Profile* profile); |
38 | 41 |
39 // Registers the preferences the Sync Promo UI needs. | 42 // Registers the preferences the Sync Promo UI needs. |
40 static void RegisterUserPrefs(PrefService* prefs); | 43 static void RegisterUserPrefs(PrefService* prefs); |
41 | 44 |
42 // Returns the sync promo URL wth the given arguments in the query. | 45 // Returns the sync promo URL wth the given arguments in the query. |
43 // |next_page| is the URL to navigate to when the user completes or skips the | 46 // |next_page| is the URL to navigate to when the user completes or skips the |
44 // promo. If an empty URL is given then the promo will navigate to the NTP. | 47 // promo. If an empty URL is given then the promo will navigate to the NTP. |
45 // If |show_title| is true then the promo title is made visible. | 48 // If |show_title| is true then the promo title is made visible. |
46 static GURL GetSyncPromoURL(const GURL& next_page, bool show_title); | 49 static GURL GetSyncPromoURL(const GURL& next_page, bool show_title); |
47 | 50 |
48 // Gets the is launch page value from the query portion of the sync promo URL. | 51 // Gets the is launch page value from the query portion of the sync promo URL. |
49 static bool GetIsLaunchPageForSyncPromoURL(const GURL& url); | 52 static bool GetIsLaunchPageForSyncPromoURL(const GURL& url); |
50 | 53 |
51 // Gets the next page URL from the query portion of the sync promo URL. | 54 // Gets the next page URL from the query portion of the sync promo URL. |
52 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); | 55 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); |
53 | 56 |
54 // Returns true if the sync promo page was ever shown at startup. | 57 // Returns true if the sync promo page was ever shown at startup. |
55 static bool UserHasSeenSyncPromoAtStartup(Profile* profile); | 58 static bool UserHasSeenSyncPromoAtStartup(Profile* profile); |
56 | 59 |
57 private: | 60 private: |
58 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); | 61 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); |
59 }; | 62 }; |
60 | 63 |
61 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_UI_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
OLD | NEW |