Chromium Code Reviews| 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 ShowConfigure(const base::DictionaryValue& args) OVERRIDE; | 28 virtual void ShowConfigure(const base::DictionaryValue& args) OVERRIDE; |
| 29 | 29 |
| 30 // content::NotificationObserver implementation. | 30 // content::NotificationObserver implementation. |
| 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 protected: | 35 protected: |
| 36 virtual void ShowSetupUI() OVERRIDE; | 36 virtual void ShowSetupUI() OVERRIDE; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Javascript callback handler to close the sync promo. | 39 // JavaScript callback handler to close the sync promo. |
| 40 void HandleCloseSyncPromo(const base::ListValue* args); | 40 void HandleCloseSyncPromo(const base::ListValue* args); |
| 41 | 41 |
| 42 // Javascript callback handler to initialize the sync promo. | 42 // JavaScript callback handler to initialize the sync promo. |
| 43 void HandleInitializeSyncPromo(const base::ListValue* args); | 43 void HandleInitializeSyncPromo(const base::ListValue* args); |
| 44 | 44 |
| 45 // Javascript callback handler to switch the advanced sync settings. |args| is | 45 // JavaScript handler to record a single amount of time throbbers were shown. |
|
Evan Stade
2011/11/15 17:45:19
comment no makey sense
Dan Beam
2011/11/15 18:37:13
JavaScript handler to record the amount of time th
Evan Stade
2011/11/15 22:46:41
to record the duration for which the throbber was
Dan Beam
2011/11/16 00:09:53
Done.
| |
| 46 void HandleRecordThrobberTime(const base::ListValue* args); | |
| 47 | |
| 48 // JavaScript handler to record the number of times a user attempted to sign | |
| 49 // in to chrome while they were on the sync promo page. | |
| 50 void HandleRecordSignInAttempts(const base::ListValue* args); | |
| 51 | |
| 52 // JavaScript callback handler to switch the advanced sync settings. |args| is | |
| 46 // the list of arguments passed from JS and should be an empty list. | 53 // the list of arguments passed from JS and should be an empty list. |
| 47 void HandleShowAdvancedSettings(const base::ListValue* args); | 54 void HandleShowAdvancedSettings(const base::ListValue* args); |
| 48 | 55 |
| 49 // Javascript callback handler to record user actions on the sync promo. | 56 // JavaScript callback handler to record user actions on the sync promo. |
| 50 void HandleUserFlowAction(const base::ListValue* args); | 57 void HandleUserFlowAction(const base::ListValue* args); |
| 51 | 58 |
| 52 // Return the number of times the user with the current profile has seen the | 59 // Return the number of times the user with the current profile has seen the |
| 53 // sync promo. | 60 // sync promo. |
| 54 int GetViewCount() const; | 61 int GetViewCount() const; |
| 55 | 62 |
| 56 // Increment the local view count by the specified non-negative integer | 63 // Increment the local view count by the specified non-negative integer |
| 57 // amount. Returns the new total view count. | 64 // amount. Returns the new total view count. |
| 58 int IncrementViewCountBy(unsigned int amount); | 65 int IncrementViewCountBy(unsigned int amount); |
| 59 | 66 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 70 | 77 |
| 71 // If the user closes the whole window we'll get a close notification from the | 78 // If the user closes the whole window we'll get a close notification from the |
| 72 // tab as well, so this bool acts as a small mutex to only report the close | 79 // tab as well, so this bool acts as a small mutex to only report the close |
| 73 // method once. | 80 // method once. |
| 74 bool window_already_closed_; | 81 bool window_already_closed_; |
| 75 | 82 |
| 76 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); | 83 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); |
| 77 }; | 84 }; |
| 78 | 85 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 86 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ |
| OLD | NEW |