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

Unified Diff: chrome/browser/ssl/captive_portal_metrics_recorder.cc

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.cc ('k') | chrome/browser/ssl/ssl_client_auth_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/captive_portal_metrics_recorder.cc
diff --git a/chrome/browser/ssl/captive_portal_metrics_recorder.cc b/chrome/browser/ssl/captive_portal_metrics_recorder.cc
index 9449116737a9e944115bf44a1a32e598cbd0b6e2..be17162e087dca12bf8027646552612a1c7e3e03 100644
--- a/chrome/browser/ssl/captive_portal_metrics_recorder.cc
+++ b/chrome/browser/ssl/captive_portal_metrics_recorder.cc
@@ -81,29 +81,30 @@ void CaptivePortalMetricsRecorder::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ DCHECK_EQ(chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, type);
+
// When detection is disabled, captive portal service always sends
// RESULT_INTERNET_CONNECTED. Ignore any probe results in that case.
if (!captive_portal_detection_enabled_)
return;
- if (type == chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT) {
- captive_portal_probe_completed_ = true;
- CaptivePortalService::Results* results =
- content::Details<CaptivePortalService::Results>(details).ptr();
- // If a captive portal was detected at any point when the interstitial was
- // displayed, assume that the interstitial was caused by a captive portal.
- // Example scenario:
- // 1- Interstitial displayed and captive portal detected, setting the flag.
- // 2- Captive portal detection automatically opens portal login page.
- // 3- User logs in on the portal login page.
- // A notification will be received here for RESULT_INTERNET_CONNECTED. Make
- // sure we don't clear the captive protal flag, since the interstitial was
- // potentially caused by the captive portal.
- captive_portal_detected_ =
- captive_portal_detected_ ||
- (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
- // Also keep track of non-HTTP portals and error cases.
- captive_portal_no_response_ =
- captive_portal_no_response_ ||
- (results->result == captive_portal::RESULT_NO_RESPONSE);
- }
+
+ captive_portal_probe_completed_ = true;
+ CaptivePortalService::Results* results =
+ content::Details<CaptivePortalService::Results>(details).ptr();
+ // If a captive portal was detected at any point when the interstitial was
+ // displayed, assume that the interstitial was caused by a captive portal.
+ // Example scenario:
+ // 1- Interstitial displayed and captive portal detected, setting the flag.
+ // 2- Captive portal detection automatically opens portal login page.
+ // 3- User logs in on the portal login page.
+ // A notification will be received here for RESULT_INTERNET_CONNECTED. Make
+ // sure we don't clear the captive protal flag, since the interstitial was
+ // potentially caused by the captive portal.
+ captive_portal_detected_ =
+ captive_portal_detected_ ||
+ (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
+ // Also keep track of non-HTTP portals and error cases.
+ captive_portal_no_response_ =
+ captive_portal_no_response_ ||
+ (results->result == captive_portal::RESULT_NO_RESPONSE);
}
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.cc ('k') | chrome/browser/ssl/ssl_client_auth_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698