| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/translate_tab_helper.h" | 5 #include "chrome/browser/translate/translate_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/translate/translate_accept_languages_factory.h" | 13 #include "chrome/browser/translate/translate_accept_languages_factory.h" |
| 13 #include "chrome/browser/translate/translate_infobar_delegate.h" | 14 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 14 #include "chrome/browser/translate/translate_service.h" | 15 #include "chrome/browser/translate/translate_service.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 18 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/translate/translate_bubble_factory.h" | 21 #include "chrome/browser/ui/translate/translate_bubble_factory.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ShowBubble(step, error_type); | 171 ShowBubble(step, error_type); |
| 171 return; | 172 return; |
| 172 } | 173 } |
| 173 | 174 |
| 174 // Infobar UI. | 175 // Infobar UI. |
| 175 Profile* profile = | 176 Profile* profile = |
| 176 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 177 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 177 Profile* original_profile = profile->GetOriginalProfile(); | 178 Profile* original_profile = profile->GetOriginalProfile(); |
| 178 TranslateInfoBarDelegate::Create( | 179 TranslateInfoBarDelegate::Create( |
| 179 step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE, | 180 step != translate::TRANSLATE_STEP_BEFORE_TRANSLATE, |
| 180 web_contents(), | 181 translate_manager_.get(), |
| 182 InfoBarService::FromWebContents(web_contents()), |
| 183 profile->IsOffTheRecord(), |
| 181 step, | 184 step, |
| 182 source_language, | 185 source_language, |
| 183 target_language, | 186 target_language, |
| 184 error_type, | 187 error_type, |
| 185 original_profile->GetPrefs(), | 188 original_profile->GetPrefs(), |
| 186 triggered_from_menu); | 189 triggered_from_menu); |
| 187 } | 190 } |
| 188 | 191 |
| 189 TranslateDriver* TranslateTabHelper::GetTranslateDriver() { | 192 TranslateDriver* TranslateTabHelper::GetTranslateDriver() { |
| 190 return &translate_driver_; | 193 return &translate_driver_; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 if (GetLanguageState().InTranslateNavigation()) | 537 if (GetLanguageState().InTranslateNavigation()) |
| 535 return; | 538 return; |
| 536 } | 539 } |
| 537 | 540 |
| 538 TranslateBubbleFactory::Show( | 541 TranslateBubbleFactory::Show( |
| 539 browser->window(), web_contents(), step, error_type); | 542 browser->window(), web_contents(), step, error_type); |
| 540 #else | 543 #else |
| 541 NOTREACHED(); | 544 NOTREACHED(); |
| 542 #endif | 545 #endif |
| 543 } | 546 } |
| OLD | NEW |