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