| 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/system/palette/palette_tray.h" | 5 #include "ash/system/palette/palette_tray.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/resources/grit/ash_resources.h" | 8 #include "ash/resources/grit/ash_resources.h" |
| 9 #include "ash/resources/vector_icons/vector_icons.h" | 9 #include "ash/resources/vector_icons/vector_icons.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
| 12 #include "ash/shelf/shelf_constants.h" | 12 #include "ash/shelf/shelf_constants.h" |
| 13 #include "ash/shelf/wm_shelf.h" | 13 #include "ash/shelf/wm_shelf.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
| 16 #include "ash/system/palette/palette_tool_manager.h" | 16 #include "ash/system/palette/palette_tool_manager.h" |
| 17 #include "ash/system/palette/palette_utils.h" | 17 #include "ash/system/palette/palette_utils.h" |
| 18 #include "ash/system/tray/system_menu_button.h" | 18 #include "ash/system/tray/system_menu_button.h" |
| 19 #include "ash/system/tray/system_tray_controller.h" | 19 #include "ash/system/tray/system_tray_controller.h" |
| 20 #include "ash/system/tray/system_tray_delegate.h" | |
| 21 #include "ash/system/tray/tray_bubble_wrapper.h" | 20 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 22 #include "ash/system/tray/tray_constants.h" | 21 #include "ash/system/tray/tray_constants.h" |
| 23 #include "ash/system/tray/tray_container.h" | 22 #include "ash/system/tray/tray_container.h" |
| 24 #include "ash/system/tray/tray_popup_header_button.h" | 23 #include "ash/system/tray/tray_popup_header_button.h" |
| 25 #include "ash/system/tray/tray_popup_item_style.h" | 24 #include "ash/system/tray/tray_popup_item_style.h" |
| 26 #include "ash/wm_window.h" | 25 #include "ash/wm_window.h" |
| 27 #include "base/metrics/histogram_macros.h" | 26 #include "base/metrics/histogram_macros.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/events/devices/input_device_manager.h" | 29 #include "ui/events/devices/input_device_manager.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 | 57 |
| 59 // Color of the separator. | 58 // Color of the separator. |
| 60 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); | 59 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); |
| 61 | 60 |
| 62 // Returns true if we are in a user session that can show the stylus tools. | 61 // Returns true if we are in a user session that can show the stylus tools. |
| 63 bool IsInUserSession() { | 62 bool IsInUserSession() { |
| 64 SessionController* session_controller = Shell::Get()->session_controller(); | 63 SessionController* session_controller = Shell::Get()->session_controller(); |
| 65 return !session_controller->IsUserSessionBlocked() && | 64 return !session_controller->IsUserSessionBlocked() && |
| 66 session_controller->GetSessionState() == | 65 session_controller->GetSessionState() == |
| 67 session_manager::SessionState::ACTIVE && | 66 session_manager::SessionState::ACTIVE && |
| 68 Shell::Get()->system_tray_delegate()->GetUserLoginStatus() != | 67 !session_controller->IsKioskSession(); |
| 69 LoginStatus::KIOSK_APP; | |
| 70 } | 68 } |
| 71 | 69 |
| 72 class TitleView : public views::View, public views::ButtonListener { | 70 class TitleView : public views::View, public views::ButtonListener { |
| 73 public: | 71 public: |
| 74 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { | 72 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { |
| 75 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. | 73 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. |
| 76 // See crbug.com/614453. | 74 // See crbug.com/614453. |
| 77 auto* box_layout = | 75 auto* box_layout = |
| 78 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 76 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
| 79 SetLayoutManager(box_layout); | 77 SetLayoutManager(box_layout); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 UpdateIconVisibility(); | 385 UpdateIconVisibility(); |
| 388 } | 386 } |
| 389 } | 387 } |
| 390 | 388 |
| 391 void PaletteTray::UpdateIconVisibility() { | 389 void PaletteTray::UpdateIconVisibility() { |
| 392 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 390 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 393 IsInUserSession()); | 391 IsInUserSession()); |
| 394 } | 392 } |
| 395 | 393 |
| 396 } // namespace ash | 394 } // namespace ash |
| OLD | NEW |