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 #include "components/translate/core/browser/translate_accept_languages.h" | 5 #include "components/translate/core/browser/translate_accept_languages.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "components/translate/core/browser/translate_download_manager.h" | 13 #include "components/translate/core/browser/translate_download_manager.h" |
12 #include "components/translate/core/common/translate_util.h" | 14 #include "components/translate/core/common/translate_util.h" |
13 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
14 | 16 |
15 namespace translate { | 17 namespace translate { |
16 | 18 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Get rid of the locale extension if any (ex: en-US -> en), but for Chinese | 71 // Get rid of the locale extension if any (ex: en-US -> en), but for Chinese |
70 // for which the CLD reports zh-CN and zh-TW. | 72 // for which the CLD reports zh-CN and zh-TW. |
71 size_t index = lang.find('-'); | 73 size_t index = lang.find('-'); |
72 if (index != base::StringPiece::npos && lang != "zh-CN" && lang != "zh-TW") | 74 if (index != base::StringPiece::npos && lang != "zh-CN" && lang != "zh-TW") |
73 accept_languages_.insert(lang.substr(0, index).as_string()); | 75 accept_languages_.insert(lang.substr(0, index).as_string()); |
74 accept_languages_.insert(lang.as_string()); | 76 accept_languages_.insert(lang.as_string()); |
75 } | 77 } |
76 } | 78 } |
77 | 79 |
78 } // namespace translate | 80 } // namespace translate |
OLD | NEW |