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

Unified 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: Undoing changes to extension API; saving it for later. 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 side-by-side diff with in-line comments
Download patch
Index: net/cookies/cookie_constants.cc
diff --git a/net/cookies/cookie_constants.cc b/net/cookies/cookie_constants.cc
new file mode 100644
index 0000000000000000000000000000000000000000..09d8c1d67274658052857b030aecc7a74d847017
--- /dev/null
+++ b/net/cookies/cookie_constants.cc
@@ -0,0 +1,46 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/cookies/cookie_constants.h"
+
+#include "base/logging.h"
+#include "base/string_util.h"
+
+namespace net {
+
+namespace {
+const char kPriorityLow[] = "low";
+const char kPriorityMedium[] = "medium";
+const char kPriorityHigh[] = "high";
+} // namespace
+
+NET_EXPORT const std::string CookiePriorityToString(CookiePriority priority) {
+ switch(priority) {
+ case PRIORITY_HIGH:
+ return kPriorityHigh;
+ case PRIORITY_MEDIUM:
+ return kPriorityMedium;
+ case PRIORITY_LOW:
+ return kPriorityLow;
+ default:
+ NOTREACHED();
+ }
+ return std::string();
+}
+
+NET_EXPORT CookiePriority StringToCookiePriority(const std::string& priority) {
+ std::string priority_comp(priority);
+ StringToLowerASCII(&priority_comp);
+
+ if (priority_comp == kPriorityHigh)
+ return PRIORITY_HIGH;
+ if (priority_comp == kPriorityMedium)
+ return PRIORITY_MEDIUM;
+ if (priority_comp == kPriorityLow)
+ return PRIORITY_LOW;
+
+ return PRIORITY_DEFAULT;
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698