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..8b32ae9d5d01af36043e1df72ec8c1aeccbd82a3 |
--- /dev/null |
+++ b/net/http/http_util_icu.h |
@@ -0,0 +1,35 @@ |
+// 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 { |
+ |
+namespace http_util_icu { |
+// 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). |
+NET_EXPORT std::string GenerateAcceptLanguageHeader( |
+ const std::string& raw_language_list); |
+ |
+} // namespace http_util_icu |
+ |
+} // namespace net |
+ |
+#endif // NET_HTTP_HTTP_UTIL_ICU_H_ |