Chromium Code Reviews| 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..063de87784175bfffa868b33e3039f8be7b04486 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; |
| @@ -192,6 +194,7 @@ bool AppLauncherHandler::HandlePing(Profile* profile, const std::string& path) { |
| return true; |
| } |
|
Rick Byers
2011/08/03 14:41:11
Remove extra blank line
Evan Stade
2011/08/03 22:11:22
Done.
|
| + |
| WebUIMessageHandler* AppLauncherHandler::Attach(WebUI* web_ui) { |
| // TODO(arv): Add initialization code to the Apps store etc. |
| return WebUIMessageHandler::Attach(web_ui); |
| @@ -220,6 +223,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 +489,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 +701,17 @@ 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)); |
| + std::string source; |
| + CHECK(args->GetString(1, &source)); |
|
Rick Byers
2011/08/03 14:41:11
Curious why you're taking a string argument here a
Evan Stade
2011/08/03 22:11:22
Done.
|
| + |
| + RecordAppLaunchByURL( |
| + web_ui_->GetProfile(), url, ParseLaunchSource(source)); |
| +} |
| + |
| void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle, |
| history::FaviconData data) { |
| scoped_ptr<WebApplicationInfo> web_app( |