1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "components/captive_portal/captive_portal_types.h" 6 7 #include "base/logging.h" 8 9 namespace captive_portal { 10 11 namespace { 12 13 const char* const kCaptivePortalResultNames[] = { 14 "InternetConnected", 15 "NoResponse", 16 "BehindCaptivePortal", 17 "NumCaptivePortalResults", 18 }; 19 COMPILE_ASSERT(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1, 20 captive_portal_result_name_count_mismatch); 21 22 } // namespace 23 24 CaptivePortalResultToString(CaptivePortalResult result)25std::string CaptivePortalResultToString(CaptivePortalResult result) { 26 DCHECK_GE(result, 0); 27 DCHECK_LT(static_cast<unsigned int>(result), 28 arraysize(kCaptivePortalResultNames)); 29 return kCaptivePortalResultNames[result]; 30 } 31 32 } // namespace captive_portal 33