OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_translate_client.h" | 5 #include "chrome/browser/translate/chrome_translate_client.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_service.h" | 16 #include "chrome/browser/translate/translate_service.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/browser/ui/translate/translate_bubble_factory.h" | 22 #include "chrome/browser/ui/translate/translate_bubble_factory.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "components/infobars/core/infobar.h" |
24 #include "components/translate/content/common/translate_messages.h" | 25 #include "components/translate/content/common/translate_messages.h" |
25 #include "components/translate/core/browser/page_translated_details.h" | 26 #include "components/translate/core/browser/page_translated_details.h" |
26 #include "components/translate/core/browser/translate_accept_languages.h" | 27 #include "components/translate/core/browser/translate_accept_languages.h" |
27 #include "components/translate/core/browser/translate_download_manager.h" | 28 #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_infobar_delegate.h" |
29 #include "components/translate/core/browser/translate_manager.h" | 30 #include "components/translate/core/browser/translate_manager.h" |
30 #include "components/translate/core/browser/translate_prefs.h" | 31 #include "components/translate/core/browser/translate_prefs.h" |
31 #include "components/translate/core/common/language_detection_details.h" | 32 #include "components/translate/core/common/language_detection_details.h" |
32 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
33 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 TranslateAcceptLanguages* ChromeTranslateClient::GetTranslateAcceptLanguages() { | 212 TranslateAcceptLanguages* ChromeTranslateClient::GetTranslateAcceptLanguages() { |
212 DCHECK(web_contents()); | 213 DCHECK(web_contents()); |
213 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext()); | 214 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext()); |
214 } | 215 } |
215 | 216 |
216 int ChromeTranslateClient::GetInfobarIconID() const { | 217 int ChromeTranslateClient::GetInfobarIconID() const { |
217 return IDR_INFOBAR_TRANSLATE; | 218 return IDR_INFOBAR_TRANSLATE; |
218 } | 219 } |
219 | 220 |
220 // ChromeTranslateClient::CreateInfoBar() is implemented in platform-specific | 221 // ChromeTranslateClient::CreateInfoBar() is implemented in platform-specific |
221 // files. | 222 // files, except the TOOLKIT_VIEWS implementation, which has been removed. |
| 223 #if defined(TOOLKIT_VIEWS) |
| 224 scoped_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( |
| 225 scoped_ptr<TranslateInfoBarDelegate> delegate) const { |
| 226 return scoped_ptr<infobars::InfoBar>(); |
| 227 } |
| 228 #endif |
222 | 229 |
223 bool ChromeTranslateClient::IsTranslatableURL(const GURL& url) { | 230 bool ChromeTranslateClient::IsTranslatableURL(const GURL& url) { |
224 return TranslateService::IsTranslatableURL(url); | 231 return TranslateService::IsTranslatableURL(url); |
225 } | 232 } |
226 | 233 |
227 void ChromeTranslateClient::ShowReportLanguageDetectionErrorUI( | 234 void ChromeTranslateClient::ShowReportLanguageDetectionErrorUI( |
228 const GURL& report_url) { | 235 const GURL& report_url) { |
229 #if defined(OS_ANDROID) | 236 #if defined(OS_ANDROID) |
230 // Android does not support reporting language detection errors. | 237 // Android does not support reporting language detection errors. |
231 NOTREACHED(); | 238 NOTREACHED(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 if (GetLanguageState().InTranslateNavigation()) | 552 if (GetLanguageState().InTranslateNavigation()) |
546 return; | 553 return; |
547 } | 554 } |
548 | 555 |
549 TranslateBubbleFactory::Show( | 556 TranslateBubbleFactory::Show( |
550 browser->window(), web_contents(), step, error_type); | 557 browser->window(), web_contents(), step, error_type); |
551 #else | 558 #else |
552 NOTREACHED(); | 559 NOTREACHED(); |
553 #endif | 560 #endif |
554 } | 561 } |
OLD | NEW |