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

Side by Side Diff: ash/common/system/chromeos/palette/palette_tray.cc

Issue 2416253004: ash: Use session_manager::SessionState (Closed)
Patch Set: fix compile Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/palette/palette_tray.h" 5 #include "ash/common/system/chromeos/palette/palette_tray.h"
6 6
7 #include "ash/common/session/session_state_delegate.h"
7 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
10 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
11 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" 12 #include "ash/common/system/chromeos/palette/palette_tool_manager.h"
12 #include "ash/common/system/chromeos/palette/palette_utils.h" 13 #include "ash/common/system/chromeos/palette/palette_utils.h"
13 #include "ash/common/system/tray/system_tray_controller.h" 14 #include "ash/common/system/tray/system_tray_controller.h"
14 #include "ash/common/system/tray/system_tray_delegate.h" 15 #include "ash/common/system/tray/system_tray_delegate.h"
15 #include "ash/common/system/tray/tray_bubble_wrapper.h" 16 #include "ash/common/system/tray/tray_bubble_wrapper.h"
16 #include "ash/common/system/tray/tray_constants.h" 17 #include "ash/common/system/tray/tray_constants.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const int kHorizontalPaddingBetweenTitleEntries = 2; 69 const int kHorizontalPaddingBetweenTitleEntries = 2;
69 70
70 // Color of the separator. 71 // Color of the separator.
71 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); 72 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00);
72 73
73 // Returns true if we are in a user session that can show the stylus tools. 74 // Returns true if we are in a user session that can show the stylus tools.
74 bool IsInUserSession() { 75 bool IsInUserSession() {
75 SessionStateDelegate* session_state_delegate = 76 SessionStateDelegate* session_state_delegate =
76 WmShell::Get()->GetSessionStateDelegate(); 77 WmShell::Get()->GetSessionStateDelegate();
77 return !session_state_delegate->IsUserSessionBlocked() && 78 return !session_state_delegate->IsUserSessionBlocked() &&
78 session_state_delegate->GetSessionState() == 79 session_state_delegate->GetSessionState() == SessionState::ACTIVE &&
79 SessionStateDelegate::SESSION_STATE_ACTIVE &&
80 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != 80 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
81 LoginStatus::KIOSK_APP; 81 LoginStatus::KIOSK_APP;
82 } 82 }
83 83
84 // Returns the font used by the title view. 84 // Returns the font used by the title view.
85 const gfx::FontList& GetTitleFont() { 85 const gfx::FontList& GetTitleFont() {
86 // TODO(tdanderson|jdufault): Use TrayPopupItemStyle instead. 86 // TODO(tdanderson|jdufault): Use TrayPopupItemStyle instead.
87 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( 87 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
88 2, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM); 88 2, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM);
89 } 89 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return true; 262 return true;
263 } 263 }
264 264
265 bool PaletteTray::ContainsPointInScreen(const gfx::Point& point) { 265 bool PaletteTray::ContainsPointInScreen(const gfx::Point& point) {
266 if (icon_ && icon_->GetBoundsInScreen().Contains(point)) 266 if (icon_ && icon_->GetBoundsInScreen().Contains(point))
267 return true; 267 return true;
268 268
269 return bubble_ && bubble_->bubble_view()->GetBoundsInScreen().Contains(point); 269 return bubble_ && bubble_->bubble_view()->GetBoundsInScreen().Contains(point);
270 } 270 }
271 271
272 void PaletteTray::SessionStateChanged( 272 void PaletteTray::SessionStateChanged(SessionState state) {
273 SessionStateDelegate::SessionState state) {
274 UpdateIconVisibility(); 273 UpdateIconVisibility();
275 } 274 }
276 275
277 void PaletteTray::OnLockStateChanged(bool locked) { 276 void PaletteTray::OnLockStateChanged(bool locked) {
278 UpdateIconVisibility(); 277 UpdateIconVisibility();
279 278
280 // The user can eject the stylus during the lock screen transition, which will 279 // The user can eject the stylus during the lock screen transition, which will
281 // open the palette. Make sure to close it if that happens. 280 // open the palette. Make sure to close it if that happens.
282 if (locked) 281 if (locked)
283 HidePalette(); 282 HidePalette();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } else { 456 } else {
458 UpdateIconVisibility(); 457 UpdateIconVisibility();
459 } 458 }
460 } 459 }
461 460
462 void PaletteTray::UpdateIconVisibility() { 461 void PaletteTray::UpdateIconVisibility() {
463 SetVisible(IsInUserSession()); 462 SetVisible(IsInUserSession());
464 } 463 }
465 464
466 } // namespace ash 465 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698