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

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

Issue 2103603002: mash: Remove StatusAreaWidget references from system tray classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments, rename SetSystemTrayHeight to SetTrayBubbleHeight Created 4 years, 5 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/system_tray_notifier.h"
13 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_utils.h" 14 #include "ash/common/system/tray/tray_utils.h"
15 #include "ash/common/system/user/login_status.h" 15 #include "ash/common/system/user/login_status.h"
16 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
17 #include "ash/shell.h" 17 #include "ash/shell.h"
18 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 18 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
19 #include "ash/system/status_area_widget.h"
20 #include "base/logging.h" 19 #include "base/logging.h"
21 #include "grit/ash_resources.h" 20 #include "grit/ash_resources.h"
22 #include "third_party/skia/include/core/SkColor.h" 21 #include "third_party/skia/include/core/SkColor.h"
23 #include "ui/events/event.h" 22 #include "ui/events/event.h"
24 #include "ui/gfx/geometry/insets.h" 23 #include "ui/gfx/geometry/insets.h"
25 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
26 #include "ui/views/bubble/tray_bubble_view.h" 25 #include "ui/views/bubble/tray_bubble_view.h"
27 #include "ui/views/controls/button/label_button.h" 26 #include "ui/views/controls/button/label_button.h"
28 #include "ui/views/controls/button/label_button_border.h" 27 #include "ui/views/controls/button/label_button_border.h"
29 #include "ui/views/painter.h" 28 #include "ui/views/painter.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 kLogoutButtonHorizontalExtraPadding); 87 kLogoutButtonHorizontalExtraPadding);
89 border->set_insets(insets); 88 border->set_insets(insets);
90 SetBorder(std::move(border)); 89 SetBorder(std::move(border));
91 set_animate_on_state_change(false); 90 set_animate_on_state_change(false);
92 91
93 SetMinSize(gfx::Size(0, kShelfItemHeight)); 92 SetMinSize(gfx::Size(0, kShelfItemHeight));
94 } 93 }
95 94
96 LogoutButton::~LogoutButton() {} 95 LogoutButton::~LogoutButton() {}
97 96
98 LogoutButtonTray::LogoutButtonTray(StatusAreaWidget* status_area_widget) 97 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf)
99 : TrayBackgroundView(status_area_widget->wm_shelf()), 98 : TrayBackgroundView(wm_shelf),
100 button_(NULL), 99 button_(NULL),
101 login_status_(LoginStatus::NOT_LOGGED_IN), 100 login_status_(LoginStatus::NOT_LOGGED_IN),
102 show_logout_button_in_tray_(false) { 101 show_logout_button_in_tray_(false) {
103 button_ = new LogoutButton(this); 102 button_ = new LogoutButton(this);
104 tray_container()->AddChildView(button_); 103 tray_container()->AddChildView(button_);
105 tray_container()->SetBorder(views::Border::NullBorder()); 104 tray_container()->SetBorder(views::Border::NullBorder());
106 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); 105 WmShell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this);
107 } 106 }
108 107
109 LogoutButtonTray::~LogoutButtonTray() { 108 LogoutButtonTray::~LogoutButtonTray() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 UpdateVisibility(); 153 UpdateVisibility();
155 } 154 }
156 155
157 void LogoutButtonTray::UpdateVisibility() { 156 void LogoutButtonTray::UpdateVisibility() {
158 SetVisible(show_logout_button_in_tray_ && 157 SetVisible(show_logout_button_in_tray_ &&
159 login_status_ != LoginStatus::NOT_LOGGED_IN && 158 login_status_ != LoginStatus::NOT_LOGGED_IN &&
160 login_status_ != LoginStatus::LOCKED); 159 login_status_ != LoginStatus::LOCKED);
161 } 160 }
162 161
163 } // namespace ash 162 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/session/logout_button_tray.h ('k') | ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698