Commit 1badbcec authored by glevin's avatar glevin Committed by Commit Bot

Harmonize MultiprofilesIntroDialog

As per crbug.com/788022 Comments 1,6:
- Consolidate 2 paragraphs into one
- Fix padding between content area and buttons
- Update "Don't show" checkbox text
- Move "Don't show" checkbox from button to content area
- Remove X (Close) button from upper right

Bug: 788022
Test: Try to open second (multi) profile, view Multiprofile warning
dialog, marvel at the unbearable Harmoniousness of it all.

Change-Id: I1bb57e06b11c66e9b3cb3f3f4149ec8edcd35af5
Reviewed-on: https://chromium-review.googlesource.com/1015786Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Greg Levin <glevin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555453}
parent bb07561f
...@@ -1224,15 +1224,10 @@ This file contains the strings for ash. ...@@ -1224,15 +1224,10 @@ This file contains the strings for ash.
Multiple sign-in Multiple sign-in
</message> </message>
<message name="IDS_ASH_MULTIPROFILES_INTRO_MESSAGE" desc="Content of the multi-profiles intro dialog shown when the user adds another user in multi-profiles mode."> <message name="IDS_ASH_MULTIPROFILES_INTRO_MESSAGE" desc="Content of the multi-profiles intro dialog shown when the user adds another user in multi-profiles mode.">
This feature allows you to quickly access any signed-in user without requiring a password. This feature allows you to quickly access any signed-in user without requiring a password. Only use this feature with accounts you trust.
Only use this feature with accounts you trust.
</message> </message>
<message name="IDS_ASH_MULTIPROFILES_INTRO_EXPLANATION" desc="Content of the multi-profiles intro dialog shown when the user adds another user in multi-profiles mode."> <message name="IDS_ASH_MULTIPROFILES_INTRO_EXPLANATION" desc="Content of the multi-profiles intro dialog shown when the user adds another user in multi-profiles mode.">
</message> </message>
<message name="IDS_ASH_MULTIPROFILES_INTRO_NOSHOW_AGAIN" desc="In multi-profiles intro dialog, text for no-show-again option.">
Got it, don't show me this again.
</message>
<!-- Strings shown within MultiDevice setup notifications --> <!-- Strings shown within MultiDevice setup notifications -->
<message name="IDS_ASH_MULTI_DEVICE_SETUP_NEW_USER_POTENTIAL_HOST_EXISTS_TITLE" desc="Title of the notification shown to a user that has not completed the MultiDevice setup flow when a potential host device is found." translateable="false"> <message name="IDS_ASH_MULTI_DEVICE_SETUP_NEW_USER_POTENTIAL_HOST_EXISTS_TITLE" desc="Title of the notification shown to a user that has not completed the MultiDevice setup flow when a potential host device is found." translateable="false">
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/layout_provider.h" #include "ui/views/layout/layout_provider.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -21,7 +22,7 @@ namespace ash { ...@@ -21,7 +22,7 @@ namespace ash {
namespace { namespace {
// Default width of the dialog. // Default width of the dialog.
const int kDefaultWidth = 448; constexpr int kDefaultWidth = 448;
} // namespace } // namespace
...@@ -47,10 +48,6 @@ bool MultiprofilesIntroDialog::Accept() { ...@@ -47,10 +48,6 @@ bool MultiprofilesIntroDialog::Accept() {
return true; return true;
} }
views::View* MultiprofilesIntroDialog::CreateExtraView() {
return never_show_again_checkbox_;
}
ui::ModalType MultiprofilesIntroDialog::GetModalType() const { ui::ModalType MultiprofilesIntroDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM; return ui::MODAL_TYPE_SYSTEM;
} }
...@@ -59,6 +56,11 @@ base::string16 MultiprofilesIntroDialog::GetWindowTitle() const { ...@@ -59,6 +56,11 @@ base::string16 MultiprofilesIntroDialog::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_ASH_MULTIPROFILES_INTRO_HEADLINE); return l10n_util::GetStringUTF16(IDS_ASH_MULTIPROFILES_INTRO_HEADLINE);
} }
bool MultiprofilesIntroDialog::ShouldShowCloseButton() const {
// Material UI has no [X] in the corner of this dialog.
return !ui::MaterialDesignController::IsSecondaryUiMaterial();
}
gfx::Size MultiprofilesIntroDialog::CalculatePreferredSize() const { gfx::Size MultiprofilesIntroDialog::CalculatePreferredSize() const {
return gfx::Size( return gfx::Size(
kDefaultWidth, kDefaultWidth,
...@@ -67,7 +69,7 @@ gfx::Size MultiprofilesIntroDialog::CalculatePreferredSize() const { ...@@ -67,7 +69,7 @@ gfx::Size MultiprofilesIntroDialog::CalculatePreferredSize() const {
MultiprofilesIntroDialog::MultiprofilesIntroDialog(OnAcceptCallback on_accept) MultiprofilesIntroDialog::MultiprofilesIntroDialog(OnAcceptCallback on_accept)
: never_show_again_checkbox_(new views::Checkbox( : never_show_again_checkbox_(new views::Checkbox(
l10n_util::GetStringUTF16(IDS_ASH_MULTIPROFILES_INTRO_NOSHOW_AGAIN))), l10n_util::GetStringUTF16(IDS_ASH_DIALOG_DONT_SHOW_AGAIN))),
on_accept_(std::move(on_accept)) { on_accept_(std::move(on_accept)) {
never_show_again_checkbox_->SetChecked(true); never_show_again_checkbox_->SetChecked(true);
} }
...@@ -75,10 +77,13 @@ MultiprofilesIntroDialog::MultiprofilesIntroDialog(OnAcceptCallback on_accept) ...@@ -75,10 +77,13 @@ MultiprofilesIntroDialog::MultiprofilesIntroDialog(OnAcceptCallback on_accept)
MultiprofilesIntroDialog::~MultiprofilesIntroDialog() = default; MultiprofilesIntroDialog::~MultiprofilesIntroDialog() = default;
void MultiprofilesIntroDialog::InitDialog() { void MultiprofilesIntroDialog::InitDialog() {
SetBorder( const views::LayoutProvider* provider = views::LayoutProvider::Get();
views::CreateEmptyBorder(views::LayoutProvider::Get()->GetInsetsMetric( SetBorder(views::CreateEmptyBorder(
views::INSETS_DIALOG_TITLE))); provider->GetDialogInsetsForContentType(views::TEXT, views::CONTROL)));
SetLayoutManager(std::make_unique<views::FillLayout>());
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, gfx::Insets(),
provider->GetDistanceMetric(views::DISTANCE_UNRELATED_CONTROL_VERTICAL)));
// Explanation string // Explanation string
views::Label* label = new views::Label( views::Label* label = new views::Label(
...@@ -86,6 +91,7 @@ void MultiprofilesIntroDialog::InitDialog() { ...@@ -86,6 +91,7 @@ void MultiprofilesIntroDialog::InitDialog() {
label->SetMultiLine(true); label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(label); AddChildView(label);
AddChildView(never_show_again_checkbox_);
} }
} // namespace ash } // namespace ash
...@@ -26,11 +26,11 @@ class MultiprofilesIntroDialog : public views::DialogDelegateView { ...@@ -26,11 +26,11 @@ class MultiprofilesIntroDialog : public views::DialogDelegateView {
// views::DialogDelegate overrides. // views::DialogDelegate overrides.
bool Cancel() override; bool Cancel() override;
bool Accept() override; bool Accept() override;
View* CreateExtraView() override;
// views::WidgetDelegate overrides. // views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override;
// views::View overrides. // views::View overrides.
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
......
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