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

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

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 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
« no previous file with comments | « ash/system/tray/tray_utils.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/user/tray_user.cc
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index 5a07ea61f4e47b8354c2eb5ddb6030ebdbe8ecc0..5af503bf634e4268bfac7d494b6116bba04f6fc3 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -473,9 +473,10 @@ PublicAccountUserDetails::PublicAccountUserDetails(SystemTrayItem* owner,
const int inner_padding =
kTrayPopupPaddingHorizontal - kTrayPopupPaddingBetweenItems;
const bool rtl = base::i18n::IsRTL();
- set_border(views::Border::CreateEmptyBorder(
- kUserDetailsVerticalPadding, rtl ? 0 : inner_padding,
- kUserDetailsVerticalPadding, rtl ? inner_padding : 0));
+ SetBorder(views::Border::CreateEmptyBorder(kUserDetailsVerticalPadding,
+ rtl ? 0 : inner_padding,
+ kUserDetailsVerticalPadding,
+ rtl ? inner_padding : 0));
// Retrieve the user's display name and wrap it with markers.
// Note that since this is a public account it always has to be the primary
@@ -683,8 +684,8 @@ void UserCard::OnMouseExited(const ui::MouseEvent& event) {
void UserCard::ShowActive() {
int width = button_hovered_ || show_border_ ? 1 : 0;
- set_border(views::Border::CreateSolidSidedBorder(width, width, width, 1,
- kBorderColor));
+ SetBorder(views::Border::CreateSolidSidedBorder(
+ width, width, width, 1, kBorderColor));
SchedulePaint();
}
@@ -832,7 +833,8 @@ void UserView::AddLogoutButton(user::LoginStatus login) {
logout_button_ = logout_button;
// In public account mode, the logout button border has a custom color.
if (login == user::LOGGED_IN_PUBLIC) {
- TrayPopupLabelButtonBorder* border = new TrayPopupLabelButtonBorder();
+ scoped_ptr<TrayPopupLabelButtonBorder> border(
+ new TrayPopupLabelButtonBorder());
border->SetPainter(false, views::Button::STATE_NORMAL,
views::Painter::CreateImageGridPainter(
kPublicAccountLogoutButtonBorderImagesNormal));
@@ -842,16 +844,17 @@ void UserView::AddLogoutButton(user::LoginStatus login) {
border->SetPainter(false, views::Button::STATE_PRESSED,
views::Painter::CreateImageGridPainter(
kPublicAccountLogoutButtonBorderImagesHovered));
- logout_button_->set_border(border);
+ logout_button_->SetBorder(border.PassAs<views::Border>());
}
AddChildView(logout_button_);
}
void UserView::AddUserCard(SystemTrayItem* owner, user::LoginStatus login) {
// Add padding around the panel.
- set_border(views::Border::CreateEmptyBorder(
- kUserCardVerticalPadding, kTrayPopupPaddingHorizontal,
- kUserCardVerticalPadding, kTrayPopupPaddingHorizontal));
+ SetBorder(views::Border::CreateEmptyBorder(kUserCardVerticalPadding,
+ kTrayPopupPaddingHorizontal,
+ kUserCardVerticalPadding,
+ kTrayPopupPaddingHorizontal));
if (SupportsMultiProfile() && login != user::LOGGED_IN_RETAIL_MODE) {
user_card_view_ = new UserCard(this, multiprofile_index_ == 0);
@@ -885,9 +888,9 @@ void UserView::AddUserCard(SystemTrayItem* owner, user::LoginStatus login) {
// To allow the border to start before the icon, reduce the size before and
// add an inset to the icon to get the spacing.
if (multiprofile_index_ == 0 && SupportsMultiProfile()) {
- icon->set_border(views::Border::CreateEmptyBorder(
+ icon->SetBorder(views::Border::CreateEmptyBorder(
0, kTrayUserTileHoverBorderInset, 0, 0));
- set_border(views::Border::CreateEmptyBorder(
+ SetBorder(views::Border::CreateEmptyBorder(
kUserCardVerticalPadding,
kTrayPopupPaddingHorizontal - kTrayUserTileHoverBorderInset,
kUserCardVerticalPadding,
@@ -971,7 +974,7 @@ void UserView::AddLoggedInRetailModeUserCardContent() {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
details->SetText(
bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_KIOSK_LABEL));
- details->set_border(views::Border::CreateEmptyBorder(0, 4, 0, 1));
+ details->SetBorder(views::Border::CreateEmptyBorder(0, 4, 0, 1));
details->SetHorizontalAlignment(gfx::ALIGN_LEFT);
user_card_view_->AddChildView(details);
}
@@ -1097,14 +1100,14 @@ void AddUserView::AddContent() {
set_background(views::Background::CreateSolidBackground(kBackgroundColor));
// Add padding around the panel.
- set_border(views::Border::CreateSolidBorder(1, kBorderColor));
+ SetBorder(views::Border::CreateSolidBorder(1, kBorderColor));
add_user_ = new UserCard(this, enable);
- add_user_->set_border(views::Border::CreateEmptyBorder(
+ add_user_->SetBorder(views::Border::CreateEmptyBorder(
kUserCardVerticalPadding,
- kTrayPopupPaddingHorizontal- kTrayUserTileHoverBorderInset,
+ kTrayPopupPaddingHorizontal - kTrayUserTileHoverBorderInset,
kUserCardVerticalPadding,
- kTrayPopupPaddingHorizontal- kTrayUserTileHoverBorderInset));
+ kTrayPopupPaddingHorizontal - kTrayUserTileHoverBorderInset));
add_user_->SetLayoutManager(new views::BoxLayout(
views::BoxLayout::kHorizontal, 0, 0 , kTrayPopupPaddingBetweenItems));
@@ -1290,7 +1293,7 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) {
if (avatar_ && switches::UseAlternateShelfLayout()) {
int corner_radius = GetTrayItemRadius();
avatar_->SetCornerRadii(0, corner_radius, corner_radius, 0);
- avatar_->set_border(NULL);
+ avatar_->SetBorder(views::Border::NullBorder());
}
UpdateAvatarImage(status);
@@ -1308,22 +1311,26 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
if (avatar_) {
if (switches::UseAlternateShelfLayout()) {
if (multiprofile_index_) {
- avatar_->set_border(
+ avatar_->SetBorder(
views::Border::CreateEmptyBorder(0, kTrayLabelSpacing, 0, 0));
} else {
- avatar_->set_border(NULL);
+ avatar_->SetBorder(views::Border::NullBorder());
}
avatar_->SetCornerRadii(0, corner_radius, corner_radius, 0);
} else {
- avatar_->set_border(views::Border::CreateEmptyBorder(
- 0, kTrayImageItemHorizontalPaddingBottomAlignment + 2,
- 0, kTrayImageItemHorizontalPaddingBottomAlignment));
+ avatar_->SetBorder(views::Border::CreateEmptyBorder(
+ 0,
+ kTrayImageItemHorizontalPaddingBottomAlignment + 2,
+ 0,
+ kTrayImageItemHorizontalPaddingBottomAlignment));
}
}
if (label_) {
- label_->set_border(views::Border::CreateEmptyBorder(
- 0, kTrayLabelItemHorizontalPaddingBottomAlignment,
- 0, kTrayLabelItemHorizontalPaddingBottomAlignment));
+ label_->SetBorder(views::Border::CreateEmptyBorder(
+ 0,
+ kTrayLabelItemHorizontalPaddingBottomAlignment,
+ 0,
+ kTrayLabelItemHorizontalPaddingBottomAlignment));
}
layout_view_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal,
@@ -1332,10 +1339,10 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
if (avatar_) {
if (switches::UseAlternateShelfLayout()) {
if (multiprofile_index_) {
- avatar_->set_border(
+ avatar_->SetBorder(
views::Border::CreateEmptyBorder(kTrayLabelSpacing, 0, 0, 0));
} else {
- avatar_->set_border(NULL);
+ avatar_->SetBorder(views::Border::NullBorder());
}
avatar_->SetCornerRadii(0, 0, corner_radius, corner_radius);
} else {
@@ -1343,7 +1350,7 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
}
}
if (label_) {
- label_->set_border(views::Border::CreateEmptyBorder(
+ label_->SetBorder(views::Border::CreateEmptyBorder(
kTrayLabelItemVerticalPaddingVerticalAlignment,
kTrayLabelItemHorizontalPaddingBottomAlignment,
kTrayLabelItemVerticalPaddingVerticalAlignment,
« no previous file with comments | « ash/system/tray/tray_utils.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698