OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_LANGUAGE_USAGE_METRICS_H_ | 5 #ifndef COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ |
6 #define CHROME_BROWSER_LANGUAGE_USAGE_METRICS_H_ | 6 #define COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 | 13 |
| 14 namespace language_usage_metrics { |
| 15 |
14 // Methods to record language usage as UMA histograms. | 16 // Methods to record language usage as UMA histograms. |
15 class LanguageUsageMetrics { | 17 class LanguageUsageMetrics { |
16 public: | 18 public: |
17 // Records accept languages as a UMA histogram. |accept_languages| is a | 19 // Records accept languages as a UMA histogram. |accept_languages| is a |
18 // case-insensitive comma-separated list of languages/locales of either xx, | 20 // case-insensitive comma-separated list of languages/locales of either xx, |
19 // xx-YY, or xx_YY format where xx is iso-639 language code and YY is iso-3166 | 21 // xx-YY, or xx_YY format where xx is iso-639 language code and YY is iso-3166 |
20 // country code. Country code is ignored. That is, xx and XX-YY are considered | 22 // country code. Country code is ignored. That is, xx and XX-YY are considered |
21 // identical and recorded once. | 23 // identical and recorded once. |
22 static void RecordAcceptLanguages(const std::string& accept_languages); | 24 static void RecordAcceptLanguages(const std::string& accept_languages); |
23 | 25 |
(...skipping 15 matching lines...) Expand all Loading... |
39 DISALLOW_IMPLICIT_CONSTRUCTORS(LanguageUsageMetrics); | 41 DISALLOW_IMPLICIT_CONSTRUCTORS(LanguageUsageMetrics); |
40 | 42 |
41 // Parses |accept_languages| and returns a set of language codes in | 43 // Parses |accept_languages| and returns a set of language codes in |
42 // |languages|. | 44 // |languages|. |
43 static void ParseAcceptLanguages(const std::string& accept_languages, | 45 static void ParseAcceptLanguages(const std::string& accept_languages, |
44 std::set<int>* languages); | 46 std::set<int>* languages); |
45 | 47 |
46 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ParseAcceptLanguages); | 48 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ParseAcceptLanguages); |
47 }; | 49 }; |
48 | 50 |
49 #endif // CHROME_BROWSER_LANGUAGE_USAGE_METRICS_H_ | 51 } // namespace language_usage_metrics |
| 52 |
| 53 #endif // COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ |
OLD | NEW |