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

Side by Side Diff: ash/common/system/chromeos/session/logout_button_tray.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/session/logout_button_tray.h" 5 #include "ash/common/system/chromeos/session/logout_button_tray.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Base font size + 2 = 14. 113 // Base font size + 2 = 14.
114 // TODO(estade): should this 2 be shared with other tray views? See 114 // TODO(estade): should this 2 be shared with other tray views? See
115 // crbug.com/623987 115 // crbug.com/623987
116 button->AdjustFontSize(2); 116 button->AdjustFontSize(2);
117 button_ = button; 117 button_ = button;
118 } else { 118 } else {
119 button_ = new LogoutButton(this); 119 button_ = new LogoutButton(this);
120 } 120 }
121 tray_container()->AddChildView(button_); 121 tray_container()->AddChildView(button_);
122 if (!MaterialDesignController::IsShelfMaterial()) 122 if (!MaterialDesignController::IsShelfMaterial())
123 tray_container()->SetBorder(views::Border::NullBorder()); 123 tray_container()->SetBorder(views::NullBorder());
124 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); 124 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this);
125 } 125 }
126 126
127 LogoutButtonTray::~LogoutButtonTray() { 127 LogoutButtonTray::~LogoutButtonTray() {
128 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); 128 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this);
129 } 129 }
130 130
131 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { 131 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
132 // We must first update the button so that 132 // We must first update the button so that
133 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly. 133 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly.
134 UpdateButtonTextAndImage(login_status_, alignment); 134 UpdateButtonTextAndImage(login_status_, alignment);
135 TrayBackgroundView::SetShelfAlignment(alignment); 135 TrayBackgroundView::SetShelfAlignment(alignment);
136 if (!MaterialDesignController::IsShelfMaterial()) 136 if (!MaterialDesignController::IsShelfMaterial())
137 tray_container()->SetBorder(views::Border::NullBorder()); 137 tray_container()->SetBorder(views::NullBorder());
138 } 138 }
139 139
140 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { 140 base::string16 LogoutButtonTray::GetAccessibleNameForTray() {
141 return button_->GetText(); 141 return button_->GetText();
142 } 142 }
143 143
144 void LogoutButtonTray::HideBubbleWithView( 144 void LogoutButtonTray::HideBubbleWithView(
145 const views::TrayBubbleView* bubble_view) {} 145 const views::TrayBubbleView* bubble_view) {}
146 146
147 void LogoutButtonTray::ClickedOutsideBubble() {} 147 void LogoutButtonTray::ClickedOutsideBubble() {}
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 button_->SetAccessibleName(title); 198 button_->SetAccessibleName(title);
199 button_->SetImage( 199 button_->SetImage(
200 views::LabelButton::STATE_NORMAL, 200 views::LabelButton::STATE_NORMAL,
201 gfx::CreateVectorIcon(gfx::VectorIconId::SHELF_LOGOUT, kTrayIconColor)); 201 gfx::CreateVectorIcon(gfx::VectorIconId::SHELF_LOGOUT, kTrayIconColor));
202 button_->SetMinSize(gfx::Size(button_size, button_size)); 202 button_->SetMinSize(gfx::Size(button_size, button_size));
203 } 203 }
204 UpdateVisibility(); 204 UpdateVisibility();
205 } 205 }
206 206
207 } // namespace ash 207 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698