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 | 7 |
8 #include "content/public/browser/web_ui_controller.h" | 8 #include "content/public/browser/web_ui_controller.h" |
9 | 9 |
10 class Profile; | 10 class Profile; |
11 class PrefService; | 11 class PrefService; |
12 | 12 |
13 // The Web UI handler for chrome://signin. | 13 // The Web UI handler for chrome://signin. |
14 class SyncPromoUI : public content::WebUIController { | 14 class SyncPromoUI : public content::WebUIController { |
15 public: | 15 public: |
16 enum Source { | 16 enum Source { |
17 SOURCE_START_PAGE = 0, // This must be first. | 17 SOURCE_START_PAGE = 0, // This must be first. |
18 SOURCE_NTP_LINK, | 18 SOURCE_NTP_LINK, |
19 SOURCE_MENU, | 19 SOURCE_MENU, |
20 SOURCE_EXTENSION_API, | |
sail
2012/07/20 22:43:45
Are you planning to use this later? I don't see a
Munjal (Google)
2012/07/20 23:04:35
Yeah, I am using it in a different patch. But actu
| |
20 SOURCE_UNKNOWN, // This must be last. | 21 SOURCE_UNKNOWN, // This must be last. |
21 }; | 22 }; |
22 | 23 |
23 // Constructs a SyncPromoUI. | 24 // Constructs a SyncPromoUI. |
24 explicit SyncPromoUI(content::WebUI* web_ui); | 25 explicit SyncPromoUI(content::WebUI* web_ui); |
25 | 26 |
26 // Returns true if the sync promo should be visible. | 27 // Returns true if the sync promo should be visible. |
27 // |profile| is the profile of the tab the promo would be shown on. | 28 // |profile| is the profile of the tab the promo would be shown on. |
28 static bool ShouldShowSyncPromo(Profile* profile); | 29 static bool ShouldShowSyncPromo(Profile* profile); |
29 | 30 |
(...skipping 15 matching lines...) Expand all Loading... | |
45 static void SetUserSkippedSyncPromo(Profile* profile); | 46 static void SetUserSkippedSyncPromo(Profile* profile); |
46 | 47 |
47 // Registers the preferences the Sync Promo UI needs. | 48 // Registers the preferences the Sync Promo UI needs. |
48 static void RegisterUserPrefs(PrefService* prefs); | 49 static void RegisterUserPrefs(PrefService* prefs); |
49 | 50 |
50 // Returns the sync promo URL wth the given arguments in the query. | 51 // Returns the sync promo URL wth the given arguments in the query. |
51 // |next_page| is the URL to navigate to when the user completes or skips the | 52 // |next_page| is the URL to navigate to when the user completes or skips the |
52 // promo. If an empty URL is given then the promo will navigate to the NTP. | 53 // promo. If an empty URL is given then the promo will navigate to the NTP. |
53 // |source| identifies from where the sync promo is being called, and is used | 54 // |source| identifies from where the sync promo is being called, and is used |
54 // to record sync promo UMA stats in the context of the source. | 55 // to record sync promo UMA stats in the context of the source. |
56 // |auto_close| whether to close the sync promo automatically when done. | |
57 // Default is false. | |
55 static GURL GetSyncPromoURL(const GURL& next_page, Source source); | 58 static GURL GetSyncPromoURL(const GURL& next_page, Source source); |
59 static GURL GetSyncPromoURL( | |
sail
2012/07/20 22:43:45
I don't think it's worth overloading this function
Munjal (Google)
2012/07/20 23:04:35
Done.
| |
60 const GURL& next_page, Source source, bool auto_close); | |
56 | 61 |
57 // Gets the next page URL from the query portion of the sync promo URL. | 62 // Gets the next page URL from the query portion of the sync promo URL. |
58 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); | 63 static GURL GetNextPageURLForSyncPromoURL(const GURL& url); |
59 | 64 |
60 // Gets the source from the query portion of the sync promo URL. | 65 // Gets the source from the query portion of the sync promo URL. |
61 // The source identifies from where the sync promo was opened. | 66 // The source identifies from where the sync promo was opened. |
62 static Source GetSourceForSyncPromoURL(const GURL& url); | 67 static Source GetSourceForSyncPromoURL(const GURL& url); |
63 | 68 |
69 // Returns whether the given sync URL contains auto_close parameter. | |
70 static bool GetAutoCloseForSyncPromoURL(const GURL& url); | |
71 | |
64 private: | 72 private: |
65 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); | 73 DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); |
66 }; | 74 }; |
67 | 75 |
68 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ | 76 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ |
OLD | NEW |