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

Unified Diff: chrome/browser/captive_portal/captive_portal_detector.cc

Issue 11419070: Added detection timeouts and usage of Retry-After HTTP header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added VLOGs. Created 8 years, 1 month 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/captive_portal/captive_portal_detector.cc
diff --git a/chrome/browser/captive_portal/captive_portal_detector.cc b/chrome/browser/captive_portal/captive_portal_detector.cc
index 4c59437cbf662699fc5864d7bfc8ab88cfb4f57f..ce5079e45ed2335face3e881957f4cbb665b87ef 100644
--- a/chrome/browser/captive_portal/captive_portal_detector.cc
+++ b/chrome/browser/captive_portal/captive_portal_detector.cc
@@ -14,6 +14,19 @@
namespace captive_portal {
+namespace {
+
+const char* const kCaptivePortalResultNames[] = {
+ "InternetConnected",
+ "NoResponse",
+ "BehindCaptivePortal",
+ "NumCaptivePortalResults",
+};
+COMPILE_ASSERT(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1,
+ captive_portal_result_name_count_mismatch);
+
+} // namespace
+
const char CaptivePortalDetector::kDefaultURL[] =
"http://www.gstatic.com/generate_204";
@@ -58,6 +71,14 @@ void CaptivePortalDetector::Cancel() {
detection_callback_.Reset();
}
+// static
+std::string CaptivePortalDetector::CaptivePortalResultToString(Result result) {
+ DCHECK_GE(result, 0);
+ DCHECK_LT(static_cast<unsigned int>(result),
+ arraysize(kCaptivePortalResultNames));
+ return kCaptivePortalResultNames[result];
+}
+
void CaptivePortalDetector::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(CalledOnValidThread());
DCHECK(FetchingURL());

Powered by Google App Engine
This is Rietveld 408576698