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

Side by Side Diff: ui/aura/shared/compound_event_filter.h

Issue 10982040: Fix mouse lock on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 #ifndef UI_AURA_SHARED_COMPOUND_EVENT_FILTER_H_ 5 #ifndef UI_AURA_SHARED_COMPOUND_EVENT_FILTER_H_
6 #define UI_AURA_SHARED_COMPOUND_EVENT_FILTER_H_ 6 #define UI_AURA_SHARED_COMPOUND_EVENT_FILTER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "ui/aura/aura_export.h" 10 #include "ui/aura/aura_export.h"
(...skipping 22 matching lines...) Expand all
33 // rest of the filter(s) and CompoundEventFilter will not see the consumed 33 // rest of the filter(s) and CompoundEventFilter will not see the consumed
34 // event. 34 // event.
35 class AURA_EXPORT CompoundEventFilter : public EventFilter { 35 class AURA_EXPORT CompoundEventFilter : public EventFilter {
36 public: 36 public:
37 CompoundEventFilter(); 37 CompoundEventFilter();
38 virtual ~CompoundEventFilter(); 38 virtual ~CompoundEventFilter();
39 39
40 // Returns the cursor for the specified component. 40 // Returns the cursor for the specified component.
41 static gfx::NativeCursor CursorForWindowComponent(int window_component); 41 static gfx::NativeCursor CursorForWindowComponent(int window_component);
42 42
43 void set_update_cursor_visibility(bool update) {
44 update_cursor_visibility_ = update;
45 }
46
47 // Adds/removes additional event filters. This does not take ownership of 43 // Adds/removes additional event filters. This does not take ownership of
48 // the EventFilter. 44 // the EventFilter.
49 // NOTE: EventFilters are deprecated. Use env::AddPreTargetEventHandler etc. 45 // NOTE: EventFilters are deprecated. Use env::AddPreTargetEventHandler etc.
50 // instead. 46 // instead.
51 void AddFilter(EventFilter* filter); 47 void AddFilter(EventFilter* filter);
52 void RemoveFilter(EventFilter* filter); 48 void RemoveFilter(EventFilter* filter);
53 49
54 private: 50 private:
55 // Updates the cursor if the target provides a custom one, and provides 51 // Updates the cursor if the target provides a custom one, and provides
56 // default resize cursors for window edges. 52 // default resize cursors for window edges.
57 void UpdateCursor(Window* target, ui::MouseEvent* event); 53 void UpdateCursor(Window* target, ui::MouseEvent* event);
58 54
59 // Dispatches event to additional filters. 55 // Dispatches event to additional filters.
60 ui::EventResult FilterKeyEvent(ui::KeyEvent* event); 56 ui::EventResult FilterKeyEvent(ui::KeyEvent* event);
61 ui::EventResult FilterMouseEvent(ui::MouseEvent* event); 57 ui::EventResult FilterMouseEvent(ui::MouseEvent* event);
62 ui::TouchStatus FilterTouchEvent(Window* target, ui::TouchEvent* event); 58 ui::TouchStatus FilterTouchEvent(Window* target, ui::TouchEvent* event);
63 59
64 // Sets the visibility of the cursor if the event is not synthesized and 60 // Sets the visibility of the cursor if the event is not synthesized and
65 // |update_cursor_visibility_| is true. 61 // |update_cursor_visibility_| is true.
sky 2012/09/26 13:42:04 Update comment.
oshima 2012/09/26 15:18:00 Done.
66 void SetCursorVisibilityOnEvent(aura::Window* target, 62 void SetCursorVisibilityOnEvent(aura::Window* target,
67 ui::Event* event, 63 ui::Event* event,
68 bool show); 64 bool show);
69 65
70 // Overridden from EventFilter: 66 // Overridden from EventFilter:
71 virtual ui::TouchStatus PreHandleTouchEvent(Window* target, 67 virtual ui::TouchStatus PreHandleTouchEvent(Window* target,
72 ui::TouchEvent* event) OVERRIDE; 68 ui::TouchEvent* event) OVERRIDE;
73 69
74 // Overridden from ui::EventHandler: 70 // Overridden from ui::EventHandler:
75 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; 71 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
76 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 72 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
77 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; 73 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
78 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 74 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
79 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 75 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
80 // Additional event filters that pre-handles events. 76 // Additional event filters that pre-handles events.
81 ObserverList<EventFilter, true> filters_; 77 ObserverList<EventFilter, true> filters_;
82 78
83 // Should we show the mouse cursor when we see mouse movement and hide it when 79 // True if the cursur was hidden by the filter.
84 // we see a touch event? 80 bool cursor_hidden_by_filter_;
85 bool update_cursor_visibility_;
86 81
87 DISALLOW_COPY_AND_ASSIGN(CompoundEventFilter); 82 DISALLOW_COPY_AND_ASSIGN(CompoundEventFilter);
88 }; 83 };
89 84
90 } // namespace shared 85 } // namespace shared
91 } // namespace aura 86 } // namespace aura
92 87
93 #endif // UI_AURA_COMPOUND_EVENT_FILTER_H_ 88 #endif // UI_AURA_COMPOUND_EVENT_FILTER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/aura/shared/compound_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698