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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), | 203 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), |
204 factory_owner_(new SurfaceFactoryOwner) { | 204 factory_owner_(new SurfaceFactoryOwner) { |
205 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 205 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
206 window_->SetName("ExoSurface"); | 206 window_->SetName("ExoSurface"); |
207 window_->SetProperty(kSurfaceKey, this); | 207 window_->SetProperty(kSurfaceKey, this); |
208 window_->Init(ui::LAYER_SOLID_COLOR); | 208 window_->Init(ui::LAYER_SOLID_COLOR); |
209 window_->set_layer_owner_delegate(this); | 209 window_->set_layer_owner_delegate(this); |
210 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 210 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
211 window_->set_owned_by_parent(false); | 211 window_->set_owned_by_parent(false); |
212 factory_owner_->surface_ = this; | 212 factory_owner_->surface_ = this; |
213 factory_owner_->id_allocator_ = | 213 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator( |
214 aura::Env::GetInstance()->context_factory()->CreateSurfaceIdAllocator(); | 214 aura::Env::GetInstance()->context_factory()->AllocateSurfaceClientId())); |
215 factory_owner_->surface_factory_.reset( | 215 factory_owner_->surface_factory_.reset( |
216 new cc::SurfaceFactory(surface_manager_, factory_owner_.get())); | 216 new cc::SurfaceFactory(surface_manager_, factory_owner_.get())); |
217 aura::Env::GetInstance()->context_factory()->AddObserver(this); | 217 aura::Env::GetInstance()->context_factory()->AddObserver(this); |
218 } | 218 } |
219 | 219 |
220 Surface::~Surface() { | 220 Surface::~Surface() { |
221 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); | 221 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); |
222 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this)); | 222 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this)); |
223 | 223 |
224 window_->layer()->SetShowSolidColorContent(); | 224 window_->layer()->SetShowSolidColorContent(); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 836 |
837 int64_t Surface::GetPropertyInternal(const void* key, | 837 int64_t Surface::GetPropertyInternal(const void* key, |
838 int64_t default_value) const { | 838 int64_t default_value) const { |
839 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 839 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
840 if (iter == prop_map_.end()) | 840 if (iter == prop_map_.end()) |
841 return default_value; | 841 return default_value; |
842 return iter->second.value; | 842 return iter->second.value; |
843 } | 843 } |
844 | 844 |
845 } // namespace exo | 845 } // namespace exo |
OLD | NEW |