OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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 #ifndef NET_HTTP_HTTP_UTIL_ICU_H_ |
| 6 #define NET_HTTP_HTTP_UTIL_ICU_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "net/base/net_export.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 namespace http_util_icu { |
| 15 // Given a comma separated ordered list of language codes, return the list |
| 16 // with a q-value appended to each language. The way q-values are assigned is |
| 17 // rather simple. The q-value starts with 1.0 and is decremented by 0.2 for |
| 18 // each successive entry in the list until it reaches 0.2. All the entries |
| 19 // after that are assigned the same q-value of 0.2. Also, note that 1st |
| 20 // language will not have a q-value added because the absence of a q-value |
| 21 // implicitly means q=1.0. |
| 22 // |
| 23 // When making a http request, this should be used to determine what to put in |
| 24 // Accept-Language header. If a comma separated list of language codes |
| 25 // *without* q-value is sent, web servers regard all of them as having q=1.0 |
| 26 // and pick one of them even though it may not be at the beginning of the list |
| 27 // (see http://crbug.com/5899). |
| 28 NET_EXPORT std::string GenerateAcceptLanguageHeader( |
| 29 const std::string& raw_language_list); |
| 30 |
| 31 } // namespace http_util_icu |
| 32 |
| 33 } // namespace net |
| 34 |
| 35 #endif // NET_HTTP_HTTP_UTIL_ICU_H_ |
OLD | NEW |