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 #include "ui/aura/env.h" | 5 #include "ui/aura/env.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
9 #include "ui/aura/env_observer.h" | 9 #include "ui/aura/env_observer.h" |
10 #include "ui/aura/input_state_lookup.h" | 10 #include "ui/aura/input_state_lookup.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 void Env::RemoveObserver(EnvObserver* observer) { | 54 void Env::RemoveObserver(EnvObserver* observer) { |
55 observers_.RemoveObserver(observer); | 55 observers_.RemoveObserver(observer); |
56 } | 56 } |
57 | 57 |
58 bool Env::IsMouseButtonDown() const { | 58 bool Env::IsMouseButtonDown() const { |
59 return input_state_lookup_.get() ? input_state_lookup_->IsMouseButtonDown() : | 59 return input_state_lookup_.get() ? input_state_lookup_->IsMouseButtonDown() : |
60 mouse_button_flags_ != 0; | 60 mouse_button_flags_ != 0; |
61 } | 61 } |
62 | 62 |
| 63 void Env::SetLastMouseLocation(const gfx::Point& last_mouse_location) { |
| 64 if (last_mouse_location_ != last_mouse_location) |
| 65 mouse_moved_ = true; |
| 66 |
| 67 last_mouse_location_ = last_mouse_location; |
| 68 } |
| 69 |
63 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
64 // Env, private: | 71 // Env, private: |
65 | 72 |
66 Env::Env() | 73 Env::Env() |
67 : mouse_button_flags_(0), | 74 : mouse_moved_(false), |
| 75 mouse_button_flags_(0), |
68 is_touch_down_(false), | 76 is_touch_down_(false), |
69 input_state_lookup_(InputStateLookup::Create().Pass()), | 77 input_state_lookup_(InputStateLookup::Create().Pass()), |
70 context_factory_(NULL) { | 78 context_factory_(NULL) { |
71 DCHECK(lazy_tls_ptr.Pointer()->Get() == NULL); | 79 DCHECK(lazy_tls_ptr.Pointer()->Get() == NULL); |
72 lazy_tls_ptr.Pointer()->Set(this); | 80 lazy_tls_ptr.Pointer()->Set(this); |
73 } | 81 } |
74 | 82 |
75 Env::~Env() { | 83 Env::~Env() { |
76 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); | 84 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); |
77 DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get()); | 85 DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 scoped_ptr<ui::EventTargetIterator> Env::GetChildIterator() const { | 122 scoped_ptr<ui::EventTargetIterator> Env::GetChildIterator() const { |
115 return nullptr; | 123 return nullptr; |
116 } | 124 } |
117 | 125 |
118 ui::EventTargeter* Env::GetEventTargeter() { | 126 ui::EventTargeter* Env::GetEventTargeter() { |
119 NOTREACHED(); | 127 NOTREACHED(); |
120 return NULL; | 128 return NULL; |
121 } | 129 } |
122 | 130 |
123 } // namespace aura | 131 } // namespace aura |
OLD | NEW |