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

Unified Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 4708002: Add a histogram for tracking web store promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: incorporate feedback Created 10 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
Index: chrome/browser/dom_ui/app_launcher_handler.cc
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 9bc27d250843a7881f8d5f725dd1338701c4aa54..303f4213c11d56750f513c9feb0e402bfa1ca739 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/dom_ui/app_launcher_handler.h"
#include "app/animation.h"
+#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -56,7 +57,8 @@ std::string GetIconURL(const Extension* extension, Extension::Icons icon,
} // namespace
AppLauncherHandler::AppLauncherHandler(ExtensionsService* extension_service)
- : extensions_service_(extension_service) {
+ : extensions_service_(extension_service),
+ promo_active_(false) {
}
AppLauncherHandler::~AppLauncherHandler() {}
@@ -77,6 +79,10 @@ void AppLauncherHandler::RegisterMessages() {
NewCallback(this, &AppLauncherHandler::HandleUninstallApp));
dom_ui_->RegisterMessageCallback("hideAppsPromo",
NewCallback(this, &AppLauncherHandler::HandleHideAppsPromo));
+ dom_ui_->RegisterMessageCallback("recordWebStoreLaunch",
+ NewCallback(this, &AppLauncherHandler::HandleRecordWebStoreLaunch));
+ dom_ui_->RegisterMessageCallback("recordAppLaunch",
+ NewCallback(this, &AppLauncherHandler::HandleRecordAppLaunch));
}
void AppLauncherHandler::Observe(NotificationType type,
@@ -150,8 +156,10 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
if (default_apps->ShouldShowPromo(extensions_service_->GetAppIds())) {
dictionary->SetBoolean("showPromo", true);
default_apps->DidShowPromo();
+ promo_active_ = true;
} else {
dictionary->SetBoolean("showPromo", false);
+ promo_active_ = false;
}
bool showLauncher =
@@ -271,6 +279,9 @@ void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) {
// If the user has intentionally hidden the promotion, we'll uninstall all the
// default apps (we know the user hasn't installed any apps on their own at
// this point, or the promotion wouldn't have been shown).
+ UMA_HISTOGRAM_ENUMERATION("Extensions.AppsPromo",
+ extension_misc::CLOSE_PROMO,
+ extension_misc::MAX);
Erik does not do reviews 2010/11/10 23:29:51 given that you're using a common namespace for the
DefaultApps* default_apps = extensions_service_->default_apps();
const ExtensionIdSet* app_ids = default_apps->GetDefaultApps();
DCHECK(*app_ids == extensions_service_->GetAppIds());
@@ -284,6 +295,34 @@ void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) {
extensions_service_->default_apps()->SetPromoHidden();
}
+void AppLauncherHandler::HandleRecordWebStoreLaunch(const ListValue* args) {
+ if (promo_active_) {
+ UMA_HISTOGRAM_ENUMERATION("Extensions.AppsPromo",
+ extension_misc::LAUNCH_WEB_STORE,
+ extension_misc::MAX);
+ }
+}
+
+void AppLauncherHandler::HandleRecordAppLaunch(const ListValue* args) {
+ if (promo_active_) {
+ UMA_HISTOGRAM_ENUMERATION("Extensions.AppsPromo",
+ extension_misc::LAUNCH_APP,
+ extension_misc::MAX);
+
+ // If we're launching the web store application, then we may have to bump
Erik does not do reviews 2010/11/10 23:29:51 if that's the case, then we shouldn't bump LAUNCH_
+ // the web store launch histogram.
+ std::string extension_id;
+
+ if (!args->GetString(0, &extension_id)) {
+ NOTREACHED();
+ return;
+ }
+ if (extension_id == extension_misc::kWebStoreAppId ||
+ extension_id == extension_misc::kNTPWebStoreAppId)
+ HandleRecordWebStoreLaunch(args);
+ }
+}
+
ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() {
if (!install_ui_.get())
install_ui_.reset(new ExtensionInstallUI(dom_ui_->GetProfile()));

Powered by Google App Engine
This is Rietveld 408576698