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 |
35 protected: | 37 protected: |
36 virtual void ShowSetupUI() OVERRIDE; | 38 virtual void ShowSetupUI() OVERRIDE; |
37 | 39 |
(...skipping 26 matching lines...) Expand all Loading... |
64 // sync promo. | 66 // sync promo. |
65 int GetViewCount() const; | 67 int GetViewCount() const; |
66 | 68 |
67 // Increment the local view count by the specified non-negative integer | 69 // Increment the local view count by the specified non-negative integer |
68 // amount. Returns the new total view count. | 70 // amount. Returns the new total view count. |
69 int IncrementViewCountBy(unsigned int amount); | 71 int IncrementViewCountBy(unsigned int amount); |
70 | 72 |
71 // Record a user's flow through the promo to our histogram in UMA. | 73 // Record a user's flow through the promo to our histogram in UMA. |
72 void RecordUserFlowAction(int action); | 74 void RecordUserFlowAction(int action); |
73 | 75 |
| 76 // Load any experiments that run on the promo page. |
| 77 void LoadPromoExperiments(); |
| 78 |
74 // Use this to register for certain notifications (currently when tabs or | 79 // Use this to register for certain notifications (currently when tabs or |
75 // windows close). | 80 // windows close). |
76 content::NotificationRegistrar registrar_; | 81 content::NotificationRegistrar registrar_; |
77 | 82 |
78 // Weak reference that's initialized and checked in Attach() (after that | 83 // Weak reference that's initialized and checked in Attach() (after that |
79 // guaranteed to be non-NULL). | 84 // guaranteed to be non-NULL). |
80 PrefService* prefs_; | 85 PrefService* prefs_; |
81 | 86 |
82 // If the user closes the whole window we'll get a close notification from the | 87 // 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 | 88 // tab as well, so this bool acts as a small mutex to only report the close |
84 // method once. | 89 // method once. |
85 bool window_already_closed_; | 90 bool window_already_closed_; |
86 | 91 |
87 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); | 92 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); |
88 }; | 93 }; |
89 | 94 |
90 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 95 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ |
OLD | NEW |