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

Unified Diff: ash/system/user/user_view.cc

Issue 2816193002: Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: . Created 3 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: ash/system/user/user_view.cc
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index fe2ff061c8ceb920ba8c8d8fb6ab226e587c99ae..31386a5c9693fe1f312707599d4c06b58a07ba14 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -72,8 +72,7 @@ bool IsMultiProfileSupportedAndUserActive() {
}
// Creates the view shown in the user switcher popup ("AddUserMenuOption").
-views::View* CreateAddUserView(AddUserSessionPolicy policy,
- views::ButtonListener* listener) {
+views::View* CreateAddUserView(AddUserSessionPolicy policy) {
auto* view = new views::View;
const int icon_padding = (kMenuButtonSize - kMenuIconSize) / 2;
auto* layout =
@@ -81,8 +80,8 @@ views::View* CreateAddUserView(AddUserSessionPolicy policy,
kTrayPopupLabelHorizontalPadding + icon_padding);
layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight);
view->SetLayoutManager(layout);
- view->set_background(
- views::Background::CreateSolidBackground(kBackgroundColor));
+ view->set_background(views::Background::CreateThemedSolidBackground(
+ view, ui::NativeTheme::kColorId_BubbleBackground));
int message_id = 0;
switch (policy) {
@@ -123,13 +122,6 @@ views::View* CreateAddUserView(AddUserSessionPolicy policy,
view->SetBorder(views::CreateEmptyBorder(vertical_padding, icon_padding,
vertical_padding,
kTrayPopupLabelHorizontalPadding));
- if (policy == AddUserSessionPolicy::ALLOWED) {
msw 2017/04/17 18:04:53 What are these changes? They seem unrelated...
Evan Stade 2017/04/17 19:40:05 I refactored the wrap-the-view-in-a-button bit to
msw 2017/04/17 20:05:40 Okay, I'll leave review here to tdanderson@
tdanderson 2017/04/18 19:14:46 This looks good to me.
- auto* button =
- new ButtonFromView(view, listener, TrayPopupInkDropStyle::INSET_BOUNDS);
- button->SetAccessibleName(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT));
- return button;
- }
return view;
}
@@ -364,14 +356,24 @@ void UserView::ToggleAddUserMenuOption() {
views::View* container = new AddUserWidgetContents(
base::Bind(&UserView::RemoveAddUserMenuOption, base::Unretained(this)));
+ views::View* add_user_view = CreateAddUserView(add_user_policy);
container->SetBorder(views::CreatePaddedBorder(
- views::CreateSolidSidedBorder(0, 0, 0, kSeparatorWidth, kBackgroundColor),
+ views::CreateSolidSidedBorder(0, 0, 0, kSeparatorWidth,
+ add_user_view->background()->get_color()),
tdanderson 2017/04/18 19:14:46 nit: optional: consider giving add_user_view->back
Evan Stade 2017/04/19 15:59:01 Done.
gfx::Insets(row_height, 0, 0, 0)));
views::View* add_user_padding = new views::View();
- add_user_padding->SetBorder(views::CreateSolidSidedBorder(
- kMenuSeparatorVerticalPadding, 0, 0, 0, kBackgroundColor));
- views::View* add_user_view = CreateAddUserView(add_user_policy, this);
- add_user_padding->AddChildView(add_user_view);
+ add_user_padding->SetBorder(
+ views::CreateSolidSidedBorder(kMenuSeparatorVerticalPadding, 0, 0, 0,
+ add_user_view->background()->get_color()));
+ if (add_user_enabled_) {
+ auto* button = new ButtonFromView(add_user_view, this,
+ TrayPopupInkDropStyle::INSET_BOUNDS);
+ button->SetAccessibleName(
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT));
+ add_user_padding->AddChildView(button);
+ } else {
+ add_user_padding->AddChildView(add_user_view);
+ }
add_user_padding->SetLayoutManager(new views::FillLayout());
container->AddChildView(add_user_padding);
container->SetLayoutManager(new views::FillLayout());

Powered by Google App Engine
This is Rietveld 408576698