Chromium Code Reviews| Index: chrome/browser/tab_contents/language_state.cc |
| diff --git a/chrome/browser/tab_contents/language_state.cc b/chrome/browser/tab_contents/language_state.cc |
| index d57c959de39aab62ecbd858abcda7802eb18073a..037980e77169dc481a069fd87c679d346bbb92d0 100644 |
| --- a/chrome/browser/tab_contents/language_state.cc |
| +++ b/chrome/browser/tab_contents/language_state.cc |
| @@ -59,20 +59,26 @@ void LanguageState::LanguageDetermined(const std::string& page_language, |
| current_lang_ = page_language; |
| } |
| -std::string LanguageState::AutoTranslateTo() const { |
| - // Only auto-translate if: |
| - // - no translation is pending |
| - // - this page is in the same language as the previous page |
| - // - the previous page had been translated |
| - // - this page is not already translated |
| - // - the new page was navigated through a link. |
| - if (!translation_pending_ && |
| +bool LanguageState::InTranslateNavigation() const { |
| + // The user is in the same translate session if |
| + // - no translation is pending |
| + // - this page is in the same language as the previous page |
| + // - the previous page had been translated |
| + // - the new page was navigated through a link. |
| + return |
| + !translation_pending_ && |
| prev_original_lang_ == original_lang_ && |
| prev_original_lang_ != prev_current_lang_ && |
| - original_lang_ == current_lang_ && |
| navigation_controller_->GetActiveEntry() && |
| navigation_controller_->GetActiveEntry()->GetTransitionType() == |
| - content::PAGE_TRANSITION_LINK) { |
| + content::PAGE_TRANSITION_LINK; |
| +} |
| + |
| + |
| +std::string LanguageState::AutoTranslateTo() const { |
| + if (InTranslateNavigation() && |
| + // - this page is not already translated |
|
MAD
2013/04/25 15:25:36
missing a period ('.') at the end of the sentence.
Miguel Garcia
2013/04/25 16:17:11
Done.
|
| + original_lang_ == current_lang_ ) { |
| return prev_current_lang_; |
| } |