Skip to content
Permalink
Browse files

Reland "Add Field Trial Config for translate UI refresh"

This reverts commit 544877a.

This patch changes the way the double translation issue that was happening during auto-translate is fixed. Instead of reordering calls in TranslateManager and checking if a translation is already in progress, this stops the bubble from observing actions in the UI when they are triggered programatically. As a result, the fix is more self-contained and shouldn't affect iOS tests anymore.

Original change's description:
> Revert "Add Field Trial Config for translate UI refresh"
>
> This reverts commit 24ddb48.
>
> Reason for revert: broke ios full_configs bot:
> https://ci.chromium.org/p/chromium/builders/ci/ios-simulator-full-configs/18443
> https://ci.chromium.org/p/chromium/builders/ci/ios-simulator-full-configs/18444
>
> Original change's description:
> > Add Field Trial Config for translate UI refresh
> >
> > Bug: 976352
> > Change-Id: I9e125f2a7d2dfe24691e8097623cbc65866fe353
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796002
> > Reviewed-by: Alexandre Frechette <frechette@chromium.org>
> > Reviewed-by: Jesse Doherty <jwd@chromium.org>
> > Commit-Queue: anthonyvd <anthonyvd@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#695796}
>
> TBR=jwd@chromium.org,anthonyvd@chromium.org,frechette@chromium.org
>
> Change-Id: I5f43ca5c2d623815d45b171efd91b9e70342c38a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 976352
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1799628
> Reviewed-by: Justin Cohen <justincohen@chromium.org>
> Commit-Queue: Justin Cohen <justincohen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#695895}

TBR=jwd@chromium.org,justincohen@chromium.org,anthonyvd@chromium.org,frechette@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

(cherry picked from commit 0fec1f3)

Bug: 976352
Change-Id: Ia458f36227792dd87b2a0624cae79ab81c0e1c3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829572
Reviewed-by: Alexandre Frechette <frechette@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: anthonyvd <anthonyvd@chromium.org>
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#701299}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841948
Cr-Commit-Position: refs/branch-heads/3904@{#627}
Cr-Branched-From: 675968a-refs/heads/master@{#693954}
  • Loading branch information
Anthony Vallee-Dubois
Anthony Vallee-Dubois committed Oct 4, 2019
1 parent f425c24 commit f69cbad4fcaf3238f0277a70b3c72ddb056c48bb
@@ -46,6 +46,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
@@ -939,6 +940,8 @@ std::unique_ptr<views::View> TranslateBubbleView::CreateViewTab() {
tab_translate_options_button->SetInkDropMode(views::Button::InkDropMode::ON);
tab_translate_options_button->SetID(BUTTON_ID_OPTIONS_MENU_TAB);
tab_translate_options_button->SetFocusForPlatform();
tab_translate_options_button->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_OPTIONS_MENU_BUTTON));
tab_translate_options_button->set_request_focus_on_press(true);

// Close button
@@ -957,6 +960,7 @@ std::unique_ptr<views::View> TranslateBubbleView::CreateViewTab() {
close_button->set_ink_drop_base_color(gfx::kChromeIconGrey);
close_button->SetFocusForPlatform();
close_button->SetID(BUTTON_ID_CLOSE);
close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE));

constexpr int kColumnSetId = 0;
views::ColumnSet* cs = layout->AddColumnSet(kColumnSetId);
@@ -1047,6 +1051,7 @@ std::unique_ptr<views::View> TranslateBubbleView::GM2CreateView(
gfx::CreateVectorIcon(*close_icon_id, 16, close_icon_color));
close_button->set_ink_drop_base_color(gfx::kChromeIconGrey);
close_button->SetID(BUTTON_ID_CLOSE);
close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE));

// Initialize a columnset
views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_TITLE);
@@ -1615,6 +1620,7 @@ std::unique_ptr<views::View> TranslateBubbleView::CreateViewAdvancedTabUi(
close_button->set_ink_drop_base_color(gfx::kChromeIconGrey);
close_button->SetFocusForPlatform();
close_button->SetID(BUTTON_ID_CLOSE);
close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE));

auto view = std::make_unique<AdvancedViewContainer>();
views::GridLayout* layout =
@@ -1755,7 +1761,13 @@ void TranslateBubbleView::SwitchTabForViewState(
if ((view_state == TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE ||
view_state == TranslateBubbleModel::VIEW_STATE_TRANSLATING) &&
tabbed_pane_->GetSelectedTabIndex() != 1) {
// When switching to "after" or "during" translate view from something other
// than user interaction, |this| needs to unregister from listening to the
// tabbed pane events otherwise it'll trigger an additional translation as
// if the user had clicked the tabs.
tabbed_pane_->set_listener(nullptr);
tabbed_pane_->SelectTabAt(1);
tabbed_pane_->set_listener(this);
} else if (view_state == TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE &&
tabbed_pane_->GetSelectedTabIndex() != 0) {
tabbed_pane_->SelectTabAt(0);
@@ -6036,6 +6036,26 @@
]
}
],
"TranslateDesktopRefresh": [
{
"platforms": [
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "EnabledTab",
"params": {
"translate_ui_bubble_style": "tab"
},
"enable_features": [
"UseButtonTranslateBubbleUI"
]
}
]
}
],
"TranslateRankerModel": [
{
"platforms": [

0 comments on commit f69cbad

Please sign in to comment.
You can’t perform that action at this time.