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 #include "base/macros.h" |
8 | 9 |
9 namespace captive_portal { | 10 namespace captive_portal { |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 const char* const kCaptivePortalResultNames[] = { | 14 const char* const kCaptivePortalResultNames[] = { |
14 "InternetConnected", | 15 "InternetConnected", |
15 "NoResponse", | 16 "NoResponse", |
16 "BehindCaptivePortal", | 17 "BehindCaptivePortal", |
17 "NumCaptivePortalResults", | 18 "NumCaptivePortalResults", |
18 }; | 19 }; |
19 static_assert(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1, | 20 static_assert(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1, |
20 "kCaptivePortalResultNames should have " | 21 "kCaptivePortalResultNames should have " |
21 "RESULT_COUNT + 1 elements"); | 22 "RESULT_COUNT + 1 elements"); |
22 | 23 |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 | 26 |
26 std::string CaptivePortalResultToString(CaptivePortalResult result) { | 27 std::string CaptivePortalResultToString(CaptivePortalResult result) { |
27 DCHECK_GE(result, 0); | 28 DCHECK_GE(result, 0); |
28 DCHECK_LT(static_cast<unsigned int>(result), | 29 DCHECK_LT(static_cast<unsigned int>(result), |
29 arraysize(kCaptivePortalResultNames)); | 30 arraysize(kCaptivePortalResultNames)); |
30 return kCaptivePortalResultNames[result]; | 31 return kCaptivePortalResultNames[result]; |
31 } | 32 } |
32 | 33 |
33 } // namespace captive_portal | 34 } // namespace captive_portal |
OLD | NEW |