| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ | 5 #ifndef COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ |
| 6 #define COMPONENTS_LANGUAGE_USAGE_METRICS_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" | |
| 12 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" |
| 13 | 13 |
| 14 namespace language_usage_metrics { | 14 namespace language_usage_metrics { |
| 15 | 15 |
| 16 // Methods to record language usage as UMA histograms. | 16 // Methods to record language usage as UMA histograms. |
| 17 class LanguageUsageMetrics { | 17 class LanguageUsageMetrics { |
| 18 public: | 18 public: |
| 19 // Records accept languages as a UMA histogram. |accept_languages| is a | 19 // Records accept languages as a UMA histogram. |accept_languages| is a |
| 20 // case-insensitive comma-separated list of languages/locales of either xx, | 20 // case-insensitive comma-separated list of languages/locales of either xx, |
| 21 // 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 |
| 22 // 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 // |languages|. | 44 // |languages|. |
| 45 static void ParseAcceptLanguages(const std::string& accept_languages, | 45 static void ParseAcceptLanguages(const std::string& accept_languages, |
| 46 std::set<int>* languages); | 46 std::set<int>* languages); |
| 47 | 47 |
| 48 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ParseAcceptLanguages); | 48 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ParseAcceptLanguages); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace language_usage_metrics | 51 } // namespace language_usage_metrics |
| 52 | 52 |
| 53 #endif // COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ | 53 #endif // COMPONENTS_LANGUAGE_USAGE_METRICS_LANGUAGE_USAGE_METRICS_H_ |
| OLD | NEW |