Chromium Code Reviews| 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/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 user_data_(NULL), | 195 user_data_(NULL), |
| 196 ignore_events_(false), | 196 ignore_events_(false), |
| 197 // Don't notify newly added observers during notification. This causes | 197 // Don't notify newly added observers during notification. This causes |
| 198 // problems for code that adds an observer as part of an observer | 198 // problems for code that adds an observer as part of an observer |
| 199 // notification (such as the workspace code). | 199 // notification (such as the workspace code). |
| 200 observers_(ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY) { | 200 observers_(ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY) { |
| 201 set_target_handler(delegate_); | 201 set_target_handler(delegate_); |
| 202 } | 202 } |
| 203 | 203 |
| 204 Window::~Window() { | 204 Window::~Window() { |
| 205 if (layer()->owner() == this) | 205 if (layer()) { |
|
danakj
2015/06/03 22:02:50
Not having a layer means you made a Window but did
| |
| 206 layer()->CompleteAllAnimations(); | 206 if (layer()->owner() == this) |
| 207 layer()->SuppressPaint(); | 207 layer()->CompleteAllAnimations(); |
| 208 layer()->SuppressPaint(); | |
| 209 } | |
| 208 | 210 |
| 209 // Let the delegate know we're in the processing of destroying. | 211 // Let the delegate know we're in the processing of destroying. |
| 210 if (delegate_) | 212 if (delegate_) |
| 211 delegate_->OnWindowDestroying(this); | 213 delegate_->OnWindowDestroying(this); |
| 212 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); | 214 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); |
| 213 | 215 |
| 214 // While we are being destroyed, our target handler may also be in the | 216 // While we are being destroyed, our target handler may also be in the |
| 215 // process of destruction or already destroyed, so do not forward any | 217 // process of destruction or already destroyed, so do not forward any |
| 216 // input events at the ui::EP_TARGET phase. | 218 // input events at the ui::EP_TARGET phase. |
| 217 set_target_handler(nullptr); | 219 set_target_handler(nullptr); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 255 |
| 254 // Clear properties. | 256 // Clear properties. |
| 255 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); | 257 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); |
| 256 iter != prop_map_.end(); | 258 iter != prop_map_.end(); |
| 257 ++iter) { | 259 ++iter) { |
| 258 if (iter->second.deallocator) | 260 if (iter->second.deallocator) |
| 259 (*iter->second.deallocator)(iter->second.value); | 261 (*iter->second.deallocator)(iter->second.value); |
| 260 } | 262 } |
| 261 prop_map_.clear(); | 263 prop_map_.clear(); |
| 262 | 264 |
| 263 // The layer will either be destroyed by |layer_owner_|'s dtor, or by whoever | 265 if (layer()) { |
| 264 // acquired it. | 266 // The layer will either be destroyed by |layer_owner_|'s dtor, or by |
| 265 layer()->set_delegate(NULL); | 267 // whoever acquired it. |
| 268 layer()->set_delegate(NULL); | |
| 269 } | |
| 266 DestroyLayer(); | 270 DestroyLayer(); |
| 267 } | 271 } |
| 268 | 272 |
| 269 void Window::Init(ui::LayerType layer_type) { | 273 void Window::Init(ui::LayerType layer_type) { |
| 270 SetLayer(new ui::Layer(layer_type)); | 274 SetLayer(new ui::Layer(layer_type)); |
| 271 layer()->SetVisible(false); | 275 layer()->SetVisible(false); |
| 272 layer()->set_delegate(this); | 276 layer()->set_delegate(this); |
| 273 UpdateLayerName(); | 277 UpdateLayerName(); |
| 274 layer()->SetFillsBoundsOpaquely(!transparent_); | 278 layer()->SetFillsBoundsOpaquely(!transparent_); |
| 275 Env::GetInstance()->NotifyWindowInitialized(this); | 279 Env::GetInstance()->NotifyWindowInitialized(this); |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 return window; | 1405 return window; |
| 1402 if (offset) | 1406 if (offset) |
| 1403 *offset += window->bounds().OffsetFromOrigin(); | 1407 *offset += window->bounds().OffsetFromOrigin(); |
| 1404 } | 1408 } |
| 1405 if (offset) | 1409 if (offset) |
| 1406 *offset = gfx::Vector2d(); | 1410 *offset = gfx::Vector2d(); |
| 1407 return NULL; | 1411 return NULL; |
| 1408 } | 1412 } |
| 1409 | 1413 |
| 1410 } // namespace aura | 1414 } // namespace aura |
| OLD | NEW |