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

Side by Side Diff: components/translate/common/translate_util.cc

Issue 25531002: Move language detection to a component (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix compilation Created 7 years, 2 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 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698