Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: components/language_usage_metrics/language_usage_metrics.cc

Issue 131203002: Move LanguageUsageMetrics and TranslateBrowserMetrics to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698