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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 7550015: ntp4: record app launch source (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better comments Created 9 years, 5 months 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/ntp/app_launcher_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 2c9745cc6f50c1a4035e95183c54e152e94edf4d..9ff3a86730cf29347dcc24ec85ff24837aeff961 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -151,6 +151,8 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
}
}
+// TODO(estade): remove this. We record app launches via js calls rather than
+// pings for ntp4.
// static
bool AppLauncherHandler::HandlePing(Profile* profile, const std::string& path) {
std::vector<std::string> params;
@@ -193,7 +195,6 @@ bool AppLauncherHandler::HandlePing(Profile* profile, const std::string& path) {
}
WebUIMessageHandler* AppLauncherHandler::Attach(WebUI* web_ui) {
- // TODO(arv): Add initialization code to the Apps store etc.
return WebUIMessageHandler::Attach(web_ui);
}
@@ -220,6 +221,8 @@ void AppLauncherHandler::RegisterMessages() {
NewCallback(this, &AppLauncherHandler::HandleSaveAppPageName));
web_ui_->RegisterMessageCallback("generateAppForLink",
NewCallback(this, &AppLauncherHandler::HandleGenerateAppForLink));
+ web_ui_->RegisterMessageCallback("recordAppLaunchByURL",
+ NewCallback(this, &AppLauncherHandler::HandleRecordAppLaunchByURL));
}
void AppLauncherHandler::Observe(int type,
@@ -484,6 +487,9 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
if (extension_id != extension_misc::kWebStoreAppId) {
RecordAppLaunchByID(promo_active_, launch_bucket);
extensions_service_->apps_promo()->ExpireDefaultApps();
+ } else if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNewTabPage4)) {
+ RecordWebStoreLaunch(promo_active_);
}
if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
@@ -693,6 +699,20 @@ void AppLauncherHandler::HandleGenerateAppForLink(const ListValue* args) {
favicon_consumer_.SetClientData(favicon_service, h, web_app.release());
}
+void AppLauncherHandler::HandleRecordAppLaunchByURL(
+ const base::ListValue* args) {
+ std::string url;
+ CHECK(args->GetString(0, &url));
+ double source;
+ CHECK(args->GetDouble(1, &source));
+
+ extension_misc::AppLaunchBucket bucket =
+ static_cast<extension_misc::AppLaunchBucket>(source);
+ CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+
+ RecordAppLaunchByURL(web_ui_->GetProfile(), url, bucket);
+}
+
void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle,
history::FaviconData data) {
scoped_ptr<WebApplicationInfo> web_app(
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698