Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3201)

Unified Diff: chrome/browser/ui/views/translate/translate_bubble_view.cc

Issue 1923143003: Implement the 2016Q2 Translate UI designe spec out in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix namespace in .h and other minor review comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/translate/translate_bubble_view.cc
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.cc b/chrome/browser/ui/views/translate/translate_bubble_view.cc
index 13af4c444318e67b7c02cb8b4ac6f0d87334990d..aa38087300c24bee98777c285b482503183e3b3b 100644
--- a/chrome/browser/ui/views/translate/translate_bubble_view.cc
+++ b/chrome/browser/ui/views/translate/translate_bubble_view.cc
@@ -20,22 +20,29 @@
#include "chrome/browser/translate/translate_service.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
+#include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_manager.h"
+#include "components/translate/core/browser/translate_prefs.h"
#include "components/translate/core/browser/translate_ui_delegate.h"
#include "content/public/browser/web_contents.h"
#include "grit/components_strings.h"
+#include "grit/ui_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/combobox_model.h"
#include "ui/base/models/simple_combobox_model.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/views/bubble/bubble_frame_view.h"
+#include "ui/views/controls/button/blue_button.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
+#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_constants.h"
@@ -43,6 +50,17 @@
namespace {
+const int kQuestionWidth = 200;
msw 2016/04/29 20:00:00 nit: move to usage in CreateViewBeforeTranslate.
ftang 2016/04/29 22:37:00 Done.
+const char kTranslateBubbleUIEvent[] = "Translate.BubbleUiEvent";
+
+views::LabelButton* CreateBlueButton(views::ButtonListener* listener,
+ const base::string16& label,
msw 2016/04/29 20:00:01 nit: fix indent, ditto below. Use 'git cl format'
ftang 2016/04/29 22:37:01 Done.
+ int id) {
+ views::LabelButton* button = new views::BlueButton(listener, label);
+ button->set_id(id);
+ return button;
+}
+
views::LabelButton* CreateLabelButton(views::ButtonListener* listener,
const base::string16& label,
int id) {
@@ -53,14 +71,28 @@ views::LabelButton* CreateLabelButton(views::ButtonListener* listener,
}
views::Link* CreateLink(views::LinkListener* listener,
- int resource_id,
+ base::string16 text,
msw 2016/04/29 20:00:01 const ref
ftang 2016/04/29 22:37:02 Done.
int id) {
- views::Link* link = new views::Link(
- l10n_util::GetStringUTF16(resource_id));
+ views::Link* link = new views::Link(text);
link->set_listener(listener);
link->set_id(id);
return link;
}
+views::Link* CreateLink(views::LinkListener* listener,
msw 2016/04/29 20:00:00 nit: add a blank line above
ftang 2016/04/29 22:37:00 Done.
+ int resource_id,
+ int id) {
+ return CreateLink(listener,
msw 2016/04/29 20:00:01 This all fits on one line...
ftang 2016/04/29 22:37:01 Done.
+ l10n_util::GetStringUTF16(resource_id),
+ id);
+}
+
+void AddIconToLayout(views::GridLayout* layout) {
+ views::ImageView* icon = new views::ImageView();
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ icon->SetImage(
msw 2016/04/29 20:00:01 This all fits on one line...
ftang 2016/04/29 22:37:01 Done.
+ bundle.GetImageNamed(IDR_TRANSLATE_ICON_V2).ToImageSkia());
+ layout->AddView(icon);
+}
} // namespace
@@ -160,11 +192,28 @@ void TranslateBubbleView::Init() {
model_->ShowError(error_type_);
}
+void TranslateBubbleView::ReportUiAction(int action) {
msw 2016/04/29 20:00:01 Order the definition to match the declaration.
ftang 2016/04/29 22:37:01 Done.
+ UMA_HISTOGRAM_ENUMERATION(kTranslateBubbleUIEvent,
+ action,
+ translate::TRANSLATE_BUBBLE_UI_EVENT_MAX);
msw 2016/04/29 20:00:02 nit: fits on line above; 'git cl format'
ftang 2016/04/29 22:37:00 Done.
+}
+
+bool TranslateBubbleView::ShouldShowCloseButton() const {
msw 2016/04/29 20:00:01 Order the definition to match the declaration.
ftang 2016/04/29 22:37:01 Done.
+ return use_2016_q2_ui_;
+}
+
void TranslateBubbleView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
HandleButtonPressed(static_cast<ButtonID>(sender->id()));
}
+void TranslateBubbleView::OnWidgetClosing(views::Widget* widget) {
msw 2016/04/29 20:00:01 Order the definition to match the declaration.
ftang 2016/04/29 22:37:01 Done.
+ if (GetBubbleFrameView()->close_button_clicked()) {
+ model_->DeclineTranslation();
+ ReportUiAction(translate::CLOSE_BUTTON_CLICKED);
+ }
+}
+
void TranslateBubbleView::WindowClosing() {
// The operations for |model_| are valid only when a WebContents is alive.
// TODO(hajimehoshi): TranslateBubbleViewModel(Impl) should not hold a
@@ -232,6 +281,13 @@ void TranslateBubbleView::LinkClicked(views::Link* source, int event_flags) {
HandleLinkClicked(static_cast<LinkID>(source->id()));
}
+void TranslateBubbleView::StyledLabelLinkClicked(views::StyledLabel* label,
+ const gfx::Range& range,
+ int event_flags) {
+ SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED);
+ ReportUiAction(translate::ADVANCED_LINK_CLICKED);
+}
+
void TranslateBubbleView::WebContentsDestroyed() {
GetWidget()->CloseNow();
}
@@ -261,7 +317,9 @@ TranslateBubbleView::TranslateBubbleView(
model_(std::move(model)),
error_type_(error_type),
is_in_incognito_window_(
- web_contents && web_contents->GetBrowserContext()->IsOffTheRecord()) {
+ web_contents && web_contents->GetBrowserContext()->IsOffTheRecord()),
+ use_2016_q2_ui_(base::FeatureList::IsEnabled(
+ translate::kTranslateUI2016Q2)) {
translate_bubble_view_ = this;
}
@@ -287,6 +345,7 @@ void TranslateBubbleView::HandleButtonPressed(
switch (sender_id) {
case BUTTON_ID_TRANSLATE: {
model_->Translate();
+ ReportUiAction(translate::TRANSLATE_BUTTON_CLICKED);
break;
}
case BUTTON_ID_DONE: {
@@ -300,26 +359,33 @@ void TranslateBubbleView::HandleButtonPressed(
model_->Translate();
SwitchView(TranslateBubbleModel::VIEW_STATE_TRANSLATING);
}
+ ReportUiAction(translate::DONE_BUTTON_CLICKED);
break;
}
case BUTTON_ID_CANCEL: {
model_->GoBackFromAdvanced();
UpdateChildVisibilities();
SizeToContents();
+ ReportUiAction(translate::CANCEL_BUTTON_CLICKED);
break;
}
case BUTTON_ID_TRY_AGAIN: {
model_->Translate();
+ ReportUiAction(translate::TRY_AGAIN_BUTTON_CLICKED);
break;
}
case BUTTON_ID_SHOW_ORIGINAL: {
model_->RevertTranslation();
GetWidget()->Close();
+ ReportUiAction(translate::SHOW_ORIGINAL_BUTTON_CLICKED);
break;
}
case BUTTON_ID_ALWAYS_TRANSLATE: {
// Do nothing. The state of the checkbox affects only when the 'Done'
// button is pressed.
+ ReportUiAction((always_translate_checkbox_->checked() ?
+ translate::ALWAYS_TRANSLATE_CHECKED :
msw 2016/04/29 20:00:00 Is this stat useful? It also counts users checking
ftang 2016/04/29 22:37:01 that is exactly what the UI designer ask me to tra
msw 2016/04/29 23:43:39 Acknowledged.
+ translate::ALWAYS_TRANSLATE_UNCHECKED));
break;
}
}
@@ -330,6 +396,7 @@ void TranslateBubbleView::HandleLinkClicked(
switch (sender_id) {
case LINK_ID_ADVANCED: {
SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED);
+ ReportUiAction(translate::ADVANCED_LINK_CLICKED);
break;
}
case LINK_ID_LANGUAGE_SETTINGS: {
@@ -340,6 +407,7 @@ void TranslateBubbleView::HandleLinkClicked(
NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK,
false));
+ ReportUiAction(translate::SETTING_LINK_CLICKED);
break;
}
}
@@ -349,17 +417,24 @@ void TranslateBubbleView::HandleComboboxPerformAction(
TranslateBubbleView::ComboboxID sender_id) {
switch (sender_id) {
case COMBOBOX_ID_DENIAL: {
+ DenialComboboxIndex index = static_cast<DenialComboboxIndex>(
+ denial_combobox_->selected_index());
+ if (use_2016_q2_ui_ && index == DenialComboboxIndex::DONT_TRANSLATE) {
+ // Do noop on 2016q2 UI.
msw 2016/04/29 20:00:01 "Do nothing"... move comment above the conditional
ftang 2016/04/29 22:37:01 Done.
+ return;
+ }
model_->DeclineTranslation();
- DenialComboboxIndex index =
- static_cast<DenialComboboxIndex>(denial_combobox_->selected_index());
switch (index) {
case DenialComboboxIndex::DONT_TRANSLATE:
+ ReportUiAction(translate::NOPE_MENU_CLICKED);
break;
case DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE:
model_->SetNeverTranslateLanguage(true);
+ ReportUiAction(translate::NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED);
break;
case DenialComboboxIndex::NEVER_TRANSLATE_SITE:
model_->SetNeverTranslateSite(true);
+ ReportUiAction(translate::NEVER_TRANSLATE_SITE_MENU_CLICKED);
break;
default:
NOTREACHED();
@@ -376,6 +451,7 @@ void TranslateBubbleView::HandleComboboxPerformAction(
model_->UpdateOriginalLanguageIndex(
source_language_combobox_->selected_index());
UpdateAdvancedView();
+ ReportUiAction(translate::SOURCE_LANGUAGE_MENU_CLICKED);
break;
}
case COMBOBOX_ID_TARGET_LANGUAGE: {
@@ -386,6 +462,7 @@ void TranslateBubbleView::HandleComboboxPerformAction(
model_->UpdateTargetLanguageIndex(
target_language_combobox_->selected_index());
UpdateAdvancedView();
+ ReportUiAction(translate::TARGET_LANGUAGE_MENU_CLICKED);
break;
}
}
@@ -399,28 +476,42 @@ void TranslateBubbleView::UpdateChildVisibilities() {
}
views::View* TranslateBubbleView::CreateViewBeforeTranslate() {
- views::Label* message_label = new views::Label(
- l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE));
-
base::string16 original_language_name =
model_->GetLanguageNameAt(model_->GetOriginalLanguageIndex());
std::vector<base::string16> items(
static_cast<size_t>(DenialComboboxIndex::MENU_SIZE));
- items[static_cast<size_t>(DenialComboboxIndex::DONT_TRANSLATE)] =
- l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY);
+ if (use_2016_q2_ui_) {
+ items[static_cast<size_t>(DenialComboboxIndex::DONT_TRANSLATE)] =
msw 2016/04/29 20:00:02 nit: items[static_cast<size_t>(DenialComboboxIndex
ftang 2016/04/29 22:37:01 Done.
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ADVANCED);
msw 2016/04/29 20:00:01 Using advanced for don't translate is a bit odd...
ftang 2016/04/29 22:37:00 Done.
+ } else {
+ items[static_cast<size_t>(DenialComboboxIndex::DONT_TRANSLATE)] =
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY);
+ }
items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE)] =
l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG,
original_language_name);
items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_SITE)] =
l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE);
+
msw 2016/04/29 20:00:00 remove
ftang 2016/04/29 22:37:00 Done.
denial_combobox_model_.reset(new ui::SimpleComboboxModel(items));
denial_combobox_ = new views::Combobox(denial_combobox_model_.get());
+
msw 2016/04/29 20:00:01 remove
ftang 2016/04/29 22:37:00 Done.
denial_combobox_->set_id(COMBOBOX_ID_DENIAL);
denial_combobox_->set_listener(this);
denial_combobox_->SetStyle(views::Combobox::STYLE_ACTION);
+ // In an incognito window, "Always translate" checkbox shouldn't be shown.
msw 2016/04/29 20:00:01 nit: , the "Alwa...
ftang 2016/04/29 22:37:01 Done.
+ if (use_2016_q2_ui_ && !is_in_incognito_window_) {
msw 2016/04/29 20:00:01 Merge this block into the one below where you actu
+ always_translate_checkbox_ = new views::Checkbox(base::string16());
msw 2016/04/29 20:00:01 Pass l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBL
ftang 2016/04/29 22:37:01 Done.
+ always_translate_checkbox_->SetChecked(model_->GetAlwaysTranslateChecked());
+ always_translate_checkbox_->set_id(BUTTON_ID_ALWAYS_TRANSLATE);
+ always_translate_checkbox_->SetText(
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS));
+ always_translate_checkbox_->set_listener(this);
+ }
+
views::View* view = new views::View();
views::GridLayout* layout = new views::GridLayout(view);
view->SetLayoutManager(layout);
@@ -433,9 +524,15 @@ views::View* TranslateBubbleView::CreateViewBeforeTranslate() {
};
views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
- cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
- 0, GridLayout::USE_PREF, 0, 0);
- cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ if (use_2016_q2_ui_) {
msw 2016/04/29 20:00:00 Revert this change; if and else do the same thing.
ftang 2016/04/29 22:37:01 Done.
+ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
+ 0, GridLayout::USE_PREF, 0, 0);
+ cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ } else {
+ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
+ 0, GridLayout::USE_PREF, 0, 0);
+ cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ }
cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
0, GridLayout::USE_PREF, 0, 0);
cs->AddPaddingColumn(1, 0);
@@ -449,18 +546,63 @@ views::View* TranslateBubbleView::CreateViewBeforeTranslate() {
0, GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
- layout->AddView(message_label);
- layout->AddView(CreateLink(this,
- IDS_TRANSLATE_BUBBLE_ADVANCED,
- LINK_ID_ADVANCED));
+ if (use_2016_q2_ui_) {
+ AddIconToLayout(layout);
+
+ base::string16 target_language_name =
+ model_->GetLanguageNameAt(model_->GetTargetLanguageIndex());
+ std::vector<size_t> offsets;
+ auto styled_label = new views::StyledLabel(
+ l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE2,
+ original_language_name,
+ target_language_name,
+ &offsets),
+ this);
+ auto style_info = views::StyledLabel::RangeStyleInfo::CreateForLink();
+ styled_label->AddStyleRange(
+ gfx::Range(static_cast<uint32_t>(offsets[0]),
+ static_cast<uint32_t>(offsets[0] +
+ original_language_name.length())),
+ style_info);
+ styled_label->AddStyleRange(
+ gfx::Range(static_cast<uint32_t>(offsets[1]),
+ static_cast<uint32_t>(offsets[1] +
+ target_language_name.length())),
+ style_info);
+ styled_label->SetBounds(styled_label->x(),
msw 2016/04/29 20:00:00 Use Label::SizeToFit(kQuestionWidth) or at least u
ftang 2016/04/29 22:37:01 Done.
+ styled_label->y(),
+ kQuestionWidth,
+ styled_label->GetHeightForWidth(kQuestionWidth));
+
+ layout->AddView(styled_label);
+ } else {
+ auto message_label = new views::Label(
msw 2016/04/29 20:00:01 inline this in the AddView call below, |message_la
ftang 2016/04/29 22:37:01 Done.
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE));
+ layout->AddView(message_label);
+ auto link = CreateLink(this,
msw 2016/04/29 20:00:00 ditto: inline this in the AddView call below.
ftang 2016/04/29 22:37:01 Done.
+ IDS_TRANSLATE_BUBBLE_ADVANCED,
+ LINK_ID_ADVANCED);
+ layout->AddView(link);
+ }
msw 2016/04/29 20:00:01 remove extra blank line... self-review
+
+ if (use_2016_q2_ui_ && !is_in_incognito_window_) {
+ layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
+ layout->SkipColumns(1);
+ layout->AddView(always_translate_checkbox_);
+ }
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
layout->StartRow(0, COLUMN_SET_ID_CONTENT);
- views::LabelButton* accept_button = CreateLabelButton(
- this,
- l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT),
- BUTTON_ID_TRANSLATE);
+ views::LabelButton* accept_button = use_2016_q2_ui_ ?
+ CreateBlueButton(
+ this,
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT),
+ BUTTON_ID_TRANSLATE) :
+ CreateLabelButton(
+ this,
+ l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT),
+ BUTTON_ID_TRANSLATE);
layout->AddView(accept_button);
accept_button->SetIsDefault(true);
layout->AddView(denial_combobox_);
@@ -486,8 +628,13 @@ views::View* TranslateBubbleView::CreateViewTranslating() {
};
views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
+ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
+ 0, views::GridLayout::USE_PREF, 0, 0);
msw 2016/04/29 20:00:00 nit: remove views:: here (and elsewhere applicable
+ cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ }
cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
- 0, views::GridLayout::USE_PREF, 0, 0);
+ 0, GridLayout::USE_PREF, 0, 0);
cs->AddPaddingColumn(1, 0);
cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
@@ -496,6 +643,9 @@ views::View* TranslateBubbleView::CreateViewTranslating() {
0, GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
msw 2016/04/29 20:00:01 nit: remove curlies
ftang 2016/04/29 22:37:01 Done.
+ AddIconToLayout(layout);
+ }
layout->AddView(label);
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
@@ -527,11 +677,16 @@ views::View* TranslateBubbleView::CreateViewAfterTranslate() {
};
views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
+ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
+ 0, views::GridLayout::USE_PREF, 0, 0);
msw 2016/04/29 20:00:00 ditto: remove views:: here (and elsewhere applicab
ftang 2016/04/29 22:37:02 Done.
+ cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ }
cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
0, views::GridLayout::USE_PREF, 0, 0);
cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
- 0, views::GridLayout::USE_PREF, 0, 0);
+ 0, GridLayout::USE_PREF, 0, 0);
cs->AddPaddingColumn(1, 0);
cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
@@ -540,6 +695,9 @@ views::View* TranslateBubbleView::CreateViewAfterTranslate() {
0, GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
msw 2016/04/29 20:00:01 ditto: remove curlies.
ftang 2016/04/29 22:37:01 Done.
+ AddIconToLayout(layout);
+ }
layout->AddView(label);
layout->AddView(CreateLink(this,
IDS_TRANSLATE_BUBBLE_ADVANCED,
@@ -572,6 +730,11 @@ views::View* TranslateBubbleView::CreateViewError() {
};
views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
+ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
+ 0, GridLayout::USE_PREF, 0, 0);
+ cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ }
cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
0, GridLayout::USE_PREF, 0, 0);
cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
@@ -585,6 +748,9 @@ views::View* TranslateBubbleView::CreateViewError() {
0, GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
+ if (use_2016_q2_ui_) {
msw 2016/04/29 20:00:01 ditto: remove curlies.
ftang 2016/04/29 22:37:01 Done.
+ AddIconToLayout(layout);
+ }
layout->AddView(label);
layout->AddView(CreateLink(this,
IDS_TRANSLATE_BUBBLE_ADVANCED,
@@ -687,8 +853,11 @@ views::View* TranslateBubbleView::CreateViewAdvanced() {
layout->AddView(CreateLink(this,
IDS_TRANSLATE_BUBBLE_LANGUAGE_SETTINGS,
LINK_ID_LANGUAGE_SETTINGS));
- advanced_done_button_ = CreateLabelButton(
- this, l10n_util::GetStringUTF16(IDS_DONE), BUTTON_ID_DONE);
+ advanced_done_button_ = use_2016_q2_ui_ ?
+ CreateBlueButton(
+ this, l10n_util::GetStringUTF16(IDS_DONE), BUTTON_ID_DONE) :
+ CreateLabelButton(
+ this, l10n_util::GetStringUTF16(IDS_DONE), BUTTON_ID_DONE);
advanced_done_button_->SetIsDefault(true);
advanced_cancel_button_ = CreateLabelButton(
this, l10n_util::GetStringUTF16(IDS_CANCEL), BUTTON_ID_CANCEL);
@@ -734,6 +903,8 @@ void TranslateBubbleView::UpdateAdvancedView() {
always_translate_checkbox_->SetText(
l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS));
always_translate_checkbox_->SetChecked(
+ use_2016_q2_ui_ ?
msw 2016/04/29 20:00:01 git cl format
+ model_->GetAlwaysTranslateChecked() :
model_->ShouldAlwaysTranslate());
}

Powered by Google App Engine
This is Rietveld 408576698