Commit d2db5f0b authored by Elaine Chien's avatar Elaine Chien Committed by Chromium LUCI CQ

ChromeBeta: Formatting adjustments

Mocks:
https://docs.google.com/presentation/d/1gJEE-qL8XCst4gIQaAXt0fmlxlHIg7HWtcw0l_ISq-s/edit#slide=id.ga480910b3a_0_40

Notes:
- We are changing the name from Chrome Labs to Chrome Beta; "Labs" and
the top area of bubble above experiments will be changed.

- Icons will be added in a later CL.

Bug: 1145666
Change-Id: I344a89efd89aff4f5fd8c782df3e21f6bdb0d419
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616490
Commit-Queue: Elaine Chien <elainechien@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841748}
parent b5ac8cdc
...@@ -1231,6 +1231,11 @@ Chromium is unable to recover your settings. ...@@ -1231,6 +1231,11 @@ Chromium is unable to recover your settings.
Chromium OS can always restore your apps &amp; pages after reboot without asking every time. Chromium OS can always restore your apps &amp; pages after reboot without asking every time.
</message> </message>
</if> </if>
<!-- ChromeBeta bubble -->
<message name="IDS_CHROMEBETA_RELAUNCH_FOOTER_MESSAGE" desc="Text that shows in the footer of the Chrome Beta bubble when relaunch is needed for changes to take effect.">
Your changes will take effect the next time you relaunch Chromium.
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
9fe5fe3f47d4059771289e9db8419e8e86cf26cc
\ No newline at end of file
...@@ -11103,6 +11103,12 @@ Please help our engineers fix this problem. Tell us what happened right before y ...@@ -11103,6 +11103,12 @@ Please help our engineers fix this problem. Tell us what happened right before y
desc="Menu item to launch the Chrome watch feature"> desc="Menu item to launch the Chrome watch feature">
Watch Watch
</message> </message>
<!-- ChromeBeta bubble -->
<message name="IDS_CHROMEBETA_RELAUNCH_BUTTON_LABEL"
desc="Label on the button in the footer of the Chrome Beta bubble which will relaunch the browser.">
Relaunch
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
5d829aaebb289b5e55b0c4e88dc0e5ca9c8549c3
\ No newline at end of file
...@@ -1247,6 +1247,11 @@ Google Chrome is unable to recover your settings. ...@@ -1247,6 +1247,11 @@ Google Chrome is unable to recover your settings.
Chrome OS can always restore your apps &amp; pages after reboot without asking every time. Chrome OS can always restore your apps &amp; pages after reboot without asking every time.
</message> </message>
</if> </if>
<!-- ChromeBeta bubble -->
<message name="IDS_CHROMEBETA_RELAUNCH_FOOTER_MESSAGE" desc="Text that shows in the footer of the Chrome Beta bubble when relaunch is needed for changes to take effect.">
Your changes will take effect the next time you relaunch Google Chrome.
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
9fe5fe3f47d4059771289e9db8419e8e86cf26cc
\ No newline at end of file
...@@ -11,12 +11,15 @@ ...@@ -11,12 +11,15 @@
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/webui/flags/flags_ui.h" #include "chrome/browser/ui/webui/flags/flags_ui.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/google_chrome_strings.h"
#include "components/flags_ui/pref_service_flags_storage.h" #include "components/flags_ui/pref_service_flags_storage.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h"
#include "ui/views/layout/layout_provider.h" #include "ui/views/layout/layout_provider.h"
namespace { namespace {
...@@ -70,24 +73,31 @@ class ChromeLabsFooter : public views::View { ...@@ -70,24 +73,31 @@ class ChromeLabsFooter : public views::View {
public: public:
ChromeLabsFooter() { ChromeLabsFooter() {
SetLayoutManager(std::make_unique<views::FlexLayout>()) SetLayoutManager(std::make_unique<views::FlexLayout>())
->SetOrientation(views::LayoutOrientation::kVertical); ->SetOrientation(views::LayoutOrientation::kVertical)
.SetCrossAxisAlignment(views::LayoutAlignment::kStart);
AddChildView( AddChildView(
views::Builder<views::Label>() views::Builder<views::Label>()
.CopyAddressTo(&restart_label_) .CopyAddressTo(&restart_label_)
.SetText(base::ASCIIToUTF16( .SetText(l10n_util::GetStringUTF16(
"Your changes will take effect the next time you " IDS_CHROMEBETA_RELAUNCH_FOOTER_MESSAGE))
"relaunch Google Chrome."))
.SetMultiLine(true) .SetMultiLine(true)
.SetHorizontalAlignment(gfx::ALIGN_LEFT) .SetHorizontalAlignment(gfx::ALIGN_LEFT)
.SetProperty(views::kFlexBehaviorKey, .SetProperty(views::kFlexBehaviorKey,
views::FlexSpecification( views::FlexSpecification(
views::MinimumFlexSizeRule::kPreferred, views::MinimumFlexSizeRule::kPreferred,
views::MaximumFlexSizeRule::kPreferred, true)) views::MaximumFlexSizeRule::kPreferred, true))
.SetBorder(views::CreateEmptyBorder(
gfx::Insets(0, 0,
views::LayoutProvider::Get()->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_VERTICAL),
0)))
.Build()); .Build());
AddChildView(views::Builder<views::MdTextButton>() AddChildView(views::Builder<views::MdTextButton>()
.CopyAddressTo(&restart_button_) .CopyAddressTo(&restart_button_)
.SetCallback(base::BindRepeating(&chrome::AttemptRestart)) .SetCallback(base::BindRepeating(&chrome::AttemptRestart))
.SetText(base::ASCIIToUTF16("Relaunch")) .SetText(l10n_util::GetStringUTF16(
IDS_CHROMEBETA_RELAUNCH_BUTTON_LABEL))
.SetProminent(true)
.Build()); .Build());
SetBackground(views::CreateThemedSolidBackground( SetBackground(views::CreateThemedSolidBackground(
this, ui::NativeTheme::kColorId_BubbleFooterBackground)); this, ui::NativeTheme::kColorId_BubbleFooterBackground));
...@@ -153,15 +163,16 @@ ChromeLabsBubbleView::ChromeLabsBubbleView( ...@@ -153,15 +163,16 @@ ChromeLabsBubbleView::ChromeLabsBubbleView(
flags_state_ = about_flags::GetCurrentFlagsState(); flags_state_ = about_flags::GetCurrentFlagsState();
menu_item_container_ = AddChildView( menu_item_container_ = AddChildView(
views::Builder<views::View>() views::Builder<views::FlexLayoutView>()
.SetOrientation(views::LayoutOrientation::kVertical)
.SetProperty(views::kFlexBehaviorKey, .SetProperty(views::kFlexBehaviorKey,
views::FlexSpecification( views::FlexSpecification(
views::MinimumFlexSizeRule::kScaleToZero, views::MinimumFlexSizeRule::kScaleToZero,
views::MaximumFlexSizeRule::kPreferred, true)) views::MaximumFlexSizeRule::kPreferred, true))
.SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetInsetsMetric(
views::INSETS_DIALOG)))
.Build()); .Build());
menu_item_container_->SetLayoutManager(std::make_unique<views::FlexLayout>())
->SetOrientation(views::LayoutOrientation::kVertical)
.SetDefault(views::kMarginsKey, gfx::Insets(10));
// Create each lab item. // Create each lab item.
const std::vector<LabInfo>& all_labs = model_->GetLabInfo(); const std::vector<LabInfo>& all_labs = model_->GetLabInfo();
......
...@@ -11,11 +11,9 @@ ...@@ -11,11 +11,9 @@
#include "components/flags_ui/flags_state.h" #include "components/flags_ui/flags_state.h"
#include "components/flags_ui/flags_storage.h" #include "components/flags_ui/flags_storage.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/layout/flex_layout_view.h"
// TODO(elainechien): Use composition instead of inheritance. // TODO(elainechien): Use composition instead of inheritance.
// TODO(elainechien): Add screenshots and strings for translation when UI is
// finished.
// TODO(elainechien): Formatting for items in child views.
class ChromeLabsBubbleView : public views::BubbleDialogDelegateView { class ChromeLabsBubbleView : public views::BubbleDialogDelegateView {
public: public:
static void Show(views::View* anchor_view, static void Show(views::View* anchor_view,
...@@ -54,7 +52,7 @@ class ChromeLabsBubbleView : public views::BubbleDialogDelegateView { ...@@ -54,7 +52,7 @@ class ChromeLabsBubbleView : public views::BubbleDialogDelegateView {
flags_ui::FlagsState* flags_state_; flags_ui::FlagsState* flags_state_;
// This view will hold all the child lab items. // This view will hold all the child lab items.
views::View* menu_item_container_; views::FlexLayoutView* menu_item_container_;
std::unique_ptr<ChromeLabsBubbleViewModel> model_; std::unique_ptr<ChromeLabsBubbleViewModel> model_;
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/toolbar/chrome_labs_item_view.h" #include "chrome/browser/ui/views/toolbar/chrome_labs_item_view.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.h" #include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.h"
#include "ui/base/models/combobox_model.h" #include "ui/base/models/combobox_model.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h" #include "ui/views/layout/flex_layout_types.h"
#include "ui/views/layout/layout_provider.h"
class LabsComboboxModel : public ui::ComboboxModel { class LabsComboboxModel : public ui::ComboboxModel {
public: public:
...@@ -39,21 +42,35 @@ ChromeLabsItemView::ChromeLabsItemView( ...@@ -39,21 +42,35 @@ ChromeLabsItemView::ChromeLabsItemView(
: feature_entry_(feature_entry) { : feature_entry_(feature_entry) {
SetLayoutManager(std::make_unique<views::FlexLayout>()) SetLayoutManager(std::make_unique<views::FlexLayout>())
->SetOrientation(views::LayoutOrientation::kVertical) ->SetOrientation(views::LayoutOrientation::kVertical)
.SetDefault(views::kMarginsKey, gfx::Insets(10)); .SetCrossAxisAlignment(views::LayoutAlignment::kStart);
SetBorder(views::CreateEmptyBorder(
gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_CONTROL_LIST_VERTICAL),
0)));
AddChildView(views::Builder<views::Label>() AddChildView(views::Builder<views::Label>()
.SetTextContext(views::style::CONTEXT_DIALOG_BODY_TEXT)
.SetText(lab.visible_name) .SetText(lab.visible_name)
.SetHorizontalAlignment(gfx::ALIGN_LEFT) .SetHorizontalAlignment(gfx::ALIGN_LEFT)
.Build()); .Build());
AddChildView( AddChildView(
views::Builder<views::Label>() views::Builder<views::Label>()
.SetText(lab.visible_description) .SetText(lab.visible_description)
.SetTextContext(ChromeTextContext::CONTEXT_DIALOG_BODY_TEXT_SMALL)
.SetTextStyle(views::style::STYLE_SECONDARY)
.SetMultiLine(true) .SetMultiLine(true)
.SetHorizontalAlignment(gfx::ALIGN_LEFT) .SetHorizontalAlignment(gfx::ALIGN_LEFT)
.SetProperty(views::kFlexBehaviorKey, .SetProperty(views::kFlexBehaviorKey,
views::FlexSpecification( views::FlexSpecification(
views::MinimumFlexSizeRule::kPreferred, views::MinimumFlexSizeRule::kPreferred,
views::MaximumFlexSizeRule::kPreferred, true)) views::MaximumFlexSizeRule::kPreferred, true))
.SetBorder(views::CreateEmptyBorder(
gfx::Insets(0, 0,
views::LayoutProvider::Get()->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_VERTICAL),
0)))
.Build()); .Build());
AddChildView(views::Builder<views::Combobox>() AddChildView(views::Builder<views::Combobox>()
.CopyAddressTo(&lab_state_combobox_) .CopyAddressTo(&lab_state_combobox_)
.SetOwnedModel(std::make_unique<LabsComboboxModel>( .SetOwnedModel(std::make_unique<LabsComboboxModel>(
......
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