OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/surface.h" | 5 #include "components/exo/surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 private: | 138 private: |
139 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter); | 139 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace | 142 } // namespace |
143 | 143 |
144 //////////////////////////////////////////////////////////////////////////////// | 144 //////////////////////////////////////////////////////////////////////////////// |
145 // Surface, public: | 145 // Surface, public: |
146 | 146 |
| 147 // TODO(fsamuel): exo should not use context_factory_private. Instead, we should |
| 148 // request a CompositorFrameSink from the aura::Window. Setting up the |
| 149 // BeginFrame hierarchy should be an internal implementation detail of aura or |
| 150 // mus in aura-mus. |
147 Surface::Surface() | 151 Surface::Surface() |
148 : window_(new aura::Window(new CustomWindowDelegate(this))), | 152 : window_(new aura::Window(new CustomWindowDelegate(this))), |
149 frame_sink_id_( | 153 frame_sink_id_(aura::Env::GetInstance() |
150 aura::Env::GetInstance()->context_factory()->AllocateFrameSinkId()) { | 154 ->context_factory_private() |
| 155 ->AllocateFrameSinkId()) { |
151 cc::mojom::MojoCompositorFrameSinkClientPtr frame_sink_holder_ptr; | 156 cc::mojom::MojoCompositorFrameSinkClientPtr frame_sink_holder_ptr; |
152 cc::mojom::MojoCompositorFrameSinkClientRequest frame_sink_client_request = | 157 cc::mojom::MojoCompositorFrameSinkClientRequest frame_sink_client_request = |
153 mojo::GetProxy(&frame_sink_holder_ptr); | 158 mojo::GetProxy(&frame_sink_holder_ptr); |
154 std::unique_ptr<CompositorFrameSink> frame_sink(new CompositorFrameSink( | 159 std::unique_ptr<CompositorFrameSink> frame_sink(new CompositorFrameSink( |
155 frame_sink_id_, | 160 frame_sink_id_, |
156 aura::Env::GetInstance()->context_factory()->GetSurfaceManager(), | 161 aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager(), |
157 std::move(frame_sink_holder_ptr))); | 162 std::move(frame_sink_holder_ptr))); |
158 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( | 163 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( |
159 this, std::move(frame_sink), std::move(frame_sink_client_request)); | 164 this, std::move(frame_sink), std::move(frame_sink_client_request)); |
160 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 165 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
161 window_->SetName("ExoSurface"); | 166 window_->SetName("ExoSurface"); |
162 window_->SetProperty(kSurfaceKey, this); | 167 window_->SetProperty(kSurfaceKey, this); |
163 window_->Init(ui::LAYER_SOLID_COLOR); | 168 window_->Init(ui::LAYER_SOLID_COLOR); |
164 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 169 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
165 window_->set_owned_by_parent(false); | 170 window_->set_owned_by_parent(false); |
166 window_->AddObserver(this); | 171 window_->AddObserver(this); |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 770 |
766 int64_t Surface::GetPropertyInternal(const void* key, | 771 int64_t Surface::GetPropertyInternal(const void* key, |
767 int64_t default_value) const { | 772 int64_t default_value) const { |
768 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 773 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
769 if (iter == prop_map_.end()) | 774 if (iter == prop_map_.end()) |
770 return default_value; | 775 return default_value; |
771 return iter->second.value; | 776 return iter->second.value; |
772 } | 777 } |
773 | 778 |
774 } // namespace exo | 779 } // namespace exo |
OLD | NEW |