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/language_state.h" | 26 #include "components/translate/core/browser/language_state.h" |
26 #include "components/translate/core/browser/page_translated_details.h" | 27 #include "components/translate/core/browser/page_translated_details.h" |
27 #include "components/translate/core/browser/translate_accept_languages.h" | 28 #include "components/translate/core/browser/translate_accept_languages.h" |
28 #include "components/translate/core/browser/translate_download_manager.h" | 29 #include "components/translate/core/browser/translate_download_manager.h" |
29 #include "components/translate/core/browser/translate_infobar_delegate.h" | 30 #include "components/translate/core/browser/translate_infobar_delegate.h" |
30 #include "components/translate/core/browser/translate_manager.h" | 31 #include "components/translate/core/browser/translate_manager.h" |
31 #include "components/translate/core/browser/translate_prefs.h" | 32 #include "components/translate/core/browser/translate_prefs.h" |
32 #include "components/translate/core/common/language_detection_details.h" | 33 #include "components/translate/core/common/language_detection_details.h" |
33 #include "content/public/browser/navigation_details.h" | 34 #include "content/public/browser/navigation_details.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 TranslateAcceptLanguages* ChromeTranslateClient::GetTranslateAcceptLanguages() { | 214 TranslateAcceptLanguages* ChromeTranslateClient::GetTranslateAcceptLanguages() { |
214 DCHECK(web_contents()); | 215 DCHECK(web_contents()); |
215 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext()); | 216 return GetTranslateAcceptLanguages(web_contents()->GetBrowserContext()); |
216 } | 217 } |
217 | 218 |
218 int ChromeTranslateClient::GetInfobarIconID() const { | 219 int ChromeTranslateClient::GetInfobarIconID() const { |
219 return IDR_INFOBAR_TRANSLATE; | 220 return IDR_INFOBAR_TRANSLATE; |
220 } | 221 } |
221 | 222 |
222 // ChromeTranslateClient::CreateInfoBar() is implemented in platform-specific | 223 // ChromeTranslateClient::CreateInfoBar() is implemented in platform-specific |
223 // files. | 224 // files, except the TOOLKIT_VIEWS implementation, which has been removed. |
| 225 #if defined(TOOLKIT_VIEWS) |
| 226 scoped_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( |
| 227 scoped_ptr<TranslateInfoBarDelegate> delegate) const { |
| 228 return scoped_ptr<infobars::InfoBar>(); |
| 229 } |
| 230 #endif |
224 | 231 |
225 bool ChromeTranslateClient::IsTranslatableURL(const GURL& url) { | 232 bool ChromeTranslateClient::IsTranslatableURL(const GURL& url) { |
226 return TranslateService::IsTranslatableURL(url); | 233 return TranslateService::IsTranslatableURL(url); |
227 } | 234 } |
228 | 235 |
229 void ChromeTranslateClient::ShowReportLanguageDetectionErrorUI( | 236 void ChromeTranslateClient::ShowReportLanguageDetectionErrorUI( |
230 const GURL& report_url) { | 237 const GURL& report_url) { |
231 #if defined(OS_ANDROID) | 238 #if defined(OS_ANDROID) |
232 // Android does not support reporting language detection errors. | 239 // Android does not support reporting language detection errors. |
233 NOTREACHED(); | 240 NOTREACHED(); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 if (GetLanguageState().InTranslateNavigation()) | 558 if (GetLanguageState().InTranslateNavigation()) |
552 return; | 559 return; |
553 } | 560 } |
554 | 561 |
555 TranslateBubbleFactory::Show( | 562 TranslateBubbleFactory::Show( |
556 browser->window(), web_contents(), step, error_type); | 563 browser->window(), web_contents(), step, error_type); |
557 #else | 564 #else |
558 NOTREACHED(); | 565 NOTREACHED(); |
559 #endif | 566 #endif |
560 } | 567 } |
OLD | NEW |