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

Side by Side Diff: components/translate/core/browser/translate_accept_languages.cc

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 #include "components/translate/core/browser/translate_accept_languages.h" 5 #include "components/translate/core/browser/translate_accept_languages.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "components/translate/core/browser/translate_download_manager.h" 11 #include "components/translate/core/browser/translate_download_manager.h"
12 #include "components/translate/core/common/translate_util.h" 12 #include "components/translate/core/common/translate_util.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 14
15 namespace translate {
16
15 TranslateAcceptLanguages::TranslateAcceptLanguages( 17 TranslateAcceptLanguages::TranslateAcceptLanguages(
16 PrefService* prefs, 18 PrefService* prefs,
17 const char* accept_languages_pref) 19 const char* accept_languages_pref)
18 : accept_languages_pref_(accept_languages_pref) { 20 : accept_languages_pref_(accept_languages_pref) {
19 InitAcceptLanguages(prefs); 21 InitAcceptLanguages(prefs);
20 22
21 // Also start listening for changes in the accept languages. 23 // Also start listening for changes in the accept languages.
22 pref_change_registrar_.Init(prefs); 24 pref_change_registrar_.Init(prefs);
23 pref_change_registrar_.Add( 25 pref_change_registrar_.Add(
24 accept_languages_pref, 26 accept_languages_pref,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // for which the CLD reports zh-CN and zh-TW. 74 // for which the CLD reports zh-CN and zh-TW.
73 std::string accept_lang(*iter); 75 std::string accept_lang(*iter);
74 size_t index = iter->find("-"); 76 size_t index = iter->find("-");
75 if (index != std::string::npos && *iter != "zh-CN" && *iter != "zh-TW") 77 if (index != std::string::npos && *iter != "zh-CN" && *iter != "zh-TW")
76 accept_lang = iter->substr(0, index); 78 accept_lang = iter->substr(0, index);
77 79
78 accept_languages_.insert(accept_lang); 80 accept_languages_.insert(accept_lang);
79 } 81 }
80 } 82 }
81 83
84 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698