| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) { | 282 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) { |
| 283 if (bubble_->bubble_view() == bubble_view) | 283 if (bubble_->bubble_view() == bubble_view) |
| 284 HidePalette(); | 284 HidePalette(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() { | 287 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() { |
| 288 UpdateIconVisibility(); | 288 UpdateIconVisibility(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) { | 291 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) { |
| 292 // Device may have a stylus but it has been forcibly disabled. |
| 293 if (!palette_utils::HasStylusInput()) |
| 294 return; |
| 295 |
| 292 PaletteDelegate* palette_delegate = WmShell::Get()->palette_delegate(); | 296 PaletteDelegate* palette_delegate = WmShell::Get()->palette_delegate(); |
| 293 | 297 |
| 294 // Don't do anything if the palette should not be shown or if the user has | 298 // Don't do anything if the palette should not be shown or if the user has |
| 295 // disabled it all-together. | 299 // disabled it all-together. |
| 296 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette()) | 300 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette()) |
| 297 return; | 301 return; |
| 298 | 302 |
| 299 // Auto show/hide the palette if allowed by the user. | 303 // Auto show/hide the palette if allowed by the user. |
| 300 if (palette_delegate->ShouldAutoOpenPalette()) { | 304 if (palette_delegate->ShouldAutoOpenPalette()) { |
| 301 if (stylus_state == ui::StylusState::REMOVED && !bubble_) { | 305 if (stylus_state == ui::StylusState::REMOVED && !bubble_) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 UpdateIconVisibility(); | 434 UpdateIconVisibility(); |
| 431 } | 435 } |
| 432 } | 436 } |
| 433 | 437 |
| 434 void PaletteTray::UpdateIconVisibility() { | 438 void PaletteTray::UpdateIconVisibility() { |
| 435 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 439 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 436 IsInUserSession()); | 440 IsInUserSession()); |
| 437 } | 441 } |
| 438 | 442 |
| 439 } // namespace ash | 443 } // namespace ash |
| OLD | NEW |