| 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/browser/ui/views/translate/translate_bubble_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void GetTranslateLanguages(content::WebContents* web_contents, | 59 void GetTranslateLanguages(content::WebContents* web_contents, |
| 60 std::string* source, | 60 std::string* source, |
| 61 std::string* target) { | 61 std::string* target) { |
| 62 DCHECK(source != NULL); | 62 DCHECK(source != NULL); |
| 63 DCHECK(target != NULL); | 63 DCHECK(target != NULL); |
| 64 | 64 |
| 65 TranslateTabHelper* translate_tab_helper = | 65 TranslateTabHelper* translate_tab_helper = |
| 66 TranslateTabHelper::FromWebContents(web_contents); | 66 TranslateTabHelper::FromWebContents(web_contents); |
| 67 *source = translate_tab_helper->language_state().original_language(); | 67 *source = translate_tab_helper->GetLanguageState().original_language(); |
| 68 | 68 |
| 69 Profile* profile = | 69 Profile* profile = |
| 70 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 70 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 71 Profile* original_profile = profile->GetOriginalProfile(); | 71 Profile* original_profile = profile->GetOriginalProfile(); |
| 72 PrefService* prefs = original_profile->GetPrefs(); | 72 PrefService* prefs = original_profile->GetPrefs(); |
| 73 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { | 73 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { |
| 74 std::string auto_translate_language = | 74 std::string auto_translate_language = |
| 75 TranslateManager::GetAutoTargetLanguage(*source, prefs); | 75 TranslateManager::GetAutoTargetLanguage(*source, prefs); |
| 76 if (!auto_translate_language.empty()) { | 76 if (!auto_translate_language.empty()) { |
| 77 *target = auto_translate_language; | 77 *target = auto_translate_language; |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 model_->ShouldAlwaysTranslate()); | 790 model_->ShouldAlwaysTranslate()); |
| 791 } | 791 } |
| 792 | 792 |
| 793 base::string16 label; | 793 base::string16 label; |
| 794 if (model_->IsPageTranslatedInCurrentLanguages()) | 794 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 795 label = l10n_util::GetStringUTF16(IDS_DONE); | 795 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 796 else | 796 else |
| 797 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 797 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 798 advanced_done_button_->SetText(label); | 798 advanced_done_button_->SetText(label); |
| 799 } | 799 } |
| OLD | NEW |