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

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

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « ash/system/session/logout_button_tray.h ('k') | ash/system/status_area_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/session/logout_button_tray.h" 5 #include "ash/system/session/logout_button_tray.h"
6 6
7 #include "ash/public/cpp/ash_typography.h" 7 #include "ash/public/cpp/ash_typography.h"
8 #include "ash/resources/vector_icons/vector_icons.h" 8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/shelf/wm_shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/system/session/logout_confirmation_controller.h" 11 #include "ash/system/session/logout_confirmation_controller.h"
12 #include "ash/system/status_area_widget.h" 12 #include "ash/system/status_area_widget.h"
13 #include "ash/system/tray/system_tray_controller.h" 13 #include "ash/system/tray/system_tray_controller.h"
14 #include "ash/system/tray/system_tray_notifier.h" 14 #include "ash/system/tray/system_tray_notifier.h"
15 #include "ash/system/tray/tray_constants.h" 15 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_container.h" 16 #include "ash/system/tray/tray_container.h"
17 #include "ash/system/user/login_status.h" 17 #include "ash/system/user/login_status.h"
18 #include "ui/accessibility/ax_node_data.h" 18 #include "ui/accessibility/ax_node_data.h"
19 #include "ui/gfx/color_palette.h" 19 #include "ui/gfx/color_palette.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/paint_vector_icon.h" 21 #include "ui/gfx/paint_vector_icon.h"
22 #include "ui/views/controls/button/md_text_button.h" 22 #include "ui/views/controls/button/md_text_button.h"
23 #include "ui/views/layout/fill_layout.h" 23 #include "ui/views/layout/fill_layout.h"
24 24
25 namespace ash { 25 namespace ash {
26 26
27 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) 27 LogoutButtonTray::LogoutButtonTray(Shelf* shelf)
28 : wm_shelf_(wm_shelf), 28 : shelf_(shelf),
29 container_(new TrayContainer(wm_shelf)), 29 container_(new TrayContainer(shelf)),
30 button_(views::MdTextButton::Create(this, 30 button_(views::MdTextButton::Create(this,
31 base::string16(), 31 base::string16(),
32 CONTEXT_LAUNCHER_BUTTON)), 32 CONTEXT_LAUNCHER_BUTTON)),
33 show_logout_button_in_tray_(false) { 33 show_logout_button_in_tray_(false) {
34 SetLayoutManager(new views::FillLayout); 34 SetLayoutManager(new views::FillLayout);
35 AddChildView(container_); 35 AddChildView(container_);
36 36
37 button_->SetProminent(true); 37 button_->SetProminent(true);
38 button_->SetBgColorOverride(gfx::kGoogleRed700); 38 button_->SetBgColorOverride(gfx::kGoogleRed700);
39 39
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 void LogoutButtonTray::OnLogoutDialogDurationChanged(base::TimeDelta duration) { 79 void LogoutButtonTray::OnLogoutDialogDurationChanged(base::TimeDelta duration) {
80 dialog_duration_ = duration; 80 dialog_duration_ = duration;
81 } 81 }
82 82
83 void LogoutButtonTray::UpdateAfterLoginStatusChange() { 83 void LogoutButtonTray::UpdateAfterLoginStatusChange() {
84 UpdateButtonTextAndImage(); 84 UpdateButtonTextAndImage();
85 } 85 }
86 86
87 void LogoutButtonTray::UpdateVisibility() { 87 void LogoutButtonTray::UpdateVisibility() {
88 LoginStatus login_status = wm_shelf_->GetStatusAreaWidget()->login_status(); 88 LoginStatus login_status = shelf_->GetStatusAreaWidget()->login_status();
89 SetVisible(show_logout_button_in_tray_ && 89 SetVisible(show_logout_button_in_tray_ &&
90 login_status != LoginStatus::NOT_LOGGED_IN && 90 login_status != LoginStatus::NOT_LOGGED_IN &&
91 login_status != LoginStatus::LOCKED); 91 login_status != LoginStatus::LOCKED);
92 } 92 }
93 93
94 void LogoutButtonTray::UpdateButtonTextAndImage() { 94 void LogoutButtonTray::UpdateButtonTextAndImage() {
95 LoginStatus login_status = wm_shelf_->GetStatusAreaWidget()->login_status(); 95 LoginStatus login_status = shelf_->GetStatusAreaWidget()->login_status();
96 const base::string16 title = 96 const base::string16 title =
97 user::GetLocalizedSignOutStringForStatus(login_status, false); 97 user::GetLocalizedSignOutStringForStatus(login_status, false);
98 if (wm_shelf_->IsHorizontalAlignment()) { 98 if (shelf_->IsHorizontalAlignment()) {
99 button_->SetText(title); 99 button_->SetText(title);
100 button_->SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); 100 button_->SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia());
101 button_->SetMinSize(gfx::Size(0, kTrayItemSize)); 101 button_->SetMinSize(gfx::Size(0, kTrayItemSize));
102 } else { 102 } else {
103 button_->SetText(base::string16()); 103 button_->SetText(base::string16());
104 button_->SetAccessibleName(title); 104 button_->SetAccessibleName(title);
105 button_->SetImage(views::Button::STATE_NORMAL, 105 button_->SetImage(views::Button::STATE_NORMAL,
106 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); 106 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor));
107 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); 107 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize));
108 } 108 }
109 UpdateVisibility(); 109 UpdateVisibility();
110 } 110 }
111 111
112 } // namespace ash 112 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/session/logout_button_tray.h ('k') | ash/system/status_area_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698