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

Unified Diff: components/captive_portal/captive_portal_types.cc

Issue 242483003: Move CaptivePortalDetector to src/components/captive_portal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move CaptivePortalDetector to a component Created 6 years, 8 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
Index: components/captive_portal/captive_portal_types.cc
diff --git a/components/captive_portal/captive_portal_types.cc b/components/captive_portal/captive_portal_types.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b89d4f233fbd8b5adc548ec0ca6efef3f32132a1
--- /dev/null
+++ b/components/captive_portal/captive_portal_types.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/captive_portal/captive_portal_types.h"
+
+#include "base/logging.h"
+
+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);
+
+const char kCaptivePortalStatusUnknown[] = "Unknown";
+const char kCaptivePortalStatusOffline[] = "Offline";
+const char kCaptivePortalStatusOnline[] = "Online";
+const char kCaptivePortalStatusPortal[] = "Portal";
+const char kCaptivePortalStatusProxyAuthRequired[] = "ProxyAuthRequired";
+const char kCaptivePortalStatusUnrecognized[] = "Unrecognized";
+
+} // namespace
+
+
+std::string CaptivePortalResultToString(CaptivePortalResult result) {
+ DCHECK_GE(result, 0);
+ DCHECK_LT(static_cast<unsigned int>(result),
+ arraysize(kCaptivePortalResultNames));
+ return kCaptivePortalResultNames[result];
+}
+
+std::string CaptivePortalStatusString(CaptivePortalStatus status) {
+ switch (status) {
+ case CAPTIVE_PORTAL_STATUS_UNKNOWN:
+ return kCaptivePortalStatusUnknown;
+ case CAPTIVE_PORTAL_STATUS_OFFLINE:
+ return kCaptivePortalStatusOffline;
+ case CAPTIVE_PORTAL_STATUS_ONLINE:
+ return kCaptivePortalStatusOnline;
+ case CAPTIVE_PORTAL_STATUS_PORTAL:
+ return kCaptivePortalStatusPortal;
+ case CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
+ return kCaptivePortalStatusProxyAuthRequired;
+ case CAPTIVE_PORTAL_STATUS_COUNT:
+ NOTREACHED();
+ }
+ return kCaptivePortalStatusUnrecognized;
+}
+
+} // namespace captive_portal

Powered by Google App Engine
This is Rietveld 408576698