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

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

Issue 2098023002: mash: Migrate remaining tray observers and notify functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 6 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 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/system/chromeos/session/logout_button_tray.h" 5 #include "ash/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"
11 #include "ash/common/system/tray/system_tray_delegate.h" 11 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/system/tray/system_tray_notifier.h"
12 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
13 #include "ash/common/system/tray/tray_utils.h" 14 #include "ash/common/system/tray/tray_utils.h"
14 #include "ash/common/system/user/login_status.h" 15 #include "ash/common/system/user/login_status.h"
15 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
16 #include "ash/shell.h" 17 #include "ash/shell.h"
17 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 18 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
18 #include "ash/system/status_area_widget.h" 19 #include "ash/system/status_area_widget.h"
19 #include "ash/system/tray/system_tray_notifier.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "grit/ash_resources.h" 21 #include "grit/ash_resources.h"
22 #include "third_party/skia/include/core/SkColor.h" 22 #include "third_party/skia/include/core/SkColor.h"
23 #include "ui/events/event.h" 23 #include "ui/events/event.h"
24 #include "ui/gfx/geometry/insets.h" 24 #include "ui/gfx/geometry/insets.h"
25 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
26 #include "ui/views/bubble/tray_bubble_view.h" 26 #include "ui/views/bubble/tray_bubble_view.h"
27 #include "ui/views/controls/button/label_button.h" 27 #include "ui/views/controls/button/label_button.h"
28 #include "ui/views/controls/button/label_button_border.h" 28 #include "ui/views/controls/button/label_button_border.h"
29 #include "ui/views/painter.h" 29 #include "ui/views/painter.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 LogoutButtonTray::LogoutButtonTray(StatusAreaWidget* status_area_widget) 98 LogoutButtonTray::LogoutButtonTray(StatusAreaWidget* status_area_widget)
99 : TrayBackgroundView(status_area_widget->wm_shelf()), 99 : TrayBackgroundView(status_area_widget->wm_shelf()),
100 button_(NULL), 100 button_(NULL),
101 login_status_(LoginStatus::NOT_LOGGED_IN), 101 login_status_(LoginStatus::NOT_LOGGED_IN),
102 show_logout_button_in_tray_(false) { 102 show_logout_button_in_tray_(false) {
103 button_ = new LogoutButton(this); 103 button_ = new LogoutButton(this);
104 tray_container()->AddChildView(button_); 104 tray_container()->AddChildView(button_);
105 tray_container()->SetBorder(views::Border::NullBorder()); 105 tray_container()->SetBorder(views::Border::NullBorder());
106 Shell::GetInstance()->system_tray_notifier()->AddLogoutButtonObserver(this); 106 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this);
107 } 107 }
108 108
109 LogoutButtonTray::~LogoutButtonTray() { 109 LogoutButtonTray::~LogoutButtonTray() {
110 Shell::GetInstance()->system_tray_notifier()-> 110 WmShell::Get()->system_tray_notifier()->RemoveLogoutButtonObserver(this);
111 RemoveLogoutButtonObserver(this);
112 } 111 }
113 112
114 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) { 113 void LogoutButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
115 TrayBackgroundView::SetShelfAlignment(alignment); 114 TrayBackgroundView::SetShelfAlignment(alignment);
116 tray_container()->SetBorder(views::Border::NullBorder()); 115 tray_container()->SetBorder(views::Border::NullBorder());
117 } 116 }
118 117
119 base::string16 LogoutButtonTray::GetAccessibleNameForTray() { 118 base::string16 LogoutButtonTray::GetAccessibleNameForTray() {
120 return button_->GetText(); 119 return button_->GetText();
121 } 120 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 UpdateVisibility(); 155 UpdateVisibility();
157 } 156 }
158 157
159 void LogoutButtonTray::UpdateVisibility() { 158 void LogoutButtonTray::UpdateVisibility() {
160 SetVisible(show_logout_button_in_tray_ && 159 SetVisible(show_logout_button_in_tray_ &&
161 login_status_ != LoginStatus::NOT_LOGGED_IN && 160 login_status_ != LoginStatus::NOT_LOGGED_IN &&
162 login_status_ != LoginStatus::LOCKED); 161 login_status_ != LoginStatus::LOCKED);
163 } 162 }
164 163
165 } // namespace ash 164 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698