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

Unified Diff: chrome/browser/banners/app_banner_settings_helper.cc

Issue 1161233005: Implement app banner info bars on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stop-icon-overgeneration
Patch Set: Fixing display bug on Android Created 5 years, 7 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
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,

Powered by Google App Engine
This is Rietveld 408576698