Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: ash/common/system/chromeos/palette/palette_tray.cc

Issue 2786433002: cros: Force disable stylus features on pyro. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/common/system/chromeos/palette/palette_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) { 294 void PaletteTray::HideBubbleWithView(const views::TrayBubbleView* bubble_view) {
295 if (bubble_->bubble_view() == bubble_view) 295 if (bubble_->bubble_view() == bubble_view)
296 HidePalette(); 296 HidePalette();
297 } 297 }
298 298
299 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() { 299 void PaletteTray::OnTouchscreenDeviceConfigurationChanged() {
300 UpdateIconVisibility(); 300 UpdateIconVisibility();
301 } 301 }
302 302
303 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) { 303 void PaletteTray::OnStylusStateChanged(ui::StylusState stylus_state) {
304 // Device may have a stylus but it has been forcibly disabled.
305 if (!palette_utils::HasStylusInput())
306 return;
307
304 PaletteDelegate* palette_delegate = WmShell::Get()->palette_delegate(); 308 PaletteDelegate* palette_delegate = WmShell::Get()->palette_delegate();
305 309
306 // Don't do anything if the palette should not be shown or if the user has 310 // Don't do anything if the palette should not be shown or if the user has
307 // disabled it all-together. 311 // disabled it all-together.
308 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette()) 312 if (!IsInUserSession() || !palette_delegate->ShouldShowPalette())
309 return; 313 return;
310 314
311 // Auto show/hide the palette if allowed by the user. 315 // Auto show/hide the palette if allowed by the user.
312 if (palette_delegate->ShouldAutoOpenPalette()) { 316 if (palette_delegate->ShouldAutoOpenPalette()) {
313 if (stylus_state == ui::StylusState::REMOVED && !bubble_) { 317 if (stylus_state == ui::StylusState::REMOVED && !bubble_) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 UpdateIconVisibility(); 446 UpdateIconVisibility();
443 } 447 }
444 } 448 }
445 449
446 void PaletteTray::UpdateIconVisibility() { 450 void PaletteTray::UpdateIconVisibility() {
447 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 451 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
448 IsInUserSession()); 452 IsInUserSession());
449 } 453 }
450 454
451 } // namespace ash 455 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/chromeos/palette/palette_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698