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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/webui/sync_setup_handler.h" | 9 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
10 | 10 |
11 class PrefService; | 11 class PrefService; |
12 | 12 |
13 // The handler for JavaScript messages related to the "sync promo" page. | 13 // The handler for JavaScript messages related to the "sync promo" page. |
14 class SyncPromoHandler : public SyncSetupHandler { | 14 class SyncPromoHandler : public SyncSetupHandler { |
15 public: | 15 public: |
16 explicit SyncPromoHandler(ProfileManager* profile_manager); | 16 explicit SyncPromoHandler(ProfileManager* profile_manager); |
17 virtual ~SyncPromoHandler(); | 17 virtual ~SyncPromoHandler(); |
18 | 18 |
19 // Called to register our preferences before we use them (so there will be a | 19 // Called to register our preferences before we use them (so there will be a |
20 // default if not present yet). | 20 // default if not present yet). |
21 static void RegisterUserPrefs(PrefService* prefs); | 21 static void RegisterUserPrefs(PrefService* prefs); |
22 | 22 |
23 // WebUIMessageHandler implementation. | 23 // WebUIMessageHandler implementation. |
24 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; | 24 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; |
25 virtual void RegisterMessages() OVERRIDE; | 25 virtual void RegisterMessages() OVERRIDE; |
26 | 26 |
27 // SyncSetupFlowHandler implementation. | 27 // SyncSetupFlowHandler implementation. |
| 28 virtual void ShowGaiaSuccessAndClose() OVERRIDE; |
| 29 virtual void ShowGaiaSuccessAndSettingUp() OVERRIDE; |
28 virtual void ShowConfigure(const base::DictionaryValue& args) OVERRIDE; | 30 virtual void ShowConfigure(const base::DictionaryValue& args) OVERRIDE; |
29 | 31 |
30 // content::NotificationObserver implementation. | 32 // content::NotificationObserver implementation. |
31 virtual void Observe(int type, | 33 virtual void Observe(int type, |
32 const content::NotificationSource& source, | 34 const content::NotificationSource& source, |
33 const content::NotificationDetails& details) OVERRIDE; | 35 const content::NotificationDetails& details) OVERRIDE; |
34 | 36 |
| 37 // SyncSetupHandler overrides. |
| 38 virtual void HandleSubmitAuth(const base::ListValue* args) OVERRIDE; |
| 39 |
35 protected: | 40 protected: |
36 virtual void ShowSetupUI() OVERRIDE; | 41 virtual void ShowSetupUI() OVERRIDE; |
37 | 42 |
38 private: | 43 private: |
39 // JavaScript callback handler to close the sync promo. | 44 // JavaScript callback handler to close the sync promo. |
40 void HandleCloseSyncPromo(const base::ListValue* args); | 45 void HandleCloseSyncPromo(const base::ListValue* args); |
41 | 46 |
42 // JavaScript callback handler to initialize the sync promo. | 47 // JavaScript callback handler to initialize the sync promo. |
43 void HandleInitializeSyncPromo(const base::ListValue* args); | 48 void HandleInitializeSyncPromo(const base::ListValue* args); |
44 | 49 |
(...skipping 19 matching lines...) Expand all Loading... |
64 // sync promo. | 69 // sync promo. |
65 int GetViewCount() const; | 70 int GetViewCount() const; |
66 | 71 |
67 // Increment the local view count by the specified non-negative integer | 72 // Increment the local view count by the specified non-negative integer |
68 // amount. Returns the new total view count. | 73 // amount. Returns the new total view count. |
69 int IncrementViewCountBy(unsigned int amount); | 74 int IncrementViewCountBy(unsigned int amount); |
70 | 75 |
71 // Record a user's flow through the promo to our histogram in UMA. | 76 // Record a user's flow through the promo to our histogram in UMA. |
72 void RecordUserFlowAction(int action); | 77 void RecordUserFlowAction(int action); |
73 | 78 |
| 79 // Load any experiments that run on the promo page. |
| 80 void LoadPromoExperiments(); |
| 81 |
74 // Use this to register for certain notifications (currently when tabs or | 82 // Use this to register for certain notifications (currently when tabs or |
75 // windows close). | 83 // windows close). |
76 content::NotificationRegistrar registrar_; | 84 content::NotificationRegistrar registrar_; |
77 | 85 |
78 // Weak reference that's initialized and checked in Attach() (after that | 86 // Weak reference that's initialized and checked in Attach() (after that |
79 // guaranteed to be non-NULL). | 87 // guaranteed to be non-NULL). |
80 PrefService* prefs_; | 88 PrefService* prefs_; |
81 | 89 |
82 // If the user closes the whole window we'll get a close notification from the | 90 // If the user closes the whole window we'll get a close notification from the |
83 // tab as well, so this bool acts as a small mutex to only report the close | 91 // tab as well, so this bool acts as a small mutex to only report the close |
84 // method once. | 92 // method once. |
85 bool window_already_closed_; | 93 bool window_already_closed_; |
86 | 94 |
87 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); | 95 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); |
88 }; | 96 }; |
89 | 97 |
90 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 98 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ |
OLD | NEW |