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

Unified Diff: net/http/http_util_icu.h

Issue 2559243003: Extend with a language code in http accept languages
Patch Set: Rebased and modified descriptions Created 4 years 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/http/http_util_icu.h
diff --git a/net/http/http_util_icu.h b/net/http/http_util_icu.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b557211969382aff0e1d606c6a1f919dc07a5eb
--- /dev/null
+++ b/net/http/http_util_icu.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2016 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.
+
+#ifndef NET_HTTP_HTTP_UTIL_ICU_H_
+#define NET_HTTP_HTTP_UTIL_ICU_H_
+
+#include <string>
+
+#include "net/base/net_export.h"
+
+namespace net {
+
+class NET_EXPORT HttpUtilIcu {
+ public:
+ // Given a comma separated ordered list of language codes, return the list
+ // with a q-value appended to each language. The way q-values are assigned is
+ // rather simple. The q-value starts with 1.0 and is decremented by 0.2 for
+ // each successive entry in the list until it reaches 0.2. All the entries
+ // after that are assigned the same q-value of 0.2. Also, note that 1st
+ // language will not have a q-value added because the absence of a q-value
+ // implicitly means q=1.0.
+ //
+ // When making a http request, this should be used to determine what to put in
+ // Accept-Language header. If a comma separated list of language codes
+ // *without* q-value is sent, web servers regard all of them as having q=1.0
+ // and pick one of them even though it may not be at the beginning of the list
+ // (see http://crbug.com/5899).
+ static std::string GenerateAcceptLanguageHeader(
+ const std::string& raw_language_list);
+};
+} // namespace net
+
+#endif // NET_HTTP_HTTP_UTIL_ICU_H_

Powered by Google App Engine
This is Rietveld 408576698