| 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_controller.h" | 8 #include "ash/common/session/session_controller.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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) { | 276 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) { |
| 277 if (bubble_->bubble_view() == bubble_view) | 277 if (bubble_->bubble_view() == bubble_view) |
| 278 HidePalette(); | 278 HidePalette(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() { | 281 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() { |
| 282 UpdateIconVisibility(); | 282 UpdateIconVisibility(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) { | 285 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) { |
| 286 // Device may have a stylus but it has been forcibly disabled. |
| 287 if (!palette_utils::HasStylusInput()) |
| 288 return; |
| 289 |
| 286 PaletteDelegate* palette_delegate = Shell::GetInstance()->palette_delegate(); | 290 PaletteDelegate* palette_delegate = Shell::GetInstance()->palette_delegate(); |
| 287 | 291 |
| 288 // Don't do anything if the palette should not be shown or if the user has | 292 // Don't do anything if the palette should not be shown or if the user has |
| 289 // disabled it all-together. | 293 // disabled it all-together. |
| 290 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette()) | 294 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette()) |
| 291 return; | 295 return; |
| 292 | 296 |
| 293 // Auto show/hide the palette if allowed by the user. | 297 // Auto show/hide the palette if allowed by the user. |
| 294 if (palette_delegate->ShouldAutoOpenPalette()) { | 298 if (palette_delegate->ShouldAutoOpenPalette()) { |
| 295 if (stylus_state == ui::StylusState::REMOVED && !bubble_) { | 299 if (stylus_state == ui::StylusState::REMOVED && !bubble_) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 UpdateIconVisibility(); | 427 UpdateIconVisibility(); |
| 424 } | 428 } |
| 425 } | 429 } |
| 426 | 430 |
| 427 void PaletteTray::UpdateIconVisibility() { | 431 void PaletteTray::UpdateIconVisibility() { |
| 428 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 432 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 429 IsInUserSession()); | 433 IsInUserSession()); |
| 430 } | 434 } |
| 431 | 435 |
| 432 } // namespace ash | 436 } // namespace ash |
| OLD | NEW |