Chromium Code Reviews| 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 "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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |