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

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

Issue 284313008: Move TranslateInfoBarDelegate and OptionsMenuModel to the Translate component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + review comments Created 6 years, 6 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
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/translate/translate_accept_languages_factory.h" 15 #include "chrome/browser/translate/translate_accept_languages_factory.h"
16 #include "chrome/browser/translate/translate_infobar_delegate.h"
17 #include "chrome/browser/translate/translate_service.h" 16 #include "chrome/browser/translate/translate_service.h"
18 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_tabstrip.h" 19 #include "chrome/browser/ui/browser_tabstrip.h"
21 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/browser/ui/translate/translate_bubble_factory.h" 22 #include "chrome/browser/ui/translate/translate_bubble_factory.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "components/translate/content/common/translate_messages.h" 24 #include "components/translate/content/common/translate_messages.h"
26 #include "components/translate/core/browser/page_translated_details.h" 25 #include "components/translate/core/browser/page_translated_details.h"
27 #include "components/translate/core/browser/translate_accept_languages.h" 26 #include "components/translate/core/browser/translate_accept_languages.h"
28 #include "components/translate/core/browser/translate_download_manager.h" 27 #include "components/translate/core/browser/translate_download_manager.h"
28 #include "components/translate/core/browser/translate_infobar_delegate.h"
29 #include "components/translate/core/browser/translate_manager.h" 29 #include "components/translate/core/browser/translate_manager.h"
30 #include "components/translate/core/browser/translate_prefs.h" 30 #include "components/translate/core/browser/translate_prefs.h"
31 #include "components/translate/core/common/language_detection_details.h" 31 #include "components/translate/core/common/language_detection_details.h"
32 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/navigation_entry.h" 33 #include "content/public/browser/navigation_entry.h"
34 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
35 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "grit/theme_resources.h"
37 #include "net/http/http_status_code.h" 38 #include "net/http/http_status_code.h"
38 #include "url/gurl.h" 39 #include "url/gurl.h"
39 40
40 #if defined(CLD2_DYNAMIC_MODE) 41 #if defined(CLD2_DYNAMIC_MODE)
41 #include "base/files/file.h" 42 #include "base/files/file.h"
42 #include "base/path_service.h" 43 #include "base/path_service.h"
43 #include "chrome/common/chrome_constants.h" 44 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/chrome_paths.h" 45 #include "chrome/common/chrome_paths.h"
45 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
46 #include "content/public/browser/render_process_host.h" 47 #include "content/public/browser/render_process_host.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 Profile* profile = 203 Profile* profile =
203 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 204 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
204 return CreateTranslatePrefs(profile->GetPrefs()); 205 return CreateTranslatePrefs(profile->GetPrefs());
205 } 206 }
206 207
207 TranslateAcceptLanguages* TranslateTabHelper::GetTranslateAcceptLanguages() { 208 TranslateAcceptLanguages* TranslateTabHelper::GetTranslateAcceptLanguages() {
208 DCHECK(web_contents()); 209 DCHECK(web_contents());
209 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext()); 210 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext());
210 } 211 }
211 212
213 int TranslateTabHelper::GetInfobarIconID() const {
214 return IDR_INFOBAR_TRANSLATE;
215 }
216
217 // TranslateTabHelper::CreateInfoBar() is implemented in platform-specific
218 // files.
219
212 bool TranslateTabHelper::IsTranslatableURL(const GURL& url) { 220 bool TranslateTabHelper::IsTranslatableURL(const GURL& url) {
213 return TranslateService::IsTranslatableURL(url); 221 return TranslateService::IsTranslatableURL(url);
214 } 222 }
215 223
216 void TranslateTabHelper::ShowReportLanguageDetectionErrorUI( 224 void TranslateTabHelper::ShowReportLanguageDetectionErrorUI(
217 const GURL& report_url) { 225 const GURL& report_url) {
218 #if defined(OS_ANDROID) 226 #if defined(OS_ANDROID)
219 // Android does not support reporting language detection errors. 227 // Android does not support reporting language detection errors.
220 NOTREACHED(); 228 NOTREACHED();
221 #else 229 #else
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (GetLanguageState().InTranslateNavigation()) 541 if (GetLanguageState().InTranslateNavigation())
534 return; 542 return;
535 } 543 }
536 544
537 TranslateBubbleFactory::Show( 545 TranslateBubbleFactory::Show(
538 browser->window(), web_contents(), step, error_type); 546 browser->window(), web_contents(), step, error_type);
539 #else 547 #else
540 NOTREACHED(); 548 NOTREACHED();
541 #endif 549 #endif
542 } 550 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_tab_helper.h ('k') | chrome/browser/ui/android/infobars/infobar_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698