Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_METRICS_METRICS_UTIL_H_ | 5 #ifndef CHROME_COMMON_METRICS_METRICS_UTIL_H_ |
| 6 #define CHROME_COMMON_METRICS_METRICS_UTIL_H_ | 6 #define CHROME_COMMON_METRICS_METRICS_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 namespace metrics { | 12 namespace metrics { |
| 13 | 13 |
| 14 // Computes a uint32 hash of a given string based on its SHA1 hash. Suitable for | 14 // Computes a uint32 hash of a given string based on its SHA1 hash. Suitable for |
| 15 // uniquely identifying field trial names and group names. | 15 // uniquely identifying field trial names and group names. |
| 16 uint32 HashName(const std::string& name); | 16 uint32 HashName(const std::string& name); |
| 17 | 17 |
| 18 // Parses |locale| and returns the language code. Returns 0 in case of errors. | |
| 19 // The language code is calculated from two alphabets. For example, if | |
| 20 // |locale| is 'en' which represents 'English', the codes of 'e' and 'n' are | |
| 21 // 101 and 110 respectively, and the language code will be 101 * 256 + 100 = | |
| 22 // 25966. | |
| 23 // |locale| should consist of only lower-case letters. This function doesn't | |
| 24 // check whether |locale| is valid locale or not strictly. | |
| 25 int ToLanguageCode(const std::string &locale); | |
|
Ilya Sherman
2013/05/21 22:53:59
This is not an appropriate location for this funct
hajimehoshi
2013/05/22 04:19:27
I'll create chrome/browser/metrics/metrics_util.{c
Ilya Sherman
2013/05/22 07:51:36
This code doesn't belong under metrics/, whether i
hajimehoshi
2013/05/22 08:08:36
Thank you for your quick review. I'll this code t
| |
| 26 | |
| 18 } // namespace metrics | 27 } // namespace metrics |
| 19 | 28 |
| 20 #endif // CHROME_COMMON_METRICS_METRICS_UTIL_H_ | 29 #endif // CHROME_COMMON_METRICS_METRICS_UTIL_H_ |
| OLD | NEW |