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

Side by Side Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 322733002: Translate: Bug fix: need to normalize the language code for Translate UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/translate/chrome_translate_client.h" 5 #include "chrome/browser/translate/chrome_translate_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 std::string* source, 119 std::string* source,
120 std::string* target) { 120 std::string* target) {
121 DCHECK(source != NULL); 121 DCHECK(source != NULL);
122 DCHECK(target != NULL); 122 DCHECK(target != NULL);
123 123
124 ChromeTranslateClient* chrome_translate_client = 124 ChromeTranslateClient* chrome_translate_client =
125 FromWebContents(web_contents); 125 FromWebContents(web_contents);
126 if (!chrome_translate_client) 126 if (!chrome_translate_client)
127 return; 127 return;
128 128
129 *source = chrome_translate_client->GetLanguageState().original_language(); 129 *source = TranslateDownloadManager::GetLanguageCode(
Takashi Toyoshima 2014/06/09 05:23:18 take over from https://codereview.chromium.org/317
130 chrome_translate_client->GetLanguageState().original_language());
130 131
131 Profile* profile = 132 Profile* profile =
132 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 133 Profile::FromBrowserContext(web_contents->GetBrowserContext());
133 Profile* original_profile = profile->GetOriginalProfile(); 134 Profile* original_profile = profile->GetOriginalProfile();
134 PrefService* prefs = original_profile->GetPrefs(); 135 PrefService* prefs = original_profile->GetPrefs();
135 scoped_ptr<TranslatePrefs> translate_prefs = CreateTranslatePrefs(prefs); 136 scoped_ptr<TranslatePrefs> translate_prefs = CreateTranslatePrefs(prefs);
136 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { 137 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) {
137 std::string auto_translate_language = 138 std::string auto_translate_language =
138 TranslateManager::GetAutoTargetLanguage(*source, translate_prefs.get()); 139 TranslateManager::GetAutoTargetLanguage(*source, translate_prefs.get());
139 if (!auto_translate_language.empty()) { 140 if (!auto_translate_language.empty()) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 if (GetLanguageState().InTranslateNavigation()) 546 if (GetLanguageState().InTranslateNavigation())
546 return; 547 return;
547 } 548 }
548 549
549 TranslateBubbleFactory::Show( 550 TranslateBubbleFactory::Show(
550 browser->window(), web_contents(), step, error_type); 551 browser->window(), web_contents(), step, error_type);
551 #else 552 #else
552 NOTREACHED(); 553 NOTREACHED();
553 #endif 554 #endif
554 } 555 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698