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

Side by Side Diff: chrome/browser/interstitials/chrome_metrics_helper.cc

Issue 2405013002: Move some global feature defines to buildflags (Closed)
Patch Set: Comment Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/interstitials/chrome_metrics_helper.h" 5 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/history/history_service_factory.h" 8 #include "chrome/browser/history/history_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/features.h"
10 #include "components/history/core/browser/history_service.h" 11 #include "components/history/core/browser/history_service.h"
11 #include "components/rappor/rappor_service.h" 12 #include "components/rappor/rappor_service.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 14
14 #if defined(ENABLE_EXTENSIONS) 15 #if defined(ENABLE_EXTENSIONS)
15 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" 16 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h"
16 #endif 17 #endif
17 18
18 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 19 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
19 #include "chrome/browser/ssl/captive_portal_metrics_recorder.h" 20 #include "chrome/browser/ssl/captive_portal_metrics_recorder.h"
20 #endif 21 #endif
21 22
22 ChromeMetricsHelper::ChromeMetricsHelper( 23 ChromeMetricsHelper::ChromeMetricsHelper(
23 content::WebContents* web_contents, 24 content::WebContents* web_contents,
24 const GURL& request_url, 25 const GURL& request_url,
25 const security_interstitials::MetricsHelper::ReportDetails settings, 26 const security_interstitials::MetricsHelper::ReportDetails settings,
26 const std::string& sampling_event_name) 27 const std::string& sampling_event_name)
27 : security_interstitials::MetricsHelper( 28 : security_interstitials::MetricsHelper(
28 request_url, 29 request_url,
29 settings, 30 settings,
30 HistoryServiceFactory::GetForProfile( 31 HistoryServiceFactory::GetForProfile(
31 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 32 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
32 ServiceAccessType::EXPLICIT_ACCESS), 33 ServiceAccessType::EXPLICIT_ACCESS),
33 g_browser_process->rappor_service() 34 g_browser_process->rappor_service()
34 ? g_browser_process->rappor_service()->AsWeakPtr() 35 ? g_browser_process->rappor_service()->AsWeakPtr()
35 : base::WeakPtr<rappor::RapporService>()), 36 : base::WeakPtr<rappor::RapporService>()),
36 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) || defined(ENABLE_EXTENSIONS) 37 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) || defined(ENABLE_EXTENSIONS)
37 web_contents_(web_contents), 38 web_contents_(web_contents),
38 #endif 39 #endif
39 request_url_(request_url), 40 request_url_(request_url),
40 sampling_event_name_(sampling_event_name) { 41 sampling_event_name_(sampling_event_name) {
41 DCHECK(!sampling_event_name_.empty()); 42 DCHECK(!sampling_event_name_.empty());
42 } 43 }
43 44
44 ChromeMetricsHelper::~ChromeMetricsHelper() {} 45 ChromeMetricsHelper::~ChromeMetricsHelper() {}
45 46
46 void ChromeMetricsHelper::StartRecordingCaptivePortalMetrics(bool overridable) { 47 void ChromeMetricsHelper::StartRecordingCaptivePortalMetrics(bool overridable) {
47 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 48 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
48 captive_portal_recorder_.reset( 49 captive_portal_recorder_.reset(
49 new CaptivePortalMetricsRecorder(web_contents_, overridable)); 50 new CaptivePortalMetricsRecorder(web_contents_, overridable));
50 #endif 51 #endif
51 } 52 }
52 53
53 void ChromeMetricsHelper::RecordExtraShutdownMetrics() { 54 void ChromeMetricsHelper::RecordExtraShutdownMetrics() {
54 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 55 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
55 // The captive portal metrics should be recorded when the interstitial is 56 // The captive portal metrics should be recorded when the interstitial is
56 // closing (or destructing). 57 // closing (or destructing).
57 if (captive_portal_recorder_) 58 if (captive_portal_recorder_)
58 captive_portal_recorder_->RecordCaptivePortalUMAStatistics(); 59 captive_portal_recorder_->RecordCaptivePortalUMAStatistics();
59 #endif 60 #endif
60 } 61 }
61 62
62 void ChromeMetricsHelper::RecordExtraUserDecisionMetrics( 63 void ChromeMetricsHelper::RecordExtraUserDecisionMetrics(
63 security_interstitials::MetricsHelper::Decision decision) { 64 security_interstitials::MetricsHelper::Decision decision) {
64 #if defined(ENABLE_EXTENSIONS) 65 #if defined(ENABLE_EXTENSIONS)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 case SET_EXTENDED_REPORTING_ENABLED: 110 case SET_EXTENDED_REPORTING_ENABLED:
110 case SET_EXTENDED_REPORTING_DISABLED: 111 case SET_EXTENDED_REPORTING_DISABLED:
111 case EXTENDED_REPORTING_IS_ENABLED: 112 case EXTENDED_REPORTING_IS_ENABLED:
112 case REPORT_PHISHING_ERROR: 113 case REPORT_PHISHING_ERROR:
113 case SHOW_WHITEPAPER: 114 case SHOW_WHITEPAPER:
114 case MAX_INTERACTION: 115 case MAX_INTERACTION:
115 break; 116 break;
116 } 117 }
117 #endif 118 #endif
118 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/chrome_metrics_helper.h ('k') | chrome/browser/plugins/plugin_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698