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

Side by Side Diff: chrome/browser/ui/views/translate/translate_bubble_view.cc

Issue 133273029: Move LanguageState to the translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment + rebase Created 6 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698