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_NTP_NTP_LOGIN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/prefs/pref_member.h" | 9 #include "chrome/browser/prefs/pref_member.h" |
10 #include "content/browser/webui/web_ui.h" | 10 #include "content/browser/webui/web_ui.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 virtual void Observe(int type, | 31 virtual void Observe(int type, |
32 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
33 const content::NotificationDetails& details) OVERRIDE; | 33 const content::NotificationDetails& details) OVERRIDE; |
34 | 34 |
35 // Returns true if the login handler should be shown in a new tab page | 35 // Returns true if the login handler should be shown in a new tab page |
36 // for the given |profile|. |profile| must not be NULL. | 36 // for the given |profile|. |profile| must not be NULL. |
37 static bool ShouldShow(Profile* profile); | 37 static bool ShouldShow(Profile* profile); |
38 | 38 |
39 private: | 39 private: |
40 // User actions while on the NTP when clicking on or viewing the sync promo. | 40 // User actions while on the NTP when clicking on or viewing the sync promo. |
41 enum SyncPromoNTPPromoBuckets { | 41 enum NTPSignInPromoBuckets { |
42 SYNC_PROMO_NTP_PROMO_VIEWED, | 42 NTP_SIGN_IN_PROMO_VIEWED, |
43 SYNC_PROMO_NTP_PROMO_CLICKED, | 43 NTP_SIGN_IN_PROMO_CLICKED, |
44 SYNC_PROMO_NTP_PROMO_BUCKET_BOUNDARY, | 44 NTP_SIGN_IN_PROMO_BUCKET_BOUNDARY, |
45 }; | 45 }; |
46 | 46 |
47 // Called from JS when the NTP is loaded. |args| is the list of arguments | 47 // Called from JS when the NTP is loaded. |args| is the list of arguments |
48 // passed from JS and should be an empty list. | 48 // passed from JS and should be an empty list. |
49 void HandleInitializeSyncLogin(const ListValue* args); | 49 void HandleInitializeSyncLogin(const ListValue* args); |
50 | 50 |
51 // Called from JS when the user clicks the login container. It shows the | 51 // Called from JS when the user clicks the login container. It shows the |
52 // appropriate UI based on the current sync state. |args| is the list of | 52 // appropriate UI based on the current sync state. |args| is the list of |
53 // arguments passed from JS and should be an empty list. | 53 // arguments passed from JS and should be an empty list. |
54 void HandleShowSyncLoginUI(const ListValue* args); | 54 void HandleShowSyncLoginUI(const ListValue* args); |
55 | 55 |
| 56 // Records actions in SyncPromo.NTPPromo histogram. |
| 57 void RecordInHistogram(int type); |
| 58 |
56 // Internal helper method | 59 // Internal helper method |
57 void UpdateLogin(); | 60 void UpdateLogin(); |
58 | 61 |
59 StringPrefMember username_pref_; | 62 StringPrefMember username_pref_; |
60 }; | 63 }; |
61 | 64 |
62 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 65 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
OLD | NEW |