Translate New UX: Show bubble when clicking the icon within an automatic translate session

Moved the 'if' clause to check if the translation is performed automatically to TranslateManager. TranslateBubbleView::ShowBubble is called not only from TranslateManager but also when the user clicks the icon explicitly. In the latter case, the translate bubble should be shown whether the automatic translation is done or not.

BUG=330684
TEST=manual

Review URL: https://codereview.chromium.org/124833004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243502 0039d316-1c4b-4281-b951-d872f2087c98
parent d8840694
...@@ -729,6 +729,17 @@ void TranslateManager::ShowBubble(WebContents* web_contents, ...@@ -729,6 +729,17 @@ void TranslateManager::ShowBubble(WebContents* web_contents,
return; return;
} }
// During auto-translating, the bubble should not be shown.
if (view_state == TranslateBubbleModel::VIEW_STATE_TRANSLATING ||
view_state == TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE) {
TranslateTabHelper* translate_tab_helper =
TranslateTabHelper::FromWebContents(web_contents);
if (!translate_tab_helper ||
translate_tab_helper->language_state().InTranslateNavigation()) {
return;
}
}
TranslateBubbleFactory::Show(browser->window(), web_contents, view_state, TranslateBubbleFactory::Show(browser->window(), web_contents, view_state,
error_type); error_type);
#else #else
......
...@@ -139,17 +139,6 @@ void TranslateBubbleView::ShowBubble(views::View* anchor_view, ...@@ -139,17 +139,6 @@ void TranslateBubbleView::ShowBubble(views::View* anchor_view,
content::WebContents* web_contents, content::WebContents* web_contents,
TranslateBubbleModel::ViewState type, TranslateBubbleModel::ViewState type,
TranslateErrors::Type error_type) { TranslateErrors::Type error_type) {
// During auto-translating, the bubble should not be shown.
if (type == TranslateBubbleModel::VIEW_STATE_TRANSLATING ||
type == TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE) {
TranslateTabHelper* translate_tab_helper =
TranslateTabHelper::FromWebContents(web_contents);
if (!translate_tab_helper ||
translate_tab_helper->language_state().InTranslateNavigation()) {
return;
}
}
if (IsShowing()) { if (IsShowing()) {
// When the user reads the advanced setting panel, the bubble should not be // When the user reads the advanced setting panel, the bubble should not be
// changed because he/she is focusing on the bubble. // changed because he/she is focusing on the bubble.
......
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