Commit 7c5123dc authored by Orin Jaworski's avatar Orin Jaworski Committed by Commit Bot

[omnibox] Fix translate pedal to use simplest most direct techinque

This CL fixes the translate Pedal behavior by relying on the translate
manager to determine appropriate page translation, languages, etc.,
instead of driving the UI directly with info from client and language
state. The new behavior is described in the translate manager comment:

Initiate a manually triggered translation process for the current page.
Collect source and target languages, and show translation UI. If
|auto_translate| is true the page gets translated to the target language

Bug: 1117542
Change-Id: I270d29f966646bbf4508c4e041383bcb47e5ed26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363907
Commit-Queue: Orin Jaworski <orinj@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Auto-Submit: Orin Jaworski <orinj@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799380}
parent 0e8eb9b5
...@@ -400,13 +400,8 @@ void ChromeOmniboxClient::PromptPageTranslation() { ...@@ -400,13 +400,8 @@ void ChromeOmniboxClient::PromptPageTranslation() {
ChromeTranslateClient* translate_client = ChromeTranslateClient* translate_client =
ChromeTranslateClient::FromWebContents(contents); ChromeTranslateClient::FromWebContents(contents);
if (translate_client) { if (translate_client) {
translate::LanguageState& state = translate_client->GetLanguageState(); DCHECK_NE(nullptr, translate_client->GetTranslateManager());
// Here we pass triggered_from_menu as true because that is meant to translate_client->GetTranslateManager()->InitiateManualTranslation(true);
// capture whether the user explicitly requested the translation.
translate_client->ShowTranslateUI(
translate::TRANSLATE_STEP_TRANSLATING, state.original_language(),
state.AutoTranslateTo(), translate::TranslateErrors::NONE,
/*triggered_from_menu=*/true);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment