| 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/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Color of the separator. | 61 // Color of the separator. |
| 62 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); | 62 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); |
| 63 | 63 |
| 64 // Returns true if we are in a user session that can show the stylus tools. | 64 // Returns true if we are in a user session that can show the stylus tools. |
| 65 bool IsInUserSession() { | 65 bool IsInUserSession() { |
| 66 SessionStateDelegate* session_state_delegate = | 66 SessionStateDelegate* session_state_delegate = |
| 67 WmShell::Get()->GetSessionStateDelegate(); | 67 WmShell::Get()->GetSessionStateDelegate(); |
| 68 return !session_state_delegate->IsUserSessionBlocked() && | 68 return !session_state_delegate->IsUserSessionBlocked() && |
| 69 session_state_delegate->GetSessionState() == | 69 session_state_delegate->GetSessionState() == |
| 70 session_manager::SessionState::ACTIVE && | 70 session_manager::SessionState::ACTIVE && |
| 71 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != | 71 Shell::Get()->system_tray_delegate()->GetUserLoginStatus() != |
| 72 LoginStatus::KIOSK_APP; | 72 LoginStatus::KIOSK_APP; |
| 73 } | 73 } |
| 74 | 74 |
| 75 class TitleView : public views::View, public views::ButtonListener { | 75 class TitleView : public views::View, public views::ButtonListener { |
| 76 public: | 76 public: |
| 77 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { | 77 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { |
| 78 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. | 78 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. |
| 79 // See crbug.com/614453. | 79 // See crbug.com/614453. |
| 80 auto* box_layout = | 80 auto* box_layout = |
| 81 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 81 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 ~TitleView() override {} | 121 ~TitleView() override {} |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 // views::ButtonListener: | 124 // views::ButtonListener: |
| 125 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 125 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| 126 if (sender == settings_button_) { | 126 if (sender == settings_button_) { |
| 127 palette_tray_->RecordPaletteOptionsUsage( | 127 palette_tray_->RecordPaletteOptionsUsage( |
| 128 PaletteTrayOptions::PALETTE_SETTINGS_BUTTON); | 128 PaletteTrayOptions::PALETTE_SETTINGS_BUTTON); |
| 129 WmShell::Get()->system_tray_controller()->ShowPaletteSettings(); | 129 Shell::Get()->system_tray_controller()->ShowPaletteSettings(); |
| 130 palette_tray_->HidePalette(); | 130 palette_tray_->HidePalette(); |
| 131 } else if (sender == help_button_) { | 131 } else if (sender == help_button_) { |
| 132 palette_tray_->RecordPaletteOptionsUsage( | 132 palette_tray_->RecordPaletteOptionsUsage( |
| 133 PaletteTrayOptions::PALETTE_HELP_BUTTON); | 133 PaletteTrayOptions::PALETTE_HELP_BUTTON); |
| 134 WmShell::Get()->system_tray_controller()->ShowPaletteHelp(); | 134 Shell::Get()->system_tray_controller()->ShowPaletteHelp(); |
| 135 palette_tray_->HidePalette(); | 135 palette_tray_->HidePalette(); |
| 136 } else { | 136 } else { |
| 137 NOTREACHED(); | 137 NOTREACHED(); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 // Unowned pointers to button views so we can determine which button was | 141 // Unowned pointers to button views so we can determine which button was |
| 142 // clicked. | 142 // clicked. |
| 143 views::View* settings_button_; | 143 views::View* settings_button_; |
| 144 views::View* help_button_; | 144 views::View* help_button_; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 UpdateIconVisibility(); | 424 UpdateIconVisibility(); |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 void PaletteTray::UpdateIconVisibility() { | 428 void PaletteTray::UpdateIconVisibility() { |
| 429 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 429 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 430 IsInUserSession()); | 430 IsInUserSession()); |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace ash | 433 } // namespace ash |
| OLD | NEW |