Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4917)

Unified Diff: chrome/browser/ui/webui/sync_promo_handler.cc

Issue 8528054: Sync Promo: Add more UMA metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more code review changes Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/sync_promo_handler.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/sync_promo_handler.cc
diff --git a/chrome/browser/ui/webui/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo_handler.cc
index fbee2dc2dbb191ce649e899bd91c0078dcef62a1..c9b1254a5cf2d7dda8ac6f498b25a252c0986bfe 100644
--- a/chrome/browser/ui/webui/sync_promo_handler.cc
+++ b/chrome/browser/ui/webui/sync_promo_handler.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/metrics/histogram.h"
+#include "base/time.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -20,8 +21,42 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+
+namespace {
+
+// User actions on the sync promo (aka "Sign in to Chrome").
+enum SyncPromoUserFlowActionEnums {
+ SYNC_PROMO_VIEWED,
+ SYNC_PROMO_LEARN_MORE_CLICKED,
+ SYNC_PROMO_ACCOUNT_HELP_CLICKED,
+ SYNC_PROMO_CREATE_ACCOUNT_CLICKED,
+ SYNC_PROMO_SKIP_CLICKED,
+ SYNC_PROMO_SIGN_IN_ATTEMPTED,
+ SYNC_PROMO_SIGNED_IN_SUCCESSFULLY,
+ SYNC_PROMO_ADVANCED_CLICKED,
+ SYNC_PROMO_ENCRYPTION_HELP_CLICKED,
+ SYNC_PROMO_CANCELLED_AFTER_SIGN_IN,
+ SYNC_PROMO_CONFIRMED_AFTER_SIGN_IN,
+ SYNC_PROMO_CLOSED_TAB,
+ SYNC_PROMO_CLOSED_WINDOW,
+ SYNC_PROMO_LEFT_DURING_THROBBER,
+ SYNC_PROMO_BUCKET_BOUNDARY,
+ SYNC_PROMO_FIRST_VALID_JS_ACTION = SYNC_PROMO_LEARN_MORE_CLICKED,
+ SYNC_PROMO_LAST_VALID_JS_ACTION = SYNC_PROMO_CONFIRMED_AFTER_SIGN_IN,
+};
+
+// This was added because of the need to change the existing UMA enum for the
+// sync promo mid-flight. Ideally these values would be contiguous, but the
+// real world is not always ideal.
+static bool IsValidUserFlowAction(int action) {
+ return (action >= SYNC_PROMO_FIRST_VALID_JS_ACTION &&
+ action <= SYNC_PROMO_LAST_VALID_JS_ACTION) ||
+ action == SYNC_PROMO_LEFT_DURING_THROBBER;
+}
+
+} // namespace
SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager)
: SyncSetupHandler(profile_manager),
@@ -67,12 +102,21 @@ void SyncPromoHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("SyncPromo:Initialize",
base::Bind(&SyncPromoHandler::HandleInitializeSyncPromo,
base::Unretained(this)));
- web_ui_->RegisterMessageCallback("SyncPromo:UserFlowAction",
- base::Bind(&SyncPromoHandler::HandleUserFlowAction,
+ web_ui_->RegisterMessageCallback("SyncPromo:RecordSignInAttempts",
+ base::Bind(&SyncPromoHandler::HandleRecordSignInAttempts,
+ base::Unretained(this)));
+ web_ui_->RegisterMessageCallback("SyncPromo:RecordThrobberTime",
+ base::Bind(&SyncPromoHandler::HandleRecordThrobberTime,
base::Unretained(this)));
web_ui_->RegisterMessageCallback("SyncPromo:ShowAdvancedSettings",
base::Bind(&SyncPromoHandler::HandleShowAdvancedSettings,
base::Unretained(this)));
+ web_ui_->RegisterMessageCallback("SyncPromo:UserFlowAction",
+ base::Bind(&SyncPromoHandler::HandleUserFlowAction,
+ base::Unretained(this)));
+ web_ui_->RegisterMessageCallback("SyncPromo:UserSkipped",
+ base::Bind(&SyncPromoHandler::HandleUserSkipped,
+ base::Unretained(this)));
SyncSetupHandler::RegisterMessages();
}
@@ -101,7 +145,7 @@ void SyncPromoHandler::Observe(int type,
switch (type) {
case content::NOTIFICATION_TAB_CLOSING: {
if (!window_already_closed_)
- RecordUserFlowAction(extension_misc::SYNC_PROMO_CLOSED_TAB);
+ RecordUserFlowAction(SYNC_PROMO_CLOSED_TAB);
break;
}
case chrome::NOTIFICATION_BROWSER_CLOSING: {
@@ -109,7 +153,7 @@ void SyncPromoHandler::Observe(int type,
Browser* browser = content::Source<Browser>(source).ptr();
if (browser->tabstrip_model()->GetWrapperIndex(
web_ui_->tab_contents()) != TabStripModel::kNoTab) {
- RecordUserFlowAction(extension_misc::SYNC_PROMO_CLOSED_WINDOW);
+ RecordUserFlowAction(SYNC_PROMO_CLOSED_WINDOW);
window_already_closed_ = true;
}
break;
@@ -149,7 +193,7 @@ void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) {
OpenSyncSetup();
// We don't need to compute anything for this, just do this every time.
- RecordUserFlowAction(extension_misc::SYNC_PROMO_VIEWED);
+ RecordUserFlowAction(SYNC_PROMO_VIEWED);
// Increment view count first and show natural numbers in stats rather than 0
// based starting point (if it happened to be our first time showing this).
IncrementViewCountBy(1);
@@ -165,22 +209,38 @@ void SyncPromoHandler::HandleShowAdvancedSettings(
url += chrome::kSyncSetupSubPage;
web_ui_->tab_contents()->OpenURL(GURL(url), GURL(), CURRENT_TAB,
content::PAGE_TRANSITION_LINK);
- RecordUserFlowAction(extension_misc::SYNC_PROMO_ADVANCED_CLICKED);
+ RecordUserFlowAction(SYNC_PROMO_ADVANCED_CLICKED);
+}
+
+// TODO(dbeam): Replace with metricsHandler:recordHistogramTime when it exists.
+void SyncPromoHandler::HandleRecordThrobberTime(const base::ListValue* args) {
+ double time_double;
+ CHECK(args->GetDouble(0, &time_double));
+ UMA_HISTOGRAM_TIMES("SyncPromo.ThrobberTime",
+ base::TimeDelta::FromMilliseconds(time_double));
+}
+
+// TODO(dbeam): Replace with metricsHandler:recordHistogramCount when it exists.
+void SyncPromoHandler::HandleRecordSignInAttempts(const base::ListValue* args) {
+ double count_double;
+ CHECK(args->GetDouble(0, &count_double));
+ UMA_HISTOGRAM_COUNTS("SyncPromo.SignInAttempts", count_double);
}
void SyncPromoHandler::HandleUserFlowAction(const base::ListValue* args) {
double action_double;
CHECK(args->GetDouble(0, &action_double));
int action = static_cast<int>(action_double);
- if (action >= extension_misc::SYNC_PROMO_FIRST_VALID_JS_ACTION &&
- action <= extension_misc::SYNC_PROMO_LAST_VALID_JS_ACTION) {
+
+ if (IsValidUserFlowAction(action))
RecordUserFlowAction(action);
- } else {
+ else
NOTREACHED() << "Attempt to record invalid user flow action on sync promo.";
- }
+}
- if (action == extension_misc::SYNC_PROMO_SKIP_CLICKED)
- SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+void SyncPromoHandler::HandleUserSkipped(const base::ListValue* args) {
+ SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+ RecordUserFlowAction(SYNC_PROMO_SKIP_CLICKED);
}
int SyncPromoHandler::GetViewCount() const {
@@ -199,5 +259,5 @@ int SyncPromoHandler::IncrementViewCountBy(unsigned int amount) {
void SyncPromoHandler::RecordUserFlowAction(int action) {
// Send an enumeration to our single user flow histogram.
UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
- extension_misc::SYNC_PROMO_BUCKET_BOUNDARY);
+ SYNC_PROMO_BUCKET_BOUNDARY);
}
« no previous file with comments | « chrome/browser/ui/webui/sync_promo_handler.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698