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 "ui/aura/env_observer.h" | 7 #include "ui/aura/env_observer.h" |
8 #include "ui/aura/input_state_lookup.h" | 8 #include "ui/aura/input_state_lookup.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
sky
2014/05/08 22:37:13
If you can, remove this include.
piman
2014/05/08 22:48:34
Done.
| |
10 #include "ui/events/event_target_iterator.h" | 10 #include "ui/events/event_target_iterator.h" |
11 #include "ui/events/platform/platform_event_source.h" | 11 #include "ui/events/platform/platform_event_source.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 | 14 |
15 // static | 15 // static |
16 Env* Env::instance_ = NULL; | 16 Env* Env::instance_ = NULL; |
17 | 17 |
18 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
19 // Env, public: | 19 // Env, public: |
20 | 20 |
21 Env::Env() | 21 Env::Env() |
22 : mouse_button_flags_(0), | 22 : mouse_button_flags_(0), |
23 is_touch_down_(false), | 23 is_touch_down_(false), |
24 input_state_lookup_(InputStateLookup::Create().Pass()) { | 24 input_state_lookup_(InputStateLookup::Create().Pass()) { |
25 } | 25 } |
26 | 26 |
27 Env::~Env() { | 27 Env::~Env() { |
28 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); | 28 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); |
29 | |
30 ui::Compositor::Terminate(); | |
31 } | 29 } |
32 | 30 |
33 //static | 31 //static |
34 void Env::CreateInstance(bool create_event_source) { | 32 void Env::CreateInstance(bool create_event_source) { |
35 if (!instance_) { | 33 if (!instance_) { |
36 instance_ = new Env; | 34 instance_ = new Env; |
37 instance_->Init(create_event_source); | 35 instance_->Init(create_event_source); |
38 } | 36 } |
39 } | 37 } |
40 | 38 |
(...skipping 20 matching lines...) Expand all Loading... | |
61 | 59 |
62 bool Env::IsMouseButtonDown() const { | 60 bool Env::IsMouseButtonDown() const { |
63 return input_state_lookup_.get() ? input_state_lookup_->IsMouseButtonDown() : | 61 return input_state_lookup_.get() ? input_state_lookup_->IsMouseButtonDown() : |
64 mouse_button_flags_ != 0; | 62 mouse_button_flags_ != 0; |
65 } | 63 } |
66 | 64 |
67 //////////////////////////////////////////////////////////////////////////////// | 65 //////////////////////////////////////////////////////////////////////////////// |
68 // Env, private: | 66 // Env, private: |
69 | 67 |
70 void Env::Init(bool create_event_source) { | 68 void Env::Init(bool create_event_source) { |
71 ui::Compositor::Initialize(); | |
72 | |
73 if (create_event_source && !ui::PlatformEventSource::GetInstance()) | 69 if (create_event_source && !ui::PlatformEventSource::GetInstance()) |
74 event_source_ = ui::PlatformEventSource::CreateDefault(); | 70 event_source_ = ui::PlatformEventSource::CreateDefault(); |
75 } | 71 } |
76 | 72 |
77 void Env::NotifyWindowInitialized(Window* window) { | 73 void Env::NotifyWindowInitialized(Window* window) { |
78 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); | 74 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); |
79 } | 75 } |
80 | 76 |
81 void Env::NotifyHostInitialized(WindowTreeHost* host) { | 77 void Env::NotifyHostInitialized(WindowTreeHost* host) { |
82 FOR_EACH_OBSERVER(EnvObserver, observers_, OnHostInitialized(host)); | 78 FOR_EACH_OBSERVER(EnvObserver, observers_, OnHostInitialized(host)); |
(...skipping 17 matching lines...) Expand all Loading... | |
100 scoped_ptr<ui::EventTargetIterator> Env::GetChildIterator() const { | 96 scoped_ptr<ui::EventTargetIterator> Env::GetChildIterator() const { |
101 return scoped_ptr<ui::EventTargetIterator>(); | 97 return scoped_ptr<ui::EventTargetIterator>(); |
102 } | 98 } |
103 | 99 |
104 ui::EventTargeter* Env::GetEventTargeter() { | 100 ui::EventTargeter* Env::GetEventTargeter() { |
105 NOTREACHED(); | 101 NOTREACHED(); |
106 return NULL; | 102 return NULL; |
107 } | 103 } |
108 | 104 |
109 } // namespace aura | 105 } // namespace aura |
OLD | NEW |