summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/interstitials
diff options
context:
space:
mode:
Diffstat (limited to 'ios/chrome/browser/interstitials')
-rw-r--r--ios/chrome/browser/interstitials/ios_chrome_metrics_helper.cc36
-rw-r--r--ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h42
2 files changed, 78 insertions, 0 deletions
diff --git a/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.cc b/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.cc
new file mode 100644
index 0000000..88ffb69
--- /dev/null
+++ b/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h"
+
+#include "components/history/core/browser/history_service.h"
+#include "components/keyed_service/core/service_access_type.h"
+#include "components/rappor/rappor_service.h"
+#include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/browser/history/history_service_factory.h"
+#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/web/public/web_state/web_state.h"
+
+IOSChromeMetricsHelper::IOSChromeMetricsHelper(
+ web::WebState* web_state,
+ const GURL& request_url,
+ const security_interstitials::MetricsHelper::ReportDetails report_details)
+ : security_interstitials::MetricsHelper(
+ request_url,
+ report_details,
+ ios::HistoryServiceFactory::GetForBrowserState(
+ ios::ChromeBrowserState::FromBrowserState(
+ web_state->GetBrowserState()),
+ ServiceAccessType::EXPLICIT_ACCESS),
+ GetApplicationContext()->GetRapporService()) {}
+
+IOSChromeMetricsHelper::~IOSChromeMetricsHelper() {}
+
+void IOSChromeMetricsHelper::RecordExtraUserDecisionMetrics(
+ security_interstitials::MetricsHelper::Decision decision) {}
+
+void IOSChromeMetricsHelper::RecordExtraUserInteractionMetrics(
+ security_interstitials::MetricsHelper::Interaction interaction) {}
+
+void IOSChromeMetricsHelper::RecordExtraShutdownMetrics() {}
diff --git a/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h b/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h
new file mode 100644
index 0000000..3bde914
--- /dev/null
+++ b/ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_INTERSTITIALS_IOS_CHROME_METRICS_HELPER_H_
+#define IOS_CHROME_BROWSER_INTERSTITIALS_IOS_CHROME_METRICS_HELPER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/security_interstitials/core/metrics_helper.h"
+#include "url/gurl.h"
+
+namespace web {
+class WebState;
+}
+
+// This class provides a concrete implementation for Chrome on iOS to the
+// security_interstitials::MetricsHelper class. Together, they record UMA,
+// Rappor, and experience sampling metrics.
+class IOSChromeMetricsHelper : public security_interstitials::MetricsHelper {
+ public:
+ IOSChromeMetricsHelper(
+ web::WebState* web_state,
+ const GURL& request_url,
+ const security_interstitials::MetricsHelper::ReportDetails
+ report_details);
+ ~IOSChromeMetricsHelper() override;
+
+ protected:
+ // security_interstitials::MetricsHelper implementation.
+ void RecordExtraUserDecisionMetrics(
+ security_interstitials::MetricsHelper::Decision decision) override;
+ void RecordExtraUserInteractionMetrics(
+ security_interstitials::MetricsHelper::Interaction interaction) override;
+ void RecordExtraShutdownMetrics() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsHelper);
+};
+
+#endif // IOS_CHROME_BROWSER_INTERSTITIALS_IOS_CHROME_METRICS_HELPER_H_