| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() == |
| 79 SessionStateDelegate::SESSION_STATE_ACTIVE && | 80 session_manager::SessionState::ACTIVE && |
| 80 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != | 81 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != |
| 81 LoginStatus::KIOSK_APP; | 82 LoginStatus::KIOSK_APP; |
| 82 } | 83 } |
| 83 | 84 |
| 84 // Returns the font used by the title view. | 85 // Returns the font used by the title view. |
| 85 const gfx::FontList& GetTitleFont() { | 86 const gfx::FontList& GetTitleFont() { |
| 86 // TODO(tdanderson|jdufault): Use TrayPopupItemStyle instead. | 87 // TODO(tdanderson|jdufault): Use TrayPopupItemStyle instead. |
| 87 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 88 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 88 2, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM); | 89 2, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM); |
| 89 } | 90 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 return true; | 263 return true; |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool PaletteTray::ContainsPointInScreen(const gfx::Point& point) { | 266 bool PaletteTray::ContainsPointInScreen(const gfx::Point& point) { |
| 266 if (icon_ && icon_->GetBoundsInScreen().Contains(point)) | 267 if (icon_ && icon_->GetBoundsInScreen().Contains(point)) |
| 267 return true; | 268 return true; |
| 268 | 269 |
| 269 return bubble_ && bubble_->bubble_view()->GetBoundsInScreen().Contains(point); | 270 return bubble_ && bubble_->bubble_view()->GetBoundsInScreen().Contains(point); |
| 270 } | 271 } |
| 271 | 272 |
| 272 void PaletteTray::SessionStateChanged( | 273 void PaletteTray::SessionStateChanged(session_manager::SessionState state) { |
| 273 SessionStateDelegate::SessionState state) { | |
| 274 UpdateIconVisibility(); | 274 UpdateIconVisibility(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void PaletteTray::OnLockStateChanged(bool locked) { | 277 void PaletteTray::OnLockStateChanged(bool locked) { |
| 278 UpdateIconVisibility(); | 278 UpdateIconVisibility(); |
| 279 | 279 |
| 280 // The user can eject the stylus during the lock screen transition, which will | 280 // 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. | 281 // open the palette. Make sure to close it if that happens. |
| 282 if (locked) | 282 if (locked) |
| 283 HidePalette(); | 283 HidePalette(); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } else { | 457 } else { |
| 458 UpdateIconVisibility(); | 458 UpdateIconVisibility(); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 void PaletteTray::UpdateIconVisibility() { | 462 void PaletteTray::UpdateIconVisibility() { |
| 463 SetVisible(IsInUserSession()); | 463 SetVisible(IsInUserSession()); |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace ash | 466 } // namespace ash |
| OLD | NEW |