| 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 #include "chrome/browser/language_usage_metrics.h" | 5 #include "components/language_usage_metrics/language_usage_metrics.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 void RecordAcceptLanguage(int language_code) { | 14 void RecordAcceptLanguage(int language_code) { |
| 15 UMA_HISTOGRAM_SPARSE_SLOWLY("LanguageUsage.AcceptLanguage", | 15 UMA_HISTOGRAM_SPARSE_SLOWLY("LanguageUsage.AcceptLanguage", |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const std::string& accept_languages, | 62 const std::string& accept_languages, |
| 63 std::set<int>* languages) { | 63 std::set<int>* languages) { |
| 64 languages->clear(); | 64 languages->clear(); |
| 65 base::StringTokenizer locales(accept_languages, ","); | 65 base::StringTokenizer locales(accept_languages, ","); |
| 66 while (locales.GetNext()) { | 66 while (locales.GetNext()) { |
| 67 const int language_code = ToLanguageCode(locales.token()); | 67 const int language_code = ToLanguageCode(locales.token()); |
| 68 if (language_code != 0) | 68 if (language_code != 0) |
| 69 languages->insert(language_code); | 69 languages->insert(language_code); |
| 70 } | 70 } |
| 71 } | 71 } |
| OLD | NEW |