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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 17226003: Add metrics for interactions with the Apps Launcher promo dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed gyp file. :-/ Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/metrics_names.h"
9 #include "apps/pref_names.h" 10 #include "apps/pref_names.h"
10 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
14 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/values.h" 19 #include "base/values.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 base::Unretained(this))); 206 base::Unretained(this)));
206 web_ui()->RegisterMessageCallback("generateAppForLink", 207 web_ui()->RegisterMessageCallback("generateAppForLink",
207 base::Bind(&AppLauncherHandler::HandleGenerateAppForLink, 208 base::Bind(&AppLauncherHandler::HandleGenerateAppForLink,
208 base::Unretained(this))); 209 base::Unretained(this)));
209 web_ui()->RegisterMessageCallback("recordAppLaunchByURL", 210 web_ui()->RegisterMessageCallback("recordAppLaunchByURL",
210 base::Bind(&AppLauncherHandler::HandleRecordAppLaunchByUrl, 211 base::Bind(&AppLauncherHandler::HandleRecordAppLaunchByUrl,
211 base::Unretained(this))); 212 base::Unretained(this)));
212 web_ui()->RegisterMessageCallback("stopShowingAppLauncherPromo", 213 web_ui()->RegisterMessageCallback("stopShowingAppLauncherPromo",
213 base::Bind(&AppLauncherHandler::StopShowingAppLauncherPromo, 214 base::Bind(&AppLauncherHandler::StopShowingAppLauncherPromo,
214 base::Unretained(this))); 215 base::Unretained(this)));
216 web_ui()->RegisterMessageCallback("onLearnMore",
217 base::Bind(&AppLauncherHandler::OnLearnMore,
218 base::Unretained(this)));
215 } 219 }
216 220
217 void AppLauncherHandler::Observe(int type, 221 void AppLauncherHandler::Observe(int type,
218 const content::NotificationSource& source, 222 const content::NotificationSource& source,
219 const content::NotificationDetails& details) { 223 const content::NotificationDetails& details) {
220 if (type == chrome::NOTIFICATION_APP_INSTALLED_TO_NTP) { 224 if (type == chrome::NOTIFICATION_APP_INSTALLED_TO_NTP) {
221 highlight_app_id_ = *content::Details<const std::string>(details).ptr(); 225 highlight_app_id_ = *content::Details<const std::string>(details).ptr();
222 if (has_loaded_apps_) 226 if (has_loaded_apps_)
223 SetAppToBeHighlighted(); 227 SetAppToBeHighlighted();
224 return; 228 return;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source)); 691 static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source));
688 CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 692 CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
689 693
690 RecordAppLaunchByUrl(Profile::FromWebUI(web_ui()), url, bucket); 694 RecordAppLaunchByUrl(Profile::FromWebUI(web_ui()), url, bucket);
691 } 695 }
692 696
693 void AppLauncherHandler::StopShowingAppLauncherPromo( 697 void AppLauncherHandler::StopShowingAppLauncherPromo(
694 const base::ListValue* args) { 698 const base::ListValue* args) {
695 g_browser_process->local_state()->SetBoolean( 699 g_browser_process->local_state()->SetBoolean(
696 apps::prefs::kShowAppLauncherPromo, false); 700 apps::prefs::kShowAppLauncherPromo, false);
701 RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_DISMISSED);
702 }
703
704 void AppLauncherHandler::OnLearnMore(const base::ListValue* args) {
705 RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_LEARN_MORE);
697 } 706 }
698 707
699 void AppLauncherHandler::OnFaviconForApp( 708 void AppLauncherHandler::OnFaviconForApp(
700 scoped_ptr<AppInstallInfo> install_info, 709 scoped_ptr<AppInstallInfo> install_info,
701 const chrome::FaviconImageResult& image_result) { 710 const chrome::FaviconImageResult& image_result) {
702 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo()); 711 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo());
703 web_app->is_bookmark_app = install_info->is_bookmark_app; 712 web_app->is_bookmark_app = install_info->is_bookmark_app;
704 web_app->title = install_info->title; 713 web_app->title = install_info->title;
705 web_app->app_url = install_info->app_url; 714 web_app->app_url = install_info->app_url;
706 web_app->urls.push_back(install_info->app_url); 715 web_app->urls.push_back(install_info->app_url);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 } 760 }
752 761
753 void AppLauncherHandler::CleanupAfterUninstall() { 762 void AppLauncherHandler::CleanupAfterUninstall() {
754 extension_id_prompting_.clear(); 763 extension_id_prompting_.clear();
755 } 764 }
756 765
757 // static 766 // static
758 void AppLauncherHandler::RecordAppLaunchType( 767 void AppLauncherHandler::RecordAppLaunchType(
759 extension_misc::AppLaunchBucket bucket, 768 extension_misc::AppLaunchBucket bucket,
760 extensions::Manifest::Type app_type) { 769 extensions::Manifest::Type app_type) {
770 DCHECK_LT(bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
761 if (app_type == extensions::Manifest::TYPE_PLATFORM_APP) { 771 if (app_type == extensions::Manifest::TYPE_PLATFORM_APP) {
762 UMA_HISTOGRAM_ENUMERATION(extension_misc::kPlatformAppLaunchHistogram, 772 UMA_HISTOGRAM_ENUMERATION(extension_misc::kPlatformAppLaunchHistogram,
763 bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 773 bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
764 } else { 774 } else {
765 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, 775 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
766 bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 776 bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
767 } 777 }
768 } 778 }
769 779
770 // static 780 // static
(...skipping 12 matching lines...) Expand all
783 extension_misc::AppLaunchBucket bucket = 793 extension_misc::AppLaunchBucket bucket =
784 extension_misc::APP_LAUNCH_APP_LIST_MAIN; 794 extension_misc::APP_LAUNCH_APP_LIST_MAIN;
785 if (extension->id() == extension_misc::kWebStoreAppId) 795 if (extension->id() == extension_misc::kWebStoreAppId)
786 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_WEBSTORE; 796 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_WEBSTORE;
787 else if (extension->id() == extension_misc::kChromeAppId) 797 else if (extension->id() == extension_misc::kChromeAppId)
788 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_CHROME; 798 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_CHROME;
789 AppLauncherHandler::RecordAppLaunchType(bucket, extension->GetType()); 799 AppLauncherHandler::RecordAppLaunchType(bucket, extension->GetType());
790 } 800 }
791 801
792 // static 802 // static
803 void AppLauncherHandler::RecordAppLauncherPromoHistogram(
804 apps::AppLauncherPromoHistogramValues value) {
805 DCHECK_LT(value, apps::APP_LAUNCHER_PROMO_MAX);
806 UMA_HISTOGRAM_ENUMERATION(
807 "Apps.AppLauncherPromo", value, apps::APP_LAUNCHER_PROMO_MAX);
808 }
809
810 // static
793 void AppLauncherHandler::RecordWebStoreLaunch() { 811 void AppLauncherHandler::RecordWebStoreLaunch() {
794 RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE, 812 RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE,
795 extensions::Manifest::TYPE_HOSTED_APP); 813 extensions::Manifest::TYPE_HOSTED_APP);
796 } 814 }
797 815
798 // static 816 // static
799 void AppLauncherHandler::RecordAppLaunchByUrl( 817 void AppLauncherHandler::RecordAppLaunchByUrl(
800 Profile* profile, 818 Profile* profile,
801 std::string escaped_url, 819 std::string escaped_url,
802 extension_misc::AppLaunchBucket bucket) { 820 extension_misc::AppLaunchBucket bucket) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { 892 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
875 if (!extension_uninstall_dialog_.get()) { 893 if (!extension_uninstall_dialog_.get()) {
876 Browser* browser = chrome::FindBrowserWithWebContents( 894 Browser* browser = chrome::FindBrowserWithWebContents(
877 web_ui()->GetWebContents()); 895 web_ui()->GetWebContents());
878 extension_uninstall_dialog_.reset( 896 extension_uninstall_dialog_.reset(
879 ExtensionUninstallDialog::Create(extension_service_->profile(), 897 ExtensionUninstallDialog::Create(extension_service_->profile(),
880 browser, this)); 898 browser, this));
881 } 899 }
882 return extension_uninstall_dialog_.get(); 900 return extension_uninstall_dialog_.get();
883 } 901 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698