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

Side by Side Diff: net/cookies/cookie_constants.cc

Issue 14113014: Adding Priority field to cookies. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanups and renames; adding tests; fix API. Created 7 years, 8 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
« no previous file with comments | « net/cookies/cookie_constants.h ('k') | net/cookies/cookie_monster.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
14 // These are lower-case to facilitate compare.
erikwright (departed) 2013/04/16 14:16:15 I don't think this comment is necessary. The file
huangs 2013/04/16 16:04:42 Done. Added cookie_constants_unittest.cc.
15 const char kPriorityLow[] = "low";
16 const char kPriorityMedium[] = "medium";
17 const char kPriorityHigh[] = "high";
18
19 } // namespace
20
21 NET_EXPORT const std::string CookiePriorityToString(CookiePriority priority) {
22 if (priority == PRIORITY_HIGH)
23 return kPriorityHigh;
24
25 if (priority == PRIORITY_MEDIUM)
26 return kPriorityMedium;
27
28 if (priority == PRIORITY_LOW)
29 return kPriorityLow;
30
31 NOTREACHED();
32 return std::string();
33 }
34
35 NET_EXPORT CookiePriority StringToCookiePriority(const std::string& priority) {
36 std::string priority_comp(priority);
37 StringToLowerASCII(&priority_comp);
38
39 if (priority_comp == kPriorityHigh)
40 return PRIORITY_HIGH;
41
42 if (priority_comp == kPriorityMedium)
43 return PRIORITY_MEDIUM;
44
45 if (priority_comp == kPriorityLow)
46 return PRIORITY_LOW;
47
48 return PRIORITY_DEFAULT;
49 }
50
51 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_constants.h ('k') | net/cookies/cookie_monster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698