Commit fb7feffa authored by Orin Jaworski's avatar Orin Jaworski Committed by Commit Bot

[omnibox] Fix translation Pedal not always prompting; simplified!

This CL eliminates the state invalidation that was used to cause
translation prompt to show, as that did not work in all cases.
The translation step is changed so the prompt always shows, which
is much simpler.

Bug: 893183
Change-Id: I5dca3eb30032461fc8824a36c9a80a1a82f84cdc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354660Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Orin Jaworski <orinj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798137}
parent d3a3c085
......@@ -401,15 +401,10 @@ void ChromeOmniboxClient::PromptPageTranslation() {
ChromeTranslateClient::FromWebContents(contents);
if (translate_client) {
translate::LanguageState& state = translate_client->GetLanguageState();
const std::string original_language = state.original_language();
// Since the user is explicitly requesting the translation prompt, here
// we invalidate state that prevents prompt in some other circumstances.
state.SetTranslateEnabled(true);
state.LanguageDetermined("", true);
// Here we pass triggered_from_menu as true because that is meant to
// capture whether the user explicitly requested the translation.
translate_client->ShowTranslateUI(
translate::TRANSLATE_STEP_BEFORE_TRANSLATE, original_language,
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