OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 WebContents* web_contents = | 858 WebContents* web_contents = |
859 browser->tab_strip_model()->GetActiveWebContents(); | 859 browser->tab_strip_model()->GetActiveWebContents(); |
860 ChromeTranslateClient* chrome_translate_client = | 860 ChromeTranslateClient* chrome_translate_client = |
861 ChromeTranslateClient::FromWebContents(web_contents); | 861 ChromeTranslateClient::FromWebContents(web_contents); |
862 | 862 |
863 translate::TranslateStep step = translate::TRANSLATE_STEP_BEFORE_TRANSLATE; | 863 translate::TranslateStep step = translate::TRANSLATE_STEP_BEFORE_TRANSLATE; |
864 if (chrome_translate_client) { | 864 if (chrome_translate_client) { |
865 if (chrome_translate_client->GetLanguageState().translation_pending()) | 865 if (chrome_translate_client->GetLanguageState().translation_pending()) |
866 step = translate::TRANSLATE_STEP_TRANSLATING; | 866 step = translate::TRANSLATE_STEP_TRANSLATING; |
| 867 else if (chrome_translate_client->GetLanguageState().translation_error()) |
| 868 step = translate::TRANSLATE_STEP_TRANSLATE_ERROR; |
867 else if (chrome_translate_client->GetLanguageState().IsPageTranslated()) | 869 else if (chrome_translate_client->GetLanguageState().IsPageTranslated()) |
868 step = translate::TRANSLATE_STEP_AFTER_TRANSLATE; | 870 step = translate::TRANSLATE_STEP_AFTER_TRANSLATE; |
869 } | 871 } |
870 ShowTranslateBubbleResult result = browser->window()->ShowTranslateBubble( | 872 ShowTranslateBubbleResult result = browser->window()->ShowTranslateBubble( |
871 web_contents, step, translate::TranslateErrors::NONE, true); | 873 web_contents, step, translate::TranslateErrors::NONE, true); |
872 if (result != ShowTranslateBubbleResult::SUCCESS) | 874 if (result != ShowTranslateBubbleResult::SUCCESS) |
873 translate::ReportUiAction(TranslateBubbleResultToUiEvent(result)); | 875 translate::ReportUiAction(TranslateBubbleResultToUiEvent(result)); |
874 } | 876 } |
875 | 877 |
876 void ManagePasswordsForPage(Browser* browser) { | 878 void ManagePasswordsForPage(Browser* browser) { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 } | 1312 } |
1311 | 1313 |
1312 bool CanCreateBookmarkApp(const Browser* browser) { | 1314 bool CanCreateBookmarkApp(const Browser* browser) { |
1313 return extensions::TabHelper::FromWebContents( | 1315 return extensions::TabHelper::FromWebContents( |
1314 browser->tab_strip_model()->GetActiveWebContents()) | 1316 browser->tab_strip_model()->GetActiveWebContents()) |
1315 ->CanCreateBookmarkApp(); | 1317 ->CanCreateBookmarkApp(); |
1316 } | 1318 } |
1317 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1319 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
1318 | 1320 |
1319 } // namespace chrome | 1321 } // namespace chrome |
OLD | NEW |