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