Chromium Code Reviews| 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..1bcb9175cbecb7799494110ab5482ec934ba44c4 100644 |
| --- a/chrome/browser/banners/app_banner_settings_helper.cc |
| +++ b/chrome/browser/banners/app_banner_settings_helper.cc |
| @@ -8,11 +8,16 @@ |
| #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 "chrome/common/render_messages.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/render_frame_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "net/base/escape.h" |
| #include "url/gurl.h" |
| @@ -95,6 +100,52 @@ void AppBannerSettingsHelper::ClearHistoryForURLs( |
| } |
| } |
| +void AppBannerSettingsHelper::RecordBannerWebInstallEvent( |
| + content::WebContents* web_contents, |
| + const std::string& package_name_or_start_url, |
| + const std::string& rappor_metric, |
| + int event_request_id_) { |
| + banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED); |
| + |
| + web_contents->GetMainFrame()->Send( |
|
benwells
2015/06/02 05:53:36
The role of this helper is getting a bit haphazard
dominickn (DO NOT USE)
2015/06/02 06:51:32
In progress.
|
| + new ChromeViewMsg_AppBannerAccepted( |
| + web_contents->GetMainFrame()->GetRoutingID(), |
| + event_request_id_, "web")); |
| + |
| + 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_contents->GetURL()); |
| +} |
| + |
| +void AppBannerSettingsHelper::RecordBannerDismissEvent( |
| + content::WebContents* web_contents, |
| + const std::string& package_name_or_start_url, |
| + const std::string& rappor_metric, |
| + int event_request_id_) { |
| + banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON); |
| + |
| + web_contents->GetMainFrame()->Send( |
| + new ChromeViewMsg_AppBannerDismissed( |
| + web_contents->GetMainFrame()->GetRoutingID(), |
| + event_request_id_)); |
| + |
| + 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_contents->GetURL()); |
| +} |
| + |
| void AppBannerSettingsHelper::RecordBannerEvent( |
| content::WebContents* web_contents, |
| const GURL& origin_url, |