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

Unified Diff: chrome/common/translate/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, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/translate/translate_util.cc
diff --git a/chrome/common/translate/translate_util.cc b/chrome/common/translate/translate_util.cc
deleted file mode 100644
index 4391870ce84140f80344aeab214f83edb42e4965..0000000000000000000000000000000000000000
--- a/chrome/common/translate/translate_util.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/translate/translate_util.h"
-
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "chrome/common/chrome_switches.h"
-#include "url/gurl.h"
-
-namespace TranslateUtil {
-
-// Language code synonyms. Some languages have changed codes over the years
-// and sometimes the older codes are used, so we must see them as synonyms.
-struct LanguageCodeSynonym {
- // Code used in supporting list of Translate.
- const char* const translate_language;
-
- // Code used in Chrome internal.
- const char* const chrome_language;
-};
-
-// If this table is updated, please sync this with that in
-// chrome/browser/resources/options/language_options.js
-const LanguageCodeSynonym kLanguageCodeSynonyms[] = {
- {"no", "nb"},
- {"iw", "he"},
- {"jw", "jv"},
- {"tl", "fil"},
-};
-
-const char kSecurityOrigin[] = "https://translate.googleapis.com/";
-
-void ToTranslateLanguageSynonym(std::string* language) {
- // Apply liner search here because number of items in the list is just four.
- for (size_t i = 0; i < arraysize(kLanguageCodeSynonyms); ++i) {
- if (language->compare(kLanguageCodeSynonyms[i].chrome_language) == 0) {
- *language = std::string(kLanguageCodeSynonyms[i].translate_language);
- break;
- }
- }
-}
-
-void ToChromeLanguageSynonym(std::string* language) {
- // Apply liner search here because number of items in the list is just four.
- for (size_t i = 0; i < arraysize(kLanguageCodeSynonyms); ++i) {
- if (language->compare(kLanguageCodeSynonyms[i].translate_language) == 0) {
- *language = std::string(kLanguageCodeSynonyms[i].chrome_language);
- break;
- }
- }
-}
-
-GURL GetTranslateSecurityOrigin() {
- std::string security_origin(kSecurityOrigin);
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kTranslateSecurityOrigin)) {
- security_origin =
- command_line->GetSwitchValueASCII(switches::kTranslateSecurityOrigin);
- }
- return GURL(security_origin);
-}
-
-} // namespace TranslateUtil

Powered by Google App Engine
This is Rietveld 408576698