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

Side by Side Diff: ash/magnifier/partial_magnification_controller.cc

Issue 2311393004: Laser tool blocks events from propagating. (Closed)
Patch Set: Fixed patch set 2 errors. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/magnifier/partial_magnification_controller.h" 5 #include "ash/magnifier/partial_magnification_controller.h"
6 6
7 #include "ash/common/system/chromeos/palette/palette_utils.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
9 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
10 #include "ui/compositor/layer.h" 11 #include "ui/compositor/layer.h"
11 #include "ui/compositor/paint_recorder.h" 12 #include "ui/compositor/paint_recorder.h"
12 #include "ui/events/event.h" 13 #include "ui/events/event.h"
13 #include "ui/events/event_constants.h" 14 #include "ui/events/event_constants.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 #include "ui/wm/core/coordinate_conversion.h" 16 #include "ui/wm/core/coordinate_conversion.h"
16 17
17 #if defined(OS_CHROMEOS)
18 #include "ash/common/system/chromeos/palette/palette_utils.h"
19 #endif
20
21 namespace ash { 18 namespace ash {
22 namespace { 19 namespace {
23 20
24 // Ratio of magnifier scale. 21 // Ratio of magnifier scale.
25 const float kMagnificationScale = 2.f; 22 const float kMagnificationScale = 2.f;
26 // Radius of the magnifying glass in DIP. 23 // Radius of the magnifying glass in DIP.
27 const int kMagnifierRadius = 200; 24 const int kMagnifierRadius = 200;
28 // Size of the border around the magnifying glass in DIP. 25 // Size of the border around the magnifying glass in DIP.
29 const int kBorderSize = 10; 26 const int kBorderSize = 10;
30 // Inset on the zoom filter. 27 // Inset on the zoom filter.
(...skipping 22 matching lines...) Expand all
53 for (aura::Window* root_window : root_windows) { 50 for (aura::Window* root_window : root_windows) {
54 if (root_window->ContainsPointInRoot( 51 if (root_window->ContainsPointInRoot(
55 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot())) 52 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()))
56 return root_window; 53 return root_window;
57 } 54 }
58 return nullptr; 55 return nullptr;
59 } 56 }
60 57
61 // Returns true if the event should be processed normally, ie, the stylus is 58 // Returns true if the event should be processed normally, ie, the stylus is
62 // over the palette icon or widget. 59 // over the palette icon or widget.
63 bool ShouldSkipEventFiltering(const gfx::Point& point) { 60 bool ShouldSkipEventFiltering(const gfx::Point& point) {
James Cook 2016/09/14 22:53:38 you can eliminate this function too
sammiequon 2016/09/16 17:35:26 Done.
64 #if defined(OS_CHROMEOS)
65 return PaletteContainsPointInScreen(point); 61 return PaletteContainsPointInScreen(point);
66 #else
67 return false;
68 #endif
69 } 62 }
70 63
71 } // namespace 64 } // namespace
72 65
73 // The content mask provides a clipping layer for the magnification window so we 66 // The content mask provides a clipping layer for the magnification window so we
74 // can show a circular magnifier. 67 // can show a circular magnifier.
75 class PartialMagnificationController::ContentMask : public ui::LayerDelegate { 68 class PartialMagnificationController::ContentMask : public ui::LayerDelegate {
76 public: 69 public:
77 // If |stroke| is true, the circle will be a stroke. This is useful if we wish 70 // If |stroke| is true, the circle will be a stroke. This is useful if we wish
78 // to clip a border. 71 // to clip a border.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 279
287 void PartialMagnificationController::RemoveZoomWidgetObservers() { 280 void PartialMagnificationController::RemoveZoomWidgetObservers() {
288 DCHECK(host_widget_); 281 DCHECK(host_widget_);
289 host_widget_->RemoveObserver(this); 282 host_widget_->RemoveObserver(this);
290 aura::Window* root_window = host_widget_->GetNativeView()->GetRootWindow(); 283 aura::Window* root_window = host_widget_->GetNativeView()->GetRootWindow();
291 DCHECK(root_window); 284 DCHECK(root_window);
292 root_window->RemoveObserver(this); 285 root_window->RemoveObserver(this);
293 } 286 }
294 287
295 } // namespace ash 288 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698