| 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/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 LogoutButton::~LogoutButton() {} | 94 LogoutButton::~LogoutButton() {} |
| 95 | 95 |
| 96 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) | 96 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) |
| 97 : TrayBackgroundView(wm_shelf), | 97 : TrayBackgroundView(wm_shelf), |
| 98 button_(NULL), | 98 button_(NULL), |
| 99 login_status_(LoginStatus::NOT_LOGGED_IN), | 99 login_status_(LoginStatus::NOT_LOGGED_IN), |
| 100 show_logout_button_in_tray_(false) { | 100 show_logout_button_in_tray_(false) { |
| 101 button_ = new LogoutButton(this); | 101 button_ = new LogoutButton(this); |
| 102 tray_container()->AddChildView(button_); | 102 tray_container()->AddChildView(button_); |
| 103 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 104 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); | 103 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); |
| 105 } | 104 } |
| 106 | 105 |
| 107 LogoutButtonTray::~LogoutButtonTray() { | 106 LogoutButtonTray::~LogoutButtonTray() { |
| 108 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); | 107 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { | 110 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { |
| 112 TrayBackgroundView::SetShelfAlignment(alignment); | 111 TrayBackgroundView::SetShelfAlignment(alignment); |
| 113 tray_container()->SetBorder(views::Border::NullBorder()); | |
| 114 } | 112 } |
| 115 | 113 |
| 116 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { | 114 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { |
| 117 return button_->GetText(); | 115 return button_->GetText(); |
| 118 } | 116 } |
| 119 | 117 |
| 120 void LogoutButtonTray::HideBubbleWithView( | 118 void LogoutButtonTray::HideBubbleWithView( |
| 121 const views::TrayBubbleView* bubble_view) {} | 119 const views::TrayBubbleView* bubble_view) {} |
| 122 | 120 |
| 123 void LogoutButtonTray::ClickedOutsideBubble() {} | 121 void LogoutButtonTray::ClickedOutsideBubble() {} |
| (...skipping 28 matching lines...) Expand all Loading... |
| 152 UpdateVisibility(); | 150 UpdateVisibility(); |
| 153 } | 151 } |
| 154 | 152 |
| 155 void LogoutButtonTray::UpdateVisibility() { | 153 void LogoutButtonTray::UpdateVisibility() { |
| 156 SetVisible(show_logout_button_in_tray_ && | 154 SetVisible(show_logout_button_in_tray_ && |
| 157 login_status_ != LoginStatus::NOT_LOGGED_IN && | 155 login_status_ != LoginStatus::NOT_LOGGED_IN && |
| 158 login_status_ != LoginStatus::LOCKED); | 156 login_status_ != LoginStatus::LOCKED); |
| 159 } | 157 } |
| 160 | 158 |
| 161 } // namespace ash | 159 } // namespace ash |
| OLD | NEW |