| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SYNC_PROMO_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_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 "content/public/browser/web_ui_controller.h" | 9 #include "content/public/browser/web_ui_controller.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 class PrefService; | 12 class PrefService; |
| 13 | 13 |
| 14 // The Web UI handler for chrome://signin. | 14 // The Web UI handler for chrome://signin. |
| 15 class SyncPromoUI : public content::WebUIController { | 15 class SyncPromoUI : public content::WebUIController { |
| 16 public: | 16 public: |
| 17 enum Version { | |
| 18 VERSION_DEFAULT = 0, | |
| 19 VERSION_DEVICES, | |
| 20 VERSION_VERBOSE, | |
| 21 VERSION_SIMPLE, | |
| 22 VERSION_DIALOG, | |
| 23 VERSION_COUNT, | |
| 24 }; | |
| 25 | |
| 26 // Constructs a SyncPromoUI. | 17 // Constructs a SyncPromoUI. |
| 27 explicit SyncPromoUI(content::WebUI* web_ui); | 18 explicit SyncPromoUI(content::WebUI* web_ui); |
| 28 | 19 |
| 29 // Returns true if the sync promo should be visible. | 20 // Returns true if the sync promo should be visible. |
| 30 // |profile| is the profile of the tab the promo would be shown on. | 21 // |profile| is the profile of the tab the promo would be shown on. |
| 31 static bool ShouldShowSyncPromo(Profile* profile); | 22 static bool ShouldShowSyncPromo(Profile* profile); |
| 32 | 23 |
| 33 // Returns true if we should show the sync promo at startup. | 24 // Returns true if we should show the sync promo at startup. |
| 34 // On return |promo_suppressed| is true if a sync promo would normally | |
| 35 // have been shown but was suppressed due to a experiment. | |
| 36 static bool ShouldShowSyncPromoAtStartup(Profile* profile, | 25 static bool ShouldShowSyncPromoAtStartup(Profile* profile, |
| 37 bool is_new_profile, | 26 bool is_new_profile); |
| 38 bool* promo_suppressed); | |
| 39 | 27 |
| 40 // Called when the sync promo has been shown so that we can keep track | 28 // Called when the sync promo has been shown so that we can keep track |
| 41 // of the number of times we've displayed it. | 29 // of the number of times we've displayed it. |
| 42 static void DidShowSyncPromoAtStartup(Profile* profile); | 30 static void DidShowSyncPromoAtStartup(Profile* profile); |
| 43 | 31 |
| 44 // Returns true if a user has seen the sync promo at startup previously. | 32 // Returns true if a user has seen the sync promo at startup previously. |
| 45 static bool HasShownPromoAtStartup(Profile* profile); | 33 static bool HasShownPromoAtStartup(Profile* profile); |
| 46 | 34 |
| 47 // Returns true if the user has previously skipped the sync promo. | 35 // Returns true if the user has previously skipped the sync promo. |
| 48 static bool HasUserSkippedSyncPromo(Profile* profile); | 36 static bool HasUserSkippedSyncPromo(Profile* profile); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 | 54 |
| 67 // Gets the is launch page value from the query portion of the sync promo URL. | 55 // Gets the is launch page value from the query portion of the sync promo URL. |
| 68 static bool GetIsLaunchPageForSyncPromoURL(const GURL& url); | 56 static bool GetIsLaunchPageForSyncPromoURL(const GURL& url); |
| 69 | 57 |
| 70 // Gets the next page URL from the query portion of the sync promo URL. | 58 // Gets the next page URL from the query portion of the sync promo URL. |
| 71 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); | 59 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); |
| 72 | 60 |
| 73 // Gets the source from the query portion of the sync promo URL. | 61 // Gets the source from the query portion of the sync promo URL. |
| 74 static std::string GetSourceForSyncPromoURL(const GURL& url); | 62 static std::string GetSourceForSyncPromoURL(const GURL& url); |
| 75 | 63 |
| 76 // Returns the version of the sync promo UI that we should display. | |
| 77 // Each version changes the UI slightly (for example, replacing text with | |
| 78 // an infographic). | |
| 79 static Version GetSyncPromoVersion(); | |
| 80 | |
| 81 private: | 64 private: |
| 82 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); | 65 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); |
| 83 }; | 66 }; |
| 84 | 67 |
| 85 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ | 68 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
| OLD | NEW |