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..70dbbc5f536df992b6c2ea270a7b3fc1647fa53a 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"; |
@@ -25,6 +38,14 @@ CaptivePortalDetector::CaptivePortalDetector( |
CaptivePortalDetector::~CaptivePortalDetector() { |
} |
+// 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::DetectCaptivePortal( |
const GURL& url, |
const DetectionCallback& detection_callback) { |