| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace aura { | 24 namespace aura { |
| 25 | 25 |
| 26 Window::Window(WindowDelegate* delegate) | 26 Window::Window(WindowDelegate* delegate) |
| 27 : type_(WINDOW_TYPE_UNKNOWN), | 27 : type_(WINDOW_TYPE_UNKNOWN), |
| 28 delegate_(delegate), | 28 delegate_(delegate), |
| 29 parent_(NULL), | 29 parent_(NULL), |
| 30 transient_parent_(NULL), | 30 transient_parent_(NULL), |
| 31 id_(-1), | 31 id_(-1), |
| 32 user_data_(NULL), | 32 user_data_(NULL), |
| 33 stops_event_propagation_(false) { | 33 stops_event_propagation_(false), |
| 34 drag_drop_delegate_(NULL) { |
| 34 } | 35 } |
| 35 | 36 |
| 36 Window::~Window() { | 37 Window::~Window() { |
| 38 // We need to NULL the drag drop delegate to prevent race condition where a |
| 39 // drag/drop event may be sent to a window while its being destroyed. |
| 40 drag_drop_delegate_ = NULL; |
| 41 |
| 37 // Let the delegate know we're in the processing of destroying. | 42 // Let the delegate know we're in the processing of destroying. |
| 38 if (delegate_) | 43 if (delegate_) |
| 39 delegate_->OnWindowDestroying(); | 44 delegate_->OnWindowDestroying(); |
| 40 | 45 |
| 41 // Let the root know so that it can remove any references to us. | 46 // Let the root know so that it can remove any references to us. |
| 42 Desktop* desktop = GetDesktop(); | 47 Desktop* desktop = GetDesktop(); |
| 43 if (desktop) | 48 if (desktop) |
| 44 desktop->WindowDestroying(this); | 49 desktop->WindowDestroying(this); |
| 45 | 50 |
| 46 // Then destroy the children. | 51 // Then destroy the children. |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 494 |
| 490 return delegate_ ? this : NULL; | 495 return delegate_ ? this : NULL; |
| 491 } | 496 } |
| 492 | 497 |
| 493 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 498 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
| 494 if (delegate_) | 499 if (delegate_) |
| 495 delegate_->OnPaint(canvas); | 500 delegate_->OnPaint(canvas); |
| 496 } | 501 } |
| 497 | 502 |
| 498 } // namespace aura | 503 } // namespace aura |
| OLD | NEW |