Index: chrome/browser/banners/app_banner_settings_helper.cc |
diff --git a/chrome/browser/banners/app_banner_settings_helper.cc b/chrome/browser/banners/app_banner_settings_helper.cc |
index 19e711018502493e31ccdc4aec7aa8156de4649e..7306d7b9cf3f15eddfd02448e6b23c11445b964e 100644 |
--- a/chrome/browser/banners/app_banner_settings_helper.cc |
+++ b/chrome/browser/banners/app_banner_settings_helper.cc |
@@ -8,11 +8,14 @@ |
#include <string> |
#include "base/command_line.h" |
+#include "chrome/browser/banners/app_banner_data_fetcher.h" |
#include "chrome/browser/banners/app_banner_metrics.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/chrome_switches.h" |
#include "components/content_settings/core/browser/host_content_settings_map.h" |
#include "components/content_settings/core/common/content_settings_pattern.h" |
+#include "components/rappor/rappor_utils.h" |
#include "content/public/browser/web_contents.h" |
#include "net/base/escape.h" |
#include "url/gurl.h" |
@@ -95,6 +98,44 @@ void AppBannerSettingsHelper::ClearHistoryForURLs( |
} |
} |
+void AppBannerSettingsHelper::RecordBannerInstallEvent( |
+ content::WebContents* web_contents, |
+ const std::string& package_name_or_start_url, |
+ AppBannerRapporMetric rappor_metric) { |
+ banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED); |
+ |
+ AppBannerSettingsHelper::RecordBannerEvent( |
+ web_contents, web_contents->GetURL(), |
+ package_name_or_start_url, |
+ AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
+ banners::AppBannerDataFetcher::GetCurrentTime()); |
+ |
+ rappor::SampleDomainAndRegistryFromGURL( |
+ g_browser_process->rappor_service(), |
+ (rappor_metric == WEB ? "AppBanner.WebApp.Installed" |
+ : "AppBanner.NativeApp.Installed"), |
+ web_contents->GetURL()); |
+} |
+ |
+void AppBannerSettingsHelper::RecordBannerDismissEvent( |
+ content::WebContents* web_contents, |
+ const std::string& package_name_or_start_url, |
+ AppBannerRapporMetric rappor_metric) { |
+ banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON); |
+ |
+ AppBannerSettingsHelper::RecordBannerEvent( |
+ web_contents, web_contents->GetURL(), |
+ package_name_or_start_url, |
+ AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK, |
+ banners::AppBannerDataFetcher::GetCurrentTime()); |
+ |
+ rappor::SampleDomainAndRegistryFromGURL( |
+ g_browser_process->rappor_service(), |
+ (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed" |
+ : "AppBanner.NativeApp.Dismissed"), |
+ web_contents->GetURL()); |
+} |
+ |
void AppBannerSettingsHelper::RecordBannerEvent( |
content::WebContents* web_contents, |
const GURL& origin_url, |