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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | chrome/browser/ui/browser.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/infobars/infobar_tab_helper.h" 19 #include "chrome/browser/infobars/infobar_tab_helper.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/tab_contents/language_state.h" 22 #include "chrome/browser/tab_contents/language_state.h"
23 #include "chrome/browser/tab_contents/tab_util.h" 23 #include "chrome/browser/tab_contents/tab_util.h"
24 #include "chrome/browser/translate/page_translated_details.h" 24 #include "chrome/browser/translate/page_translated_details.h"
25 #include "chrome/browser/translate/translate_infobar_delegate.h" 25 #include "chrome/browser/translate/translate_infobar_delegate.h"
26 #include "chrome/browser/translate/translate_prefs.h" 26 #include "chrome/browser/translate/translate_prefs.h"
27 #include "chrome/browser/translate/translate_tab_helper.h" 27 #include "chrome/browser/translate/translate_tab_helper.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_tabstrip.h"
30 #include "chrome/browser/ui/tab_contents/tab_contents.h" 31 #include "chrome/browser/ui/tab_contents/tab_contents.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chrome/common/render_messages.h" 36 #include "chrome/common/render_messages.h"
36 #include "chrome/common/translate_errors.h" 37 #include "chrome/common/translate_errors.h"
37 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
38 #include "content/public/browser/navigation_controller.h" 39 #include "content/public/browser/navigation_controller.h"
39 #include "content/public/browser/navigation_details.h" 40 #include "content/public/browser/navigation_details.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 report_error_url += helper->language_state().original_language(); 673 report_error_url += helper->language_state().original_language();
673 report_error_url += "&hl="; 674 report_error_url += "&hl=";
674 report_error_url += 675 report_error_url +=
675 GetLanguageCode(g_browser_process->GetApplicationLocale()); 676 GetLanguageCode(g_browser_process->GetApplicationLocale());
676 // Open that URL in a new tab so that the user can tell us more. 677 // Open that URL in a new tab so that the user can tell us more.
677 Browser* browser = browser::FindBrowserWithWebContents(web_contents); 678 Browser* browser = browser::FindBrowserWithWebContents(web_contents);
678 if (!browser) { 679 if (!browser) {
679 NOTREACHED(); 680 NOTREACHED();
680 return; 681 return;
681 } 682 }
682 browser->AddSelectedTabWithURL(GURL(report_error_url), 683 chrome::AddSelectedTabWithURL(browser, GURL(report_error_url),
683 content::PAGE_TRANSITION_AUTO_BOOKMARK); 684 content::PAGE_TRANSITION_AUTO_BOOKMARK);
684 } 685 }
685 686
686 void TranslateManager::DoTranslatePage(WebContents* web_contents, 687 void TranslateManager::DoTranslatePage(WebContents* web_contents,
687 const std::string& translate_script, 688 const std::string& translate_script,
688 const std::string& source_lang, 689 const std::string& source_lang,
689 const std::string& target_lang) { 690 const std::string& target_lang) {
690 NavigationEntry* entry = web_contents->GetController().GetActiveEntry(); 691 NavigationEntry* entry = web_contents->GetController().GetActiveEntry();
691 if (!entry) { 692 if (!entry) {
692 NOTREACHED(); 693 NOTREACHED();
693 return; 694 return;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 896 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
896 897
897 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 898 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
898 TranslateInfoBarDelegate* delegate = 899 TranslateInfoBarDelegate* delegate =
899 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 900 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
900 if (delegate) 901 if (delegate)
901 return delegate; 902 return delegate;
902 } 903 }
903 return NULL; 904 return NULL;
904 } 905 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698