 Chromium Code Reviews
 Chromium Code Reviews Issue 2559243003:
  Extend with a language code in http accept languages
    
  
    Issue 2559243003:
  Extend with a language code in http accept languages 
  | 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..84cfdf441a463ec00669a6c10b42c74cf128e685 | 
| --- /dev/null | 
| +++ b/net/http/http_util_icu.h | 
| @@ -0,0 +1,32 @@ | 
| +// 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 { | 
| 
Ryan Sleevi
2016/12/15 23:44:07
line break between 12/13
 
Yirui Huang
2016/12/16 08:00:08
Done.
 
jungshik at Google
2016/12/16 08:01:45
Do we need '_icu' suffix in the namespace? 
And,
 | 
| +// 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). | 
| +std::string NET_EXPORT | 
| 
Ryan Sleevi
2016/12/15 23:44:07
NET_EXPORT std::string
 
Yirui Huang
2016/12/16 08:00:08
Done.
 | 
| +GenerateAcceptLanguageHeader(const std::string& raw_language_list); | 
| +} // namespace http_util_icu | 
| +} // namespace net | 
| 
Ryan Sleevi
2016/12/15 23:44:07
line breaks between 28/29 and 29/30
 
Yirui Huang
2016/12/16 08:00:08
Done.
 | 
| + | 
| +#endif // NET_HTTP_HTTP_UTIL_ICU_H_ |