Chromium Code Reviews| 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..42c37784a3e4dc679942bbeefb255a9cccfa6b63 |
| --- /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 { |
| + |
| +class NET_EXPORT HttpUtilIcu { |
| + public: |
| + // Given a comma separated ordered list of language codes, return |
|
Seigo Nonaka
2016/12/12 01:48:54
nit: continue line until 80 chars.
Yirui Huang
2016/12/12 06:50:41
Done.
|
| + // the list with a qvalue appended to each language. |
| + // The way qvalues are assigned is rather simple. The qvalue |
| + // 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 qvalue of 0.2. Also, note that the 1st language |
| + // will not have a qvalue added because the absence of a qvalue 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* qvalue 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_ |