| OLD | NEW |
| 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_ENV_H_ | 5 #ifndef UI_AURA_ENV_H_ |
| 6 #define UI_AURA_ENV_H_ | 6 #define UI_AURA_ENV_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // |create_event_source| is true a PlatformEventSource is created. | 35 // |create_event_source| is true a PlatformEventSource is created. |
| 36 // TODO(sky): nuke |create_event_source|. Only necessary while mojo's | 36 // TODO(sky): nuke |create_event_source|. Only necessary while mojo's |
| 37 // nativeviewportservice lives in the same process as the viewmanager. | 37 // nativeviewportservice lives in the same process as the viewmanager. |
| 38 static void CreateInstance(bool create_event_source); | 38 static void CreateInstance(bool create_event_source); |
| 39 static Env* GetInstance(); | 39 static Env* GetInstance(); |
| 40 static void DeleteInstance(); | 40 static void DeleteInstance(); |
| 41 | 41 |
| 42 void AddObserver(EnvObserver* observer); | 42 void AddObserver(EnvObserver* observer); |
| 43 void RemoveObserver(EnvObserver* observer); | 43 void RemoveObserver(EnvObserver* observer); |
| 44 | 44 |
| 45 bool mouse_moved() const { return mouse_moved_; } |
| 46 |
| 45 int mouse_button_flags() const { return mouse_button_flags_; } | 47 int mouse_button_flags() const { return mouse_button_flags_; } |
| 46 void set_mouse_button_flags(int mouse_button_flags) { | 48 void set_mouse_button_flags(int mouse_button_flags) { |
| 47 mouse_button_flags_ = mouse_button_flags; | 49 mouse_button_flags_ = mouse_button_flags; |
| 48 } | 50 } |
| 49 // Returns true if a mouse button is down. This may query the native OS, | 51 // Returns true if a mouse button is down. This may query the native OS, |
| 50 // otherwise it uses |mouse_button_flags_|. | 52 // otherwise it uses |mouse_button_flags_|. |
| 51 bool IsMouseButtonDown() const; | 53 bool IsMouseButtonDown() const; |
| 52 | 54 |
| 53 // Gets/sets the last mouse location seen in a mouse event in the screen | 55 // Gets/sets the last mouse location seen in a mouse event in the screen |
| 54 // coordinates. | 56 // coordinates. |
| 55 const gfx::Point& last_mouse_location() const { return last_mouse_location_; } | 57 const gfx::Point& last_mouse_location() const { return last_mouse_location_; } |
| 56 void set_last_mouse_location(const gfx::Point& last_mouse_location) { | 58 void SetLastMouseLocation(const gfx::Point& last_mouse_location); |
| 57 last_mouse_location_ = last_mouse_location; | |
| 58 } | |
| 59 | 59 |
| 60 // Whether any touch device is currently down. | 60 // Whether any touch device is currently down. |
| 61 bool is_touch_down() const { return is_touch_down_; } | 61 bool is_touch_down() const { return is_touch_down_; } |
| 62 void set_touch_down(bool value) { is_touch_down_ = value; } | 62 void set_touch_down(bool value) { is_touch_down_ = value; } |
| 63 | 63 |
| 64 void set_context_factory(ui::ContextFactory* context_factory) { | 64 void set_context_factory(ui::ContextFactory* context_factory) { |
| 65 context_factory_ = context_factory; | 65 context_factory_ = context_factory; |
| 66 } | 66 } |
| 67 ui::ContextFactory* context_factory() { return context_factory_; } | 67 ui::ContextFactory* context_factory() { return context_factory_; } |
| 68 | 68 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 87 void NotifyHostActivated(WindowTreeHost* host); | 87 void NotifyHostActivated(WindowTreeHost* host); |
| 88 | 88 |
| 89 // Overridden from ui::EventTarget: | 89 // Overridden from ui::EventTarget: |
| 90 bool CanAcceptEvent(const ui::Event& event) override; | 90 bool CanAcceptEvent(const ui::Event& event) override; |
| 91 ui::EventTarget* GetParentTarget() override; | 91 ui::EventTarget* GetParentTarget() override; |
| 92 scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; | 92 scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| 93 ui::EventTargeter* GetEventTargeter() override; | 93 ui::EventTargeter* GetEventTargeter() override; |
| 94 | 94 |
| 95 ObserverList<EnvObserver> observers_; | 95 ObserverList<EnvObserver> observers_; |
| 96 | 96 |
| 97 // Whether the mouse was moved from its initial location. |
| 98 bool mouse_moved_; |
| 99 |
| 97 int mouse_button_flags_; | 100 int mouse_button_flags_; |
| 98 // Location of last mouse event, in screen coordinates. | 101 // Location of last mouse event, in screen coordinates. |
| 99 gfx::Point last_mouse_location_; | 102 gfx::Point last_mouse_location_; |
| 100 bool is_touch_down_; | 103 bool is_touch_down_; |
| 101 | 104 |
| 102 scoped_ptr<InputStateLookup> input_state_lookup_; | 105 scoped_ptr<InputStateLookup> input_state_lookup_; |
| 103 scoped_ptr<ui::PlatformEventSource> event_source_; | 106 scoped_ptr<ui::PlatformEventSource> event_source_; |
| 104 | 107 |
| 105 ui::ContextFactory* context_factory_; | 108 ui::ContextFactory* context_factory_; |
| 106 | 109 |
| 107 DISALLOW_COPY_AND_ASSIGN(Env); | 110 DISALLOW_COPY_AND_ASSIGN(Env); |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 } // namespace aura | 113 } // namespace aura |
| 111 | 114 |
| 112 #endif // UI_AURA_ENV_H_ | 115 #endif // UI_AURA_ENV_H_ |
| OLD | NEW |