OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/cookies/cookie_constants.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/string_util.h" | |
9 | |
10 namespace net { | |
11 | |
12 namespace { | |
13 std::string kPriorityLow("Low"); | |
erikwright (departed)
2013/04/15 19:00:37
I believe these need to be const char[].
erikwright (departed)
2013/04/15 19:00:37
I don't see any reason to output these with capita
huangs
2013/04/15 21:29:40
Done.
huangs
2013/04/15 21:29:40
Done.
| |
14 std::string kPriorityMedium("Medium"); | |
15 std::string kPriorityHigh("High"); | |
16 } // namespace | |
17 | |
18 NET_EXPORT const std::string PriorityToString(CookiePriority priority) { | |
19 std::string ret; | |
20 if (priority == PRIORITY_HIGH) | |
21 ret = kPriorityHigh; | |
erikwright (departed)
2013/04/15 19:00:37
just return from here.
huangs
2013/04/15 21:29:40
Done (although this leads to longer code).
erikwright (departed)
2013/04/16 14:16:15
Well, you did also add 3 lines of whitespace ;)
T
| |
22 else if (priority == PRIORITY_MEDIUM) | |
23 ret = kPriorityMedium; | |
24 else if (priority == PRIORITY_LOW) | |
25 ret = kPriorityLow; | |
26 else | |
27 NOTREACHED(); // Returns empty string. | |
28 return ret; | |
29 } | |
30 | |
31 NET_EXPORT CookiePriority StringToPriority(const std::string& priority_str) { | |
32 std::string priority_comp(priority_str); | |
33 StringToLowerASCII(&priority_comp); | |
34 // Capitalize first letter to match case with constants. | |
35 if (!priority_comp.empty()) | |
36 *(priority_comp.begin()) = base::ToUpperASCII(*(priority_comp.begin())); | |
37 | |
38 CookiePriority ret = PRIORITY_DEFAULT; | |
39 if (priority_comp == kPriorityHigh) | |
40 ret = PRIORITY_HIGH; | |
erikwright (departed)
2013/04/15 19:00:37
just return the value directly here.
huangs
2013/04/15 21:29:40
Done.
| |
41 else if (priority_comp == kPriorityMedium) | |
42 ret = PRIORITY_MEDIUM; | |
43 else if (priority_comp == kPriorityLow) | |
44 ret = PRIORITY_LOW; | |
45 return ret; | |
46 } | |
47 | |
48 } // namespace net | |
OLD | NEW |