| OLD | NEW |
| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 button->set_bg_color_override(gfx::kGoogleRed700); | 112 button->set_bg_color_override(gfx::kGoogleRed700); |
| 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 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 123 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); | 122 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); |
| 124 } | 123 } |
| 125 | 124 |
| 126 LogoutButtonTray::~LogoutButtonTray() { | 125 LogoutButtonTray::~LogoutButtonTray() { |
| 127 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); | 126 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); |
| 128 } | 127 } |
| 129 | 128 |
| 130 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { | 129 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { |
| 131 // We must first update the button so that | 130 // We must first update the button so that |
| 132 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly. | 131 // TrayBackgroundView::SetShelfAlignment() can lay it out correctly. |
| 133 UpdateButtonTextAndImage(login_status_, alignment); | 132 UpdateButtonTextAndImage(login_status_, alignment); |
| 134 TrayBackgroundView::SetShelfAlignment(alignment); | 133 TrayBackgroundView::SetShelfAlignment(alignment); |
| 135 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 136 } | 134 } |
| 137 | 135 |
| 138 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { | 136 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { |
| 139 return button_->GetText(); | 137 return button_->GetText(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 void LogoutButtonTray::HideBubbleWithView( | 140 void LogoutButtonTray::HideBubbleWithView( |
| 143 const views::TrayBubbleView* bubble_view) {} | 141 const views::TrayBubbleView* bubble_view) {} |
| 144 | 142 |
| 145 void LogoutButtonTray::ClickedOutsideBubble() {} | 143 void LogoutButtonTray::ClickedOutsideBubble() {} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 button_->SetAccessibleName(title); | 187 button_->SetAccessibleName(title); |
| 190 button_->SetImage( | 188 button_->SetImage( |
| 191 views::LabelButton::STATE_NORMAL, | 189 views::LabelButton::STATE_NORMAL, |
| 192 gfx::CreateVectorIcon(gfx::VectorIconId::SHELF_LOGOUT, kTrayIconColor)); | 190 gfx::CreateVectorIcon(gfx::VectorIconId::SHELF_LOGOUT, kTrayIconColor)); |
| 193 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 191 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
| 194 } | 192 } |
| 195 UpdateVisibility(); | 193 UpdateVisibility(); |
| 196 } | 194 } |
| 197 | 195 |
| 198 } // namespace ash | 196 } // namespace ash |
| OLD | NEW |