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

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

Issue 2303963002: cros/ash: If the partial magnifier is active, do not consume input events if over palette views. (Closed)
Patch Set: Created 4 years, 3 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
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_utils.h" 5 #include "ash/common/system/chromeos/palette/palette_utils.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/shelf_widget.h"
9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/system/chromeos/palette/palette_tray.h"
11 #include "ash/common/system/status_area_widget.h"
12 #include "ash/common/wm_root_window_controller.h"
13 #include "ash/common/wm_shell.h"
14 #include "ash/common/wm_window.h"
8 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "ui/events/event.h"
17 #include "ui/gfx/geometry/point.h"
9 18
10 namespace ash { 19 namespace ash {
11 20
12 bool IsPaletteFeatureEnabled() { 21 bool IsPaletteFeatureEnabled() {
13 return base::CommandLine::ForCurrentProcess()->HasSwitch( 22 return base::CommandLine::ForCurrentProcess()->HasSwitch(
14 switches::kAshEnablePalette); 23 switches::kAshEnablePalette);
15 } 24 }
16 25
17 bool ArePaletteExperimentalFeaturesEnabled() { 26 bool ArePaletteExperimentalFeaturesEnabled() {
18 return base::CommandLine::ForCurrentProcess()->HasSwitch( 27 return base::CommandLine::ForCurrentProcess()->HasSwitch(
19 switches::kAshEnableExperimentalPaletteFeatures); 28 switches::kAshEnableExperimentalPaletteFeatures);
20 } 29 }
21 30
31 bool PaletteContainsEvent(ui::LocatedEvent* event) {
32 ash::WmWindow* primary = ash::WmShell::Get()->GetPrimaryRootWindow();
James Cook 2016/09/01 23:16:02 no need for ash:: in this function
jdufault 2016/09/02 20:20:38 Done.
33
34 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) {
jdufault 2016/09/01 22:31:31 Is there a better way to figure out if an event is
James Cook 2016/09/01 23:16:02 This seems reasonable to me.
35 // Convert point so that it is relative to the primary display, which is how
36 // the view screen coordinates (for PaletteTray) are setup. Normally
37 // root_location() is relative to the window that generated it.
38 gfx::Point point =
39 window->ConvertPointToTarget(primary, event->root_location());
40
41 ash::WmShelf* shelf = window->GetRootWindowController()->GetShelf();
James Cook 2016/09/01 23:16:02 WmShelf::ForWindow() is useful here, lets you skip
jdufault 2016/09/02 20:20:38 Done.
42 ash::PaletteTray* palette_tray =
43 shelf->shelf_widget()->status_area_widget()->palette_tray();
James Cook 2016/09/01 23:16:02 nit: shelf->GetStatusAreaWidget() will let you ski
jdufault 2016/09/02 20:20:38 Done.
44 if (palette_tray && palette_tray->ContainsPointInScreen(point))
45 return true;
46 }
47
48 return false;
49 }
50
22 } // namespace ash 51 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698