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

Side by Side Diff: chrome/browser/language_usage_metrics.h

Issue 7348004: Record language usage as UMA histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_LANGUAGE_USAGE_METRICS_H_
6 #define CHROME_BROWSER_LANGUAGE_USAGE_METRICS_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11
12 #include "base/gtest_prod_util.h"
13 #include "third_party/cld/languages/public/languages.h"
14
15 // Methods to record language usage as UMA histograms.
16 // Language codes are defined in third_party/cld/languages/proto/languages.pb.h
17 class LanguageUsageMetrics {
18
Yusuke Sato 2011/07/13 06:52:06 nit: unnecessary vertical space?
Yuzo 2011/07/13 11:30:20 Done.
19 public:
20 // Records accept languages as a UMA histogram. |accept_languages| is a
21 // case-insensitive comma-separated list of languages/locales of either xx or
22 // xx-YY format where xx is iso-639 language code and YY is iso-3166 country
23 // code. Country code is ignored. That is, xx and Xx-YY are considered
Yusuke Sato 2011/07/13 06:52:06 s/Xx/xx/ ?
Yusuke Sato 2011/07/13 06:52:06 Your implementation seems to handle xx_YY case as
Yuzo 2011/07/13 11:30:20 Done.
Yuzo 2011/07/13 11:30:20 It was intentional to express the case-insensitive
24 // identical and recorded once.
25 static void RecordAcceptLanguages(const std::string& accept_languages);
26
27 // Records the application language as a UMA histogram. |application_locale|
28 // is a case-insensitive locale string of either xx or xx-YY format. Only the
Yusuke Sato 2011/07/13 06:52:06 ditto.
Yuzo 2011/07/13 11:30:20 Done.
29 // language part (xx in the example) is considered.
30 static void RecordApplicationLanguage(const std::string& application_locale);
31
32 private:
33 // This class must not be instantiated.
34 LanguageUsageMetrics() {}
Yusuke Sato 2011/07/13 06:52:06 I believe you can omit the implementation, '{}', i
Yuzo 2011/07/13 11:30:20 Done.
35
36 // Parses |accept_languages| and returns a set of language codes in
37 // |languages|.
38 static void ParseAcceptLanguages(const std::string& accept_languages,
39 std::set<Language>* languages);
40
41 // Parses |locale| and returns the language code.
Yusuke Sato 2011/07/13 06:52:06 Please mention the error return.
Yuzo 2011/07/13 11:30:20 Done.
42 static Language ToLanguage(const std::string& locale);
43
44 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ParseAcceptLanguages);
45 FRIEND_TEST_ALL_PREFIXES(LanguageUsageMetricsTest, ToLanguage);
46 };
47
48 #endif // CHROME_BROWSER_LANGUAGE_USAGE_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698