| 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_SYNC_PROMO_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_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); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // JavaScript callback handler for when a user clicks skip. | 64 // JavaScript callback handler for when a user clicks skip. |
| 65 void HandleUserSkipped(const base::ListValue* args); | 65 void HandleUserSkipped(const base::ListValue* args); |
| 66 | 66 |
| 67 // Return the number of times the user with the current profile has seen the | 67 // Return the number of times the user with the current profile has seen the |
| 68 // sync promo. | 68 // sync promo. |
| 69 int GetViewCount() const; | 69 int GetViewCount() const; |
| 70 | 70 |
| 71 // Increment the local view count by the specified non-negative integer | 71 // Increment the local view count by the specified non-negative integer |
| 72 // amount. Returns the new total view count. | 72 // amount. Returns the new total view count. |
| 73 int IncrementViewCountBy(unsigned int amount); | 73 int IncrementViewCountBy(size_t amount); |
| 74 |
| 75 // Record the outcome of the sync promo experiment (currently if the user |
| 76 // signs in to sync or not). |
| 77 void RecordExperimentOutcomesOnSignIn(); |
| 74 | 78 |
| 75 // Record a user's flow through the promo to our histogram in UMA. | 79 // Record a user's flow through the promo to our histogram in UMA. |
| 76 void RecordUserFlowAction(int action); | 80 void RecordUserFlowAction(int action); |
| 77 | 81 |
| 78 // Load any experiments that run on the promo page. | |
| 79 void LoadPromoExperiments(); | |
| 80 | |
| 81 // Use this to register for certain notifications (currently when tabs or | 82 // Use this to register for certain notifications (currently when tabs or |
| 82 // windows close). | 83 // windows close). |
| 83 content::NotificationRegistrar registrar_; | 84 content::NotificationRegistrar registrar_; |
| 84 | 85 |
| 85 // Weak reference that's initialized and checked in Attach() (after that | 86 // Weak reference that's initialized and checked in Attach() (after that |
| 86 // guaranteed to be non-NULL). | 87 // guaranteed to be non-NULL). |
| 87 PrefService* prefs_; | 88 PrefService* prefs_; |
| 88 | 89 |
| 89 // 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 |
| 90 // 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 |
| 91 // method once. | 92 // method once. |
| 92 bool window_already_closed_; | 93 bool window_already_closed_; |
| 93 | 94 |
| 94 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); | 95 DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ | 98 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER_H_ |
| OLD | NEW |