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

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

Issue 2795783003: 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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