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

Side by Side Diff: components/security_interstitials/metrics_helper.cc

Issue 1263133002: Fix SSL bad clock interstitial crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And for good measure, history_service_ too Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/security_interstitials/metrics_helper.h" 5 #include "components/security_interstitials/metrics_helper.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "components/history/core/browser/history_service.h" 8 #include "components/history/core/browser/history_service.h"
9 #include "components/rappor/rappor_service.h" 9 #include "components/rappor/rappor_service.h"
10 #include "components/rappor/rappor_utils.h" 10 #include "components/rappor/rappor_utils.h"
(...skipping 13 matching lines...) Expand all
24 MetricsHelper::MetricsHelper(const GURL& request_url, 24 MetricsHelper::MetricsHelper(const GURL& request_url,
25 const ReportDetails settings, 25 const ReportDetails settings,
26 history::HistoryService* history_service, 26 history::HistoryService* history_service,
27 rappor::RapporService* rappor_service) 27 rappor::RapporService* rappor_service)
28 : request_url_(request_url), 28 : request_url_(request_url),
29 settings_(settings), 29 settings_(settings),
30 rappor_service_(rappor_service), 30 rappor_service_(rappor_service),
31 num_visits_(-1) { 31 num_visits_(-1) {
32 DCHECK(!settings_.metric_prefix.empty()); 32 DCHECK(!settings_.metric_prefix.empty());
33 if (settings_.rappor_report_type == rappor::NUM_RAPPOR_TYPES) // Default. 33 if (settings_.rappor_report_type == rappor::NUM_RAPPOR_TYPES) // Default.
34 rappor_service = nullptr; 34 rappor_service_ = nullptr;
35 DCHECK(!rappor_service || !settings_.rappor_prefix.empty()); 35 DCHECK(!rappor_service_ || !settings_.rappor_prefix.empty());
36 if (history_service) { 36 if (history_service_) {
estark 2015/07/31 00:53:34 Wait, is this right? It looks like this should act
felt 2015/07/31 00:56:56 Done.
37 history_service->GetVisibleVisitCountToHost( 37 history_service_->GetVisibleVisitCountToHost(
38 request_url_, 38 request_url_,
39 base::Bind(&MetricsHelper::OnGotHistoryCount, base::Unretained(this)), 39 base::Bind(&MetricsHelper::OnGotHistoryCount, base::Unretained(this)),
40 &request_tracker_); 40 &request_tracker_);
41 } 41 }
42 } 42 }
43 43
44 // Directly adds to the UMA histograms, using the same properties as 44 // Directly adds to the UMA histograms, using the same properties as
45 // UMA_HISTOGRAM_ENUMERATION, because the macro doesn't allow non-constant 45 // UMA_HISTOGRAM_ENUMERATION, because the macro doesn't allow non-constant
46 // histogram names. Reports to Rappor for certain decisions. 46 // histogram names. Reports to Rappor for certain decisions.
47 void MetricsHelper::RecordUserDecision(Decision decision) { 47 void MetricsHelper::RecordUserDecision(Decision decision) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 void MetricsHelper::OnGotHistoryCount(bool success, 109 void MetricsHelper::OnGotHistoryCount(bool success,
110 int num_visits, 110 int num_visits,
111 base::Time /*first_visit*/) { 111 base::Time /*first_visit*/) {
112 if (success) 112 if (success)
113 num_visits_ = num_visits; 113 num_visits_ = num_visits;
114 } 114 }
115 115
116 } // namespace security_interstitials 116 } // namespace security_interstitials
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698