| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 report_error_url += "&sl="; | 587 report_error_url += "&sl="; |
| 588 | 588 |
| 589 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 589 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
| 590 tab_contents)->translate_tab_helper(); | 590 tab_contents)->translate_tab_helper(); |
| 591 report_error_url += helper->language_state().original_language(); | 591 report_error_url += helper->language_state().original_language(); |
| 592 report_error_url += "&hl="; | 592 report_error_url += "&hl="; |
| 593 report_error_url += | 593 report_error_url += |
| 594 GetLanguageCode(g_browser_process->GetApplicationLocale()); | 594 GetLanguageCode(g_browser_process->GetApplicationLocale()); |
| 595 // Open that URL in a new tab so that the user can tell us more. | 595 // Open that URL in a new tab so that the user can tell us more. |
| 596 Browser* browser = BrowserList::GetLastActiveWithProfile( | 596 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 597 tab_contents->profile()); | 597 static_cast<Profile*>(tab_contents->context())); |
| 598 if (!browser) { | 598 if (!browser) { |
| 599 NOTREACHED(); | 599 NOTREACHED(); |
| 600 return; | 600 return; |
| 601 } | 601 } |
| 602 browser->AddSelectedTabWithURL(GURL(report_error_url), | 602 browser->AddSelectedTabWithURL(GURL(report_error_url), |
| 603 PageTransition::AUTO_BOOKMARK); | 603 PageTransition::AUTO_BOOKMARK); |
| 604 } | 604 } |
| 605 | 605 |
| 606 void TranslateManager::DoTranslatePage(TabContents* tab, | 606 void TranslateManager::DoTranslatePage(TabContents* tab, |
| 607 const std::string& translate_script, | 607 const std::string& translate_script, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 return NULL; | 793 return NULL; |
| 794 | 794 |
| 795 for (size_t i = 0; i < wrapper->infobar_count(); ++i) { | 795 for (size_t i = 0; i < wrapper->infobar_count(); ++i) { |
| 796 TranslateInfoBarDelegate* delegate = | 796 TranslateInfoBarDelegate* delegate = |
| 797 wrapper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 797 wrapper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
| 798 if (delegate) | 798 if (delegate) |
| 799 return delegate; | 799 return delegate; |
| 800 } | 800 } |
| 801 return NULL; | 801 return NULL; |
| 802 } | 802 } |
| OLD | NEW |