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

Side by Side Diff: net/http/http_status_code.cc

Issue 16622002: Generate constants for HTTP status codes and reason phrases using macro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wtc's comments Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_status_code.h ('k') | net/http/http_status_code_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/http/http_status_code.h" 5 #include "net/http/http_status_code.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 const char* GetHttpReasonPhrase(HttpStatusCode code) { 11 const char* GetHttpReasonPhrase(HttpStatusCode code) {
12 switch (code) { 12 switch (code) {
13 case HTTP_CONTINUE: 13
14 return "Continue"; 14 #define HTTP_STATUS(label, code, reason) case HTTP_ ## label: return reason;
15 case HTTP_OK: 15 #include "net/http/http_status_code_list.h"
16 return "OK"; 16 #undef HTTP_STATUS
17 case HTTP_PARTIAL_CONTENT: 17
18 return "Partial Content";
19 case HTTP_FORBIDDEN:
20 return "Forbidden";
21 case HTTP_NOT_FOUND:
22 return "Not Found";
23 case HTTP_METHOD_NOT_ALLOWED:
24 return "Method Not Allowed";
25 case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE:
26 return "Range Not Satisfiable";
27 case HTTP_INTERNAL_SERVER_ERROR:
28 return "Internal Server Error";
29 default: 18 default:
30 NOTREACHED(); 19 NOTREACHED();
31 } 20 }
32 21
33 return ""; 22 return "";
34 } 23 }
35 24
36 } // namespace net 25 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_status_code.h ('k') | net/http/http_status_code_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698