OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/translate/translate_util.h" | 5 #include "components/translate/common/translate_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "components/translate/common/translate_switches.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
12 namespace TranslateUtil { | 12 namespace translate { |
13 | 13 |
14 // Language code synonyms. Some languages have changed codes over the years | 14 // Language code synonyms. Some languages have changed codes over the years |
15 // and sometimes the older codes are used, so we must see them as synonyms. | 15 // and sometimes the older codes are used, so we must see them as synonyms. |
16 struct LanguageCodeSynonym { | 16 struct LanguageCodeSynonym { |
17 // Code used in supporting list of Translate. | 17 // Code used in supporting list of Translate. |
18 const char* const translate_language; | 18 const char* const translate_language; |
19 | 19 |
20 // Code used in Chrome internal. | 20 // Code used in Chrome internal. |
21 const char* const chrome_language; | 21 const char* const chrome_language; |
22 }; | 22 }; |
(...skipping 25 matching lines...) Expand all Loading... |
48 if (language->compare(kLanguageCodeSynonyms[i].translate_language) == 0) { | 48 if (language->compare(kLanguageCodeSynonyms[i].translate_language) == 0) { |
49 *language = std::string(kLanguageCodeSynonyms[i].chrome_language); | 49 *language = std::string(kLanguageCodeSynonyms[i].chrome_language); |
50 break; | 50 break; |
51 } | 51 } |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 GURL GetTranslateSecurityOrigin() { | 55 GURL GetTranslateSecurityOrigin() { |
56 std::string security_origin(kSecurityOrigin); | 56 std::string security_origin(kSecurityOrigin); |
57 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 57 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
58 if (command_line->HasSwitch(switches::kTranslateSecurityOrigin)) { | 58 if (command_line->HasSwitch(kTranslateSecurityOrigin)) { |
59 security_origin = | 59 security_origin = |
60 command_line->GetSwitchValueASCII(switches::kTranslateSecurityOrigin); | 60 command_line->GetSwitchValueASCII(kTranslateSecurityOrigin); |
61 } | 61 } |
62 return GURL(security_origin); | 62 return GURL(security_origin); |
63 } | 63 } |
64 | 64 |
65 } // namespace TranslateUtil | 65 } // namespace translate |
OLD | NEW |