| 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 "ui/aura/desktop.h" | 10 #include "ui/aura/desktop.h" |
| 11 #include "ui/aura/event.h" | 11 #include "ui/aura/event.h" |
| 12 #include "ui/aura/event_filter.h" | 12 #include "ui/aura/event_filter.h" |
| 13 #include "ui/aura/focus_manager.h" | 13 #include "ui/aura/focus_manager.h" |
| 14 #include "ui/aura/layout_manager.h" | 14 #include "ui/aura/layout_manager.h" |
| 15 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
| 16 #include "ui/base/animation/multi_animation.h" | 16 #include "ui/base/animation/multi_animation.h" |
| 17 #include "ui/gfx/canvas_skia.h" | 17 #include "ui/gfx/canvas_skia.h" |
| 18 #include "ui/gfx/compositor/compositor.h" | 18 #include "ui/gfx/compositor/compositor.h" |
| 19 #include "ui/gfx/compositor/layer.h" | 19 #include "ui/gfx/compositor/layer.h" |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 | 22 |
| 23 using internal::RootWindow; | 23 using internal::RootWindow; |
| 24 | 24 |
| 25 Window::Window(WindowDelegate* delegate) | 25 Window::Window(WindowDelegate* delegate) |
| 26 : delegate_(delegate), | 26 : delegate_(delegate), |
| 27 visible_(false), | 27 visible_(false), |
| 28 parent_(NULL), | 28 parent_(NULL), |
| 29 id_(-1), | 29 id_(-1), |
| 30 user_data_(NULL) { | 30 user_data_(NULL), |
| 31 consumes_events_(false) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 Window::~Window() { | 34 Window::~Window() { |
| 34 // Let the delegate know we're in the processing of destroying. | 35 // Let the delegate know we're in the processing of destroying. |
| 35 if (delegate_) | 36 if (delegate_) |
| 36 delegate_->OnWindowDestroying(); | 37 delegate_->OnWindowDestroying(); |
| 37 | 38 |
| 38 // Let the root know so that it can remove any references to us. | 39 // Let the root know so that it can remove any references to us. |
| 39 RootWindow* root = GetRoot(); | 40 RootWindow* root = GetRoot(); |
| 40 if (root) | 41 if (root) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Window* child = *i; | 208 Window* child = *i; |
| 208 if (!child->visible()) | 209 if (!child->visible()) |
| 209 continue; | 210 continue; |
| 210 gfx::Point point_in_child_coords(point); | 211 gfx::Point point_in_child_coords(point); |
| 211 Window::ConvertPointToWindow(this, child, &point_in_child_coords); | 212 Window::ConvertPointToWindow(this, child, &point_in_child_coords); |
| 212 if (child->HitTest(point_in_child_coords)) { | 213 if (child->HitTest(point_in_child_coords)) { |
| 213 Window* handler = child->GetEventHandlerForPoint(point_in_child_coords); | 214 Window* handler = child->GetEventHandlerForPoint(point_in_child_coords); |
| 214 if (handler && handler->delegate()) | 215 if (handler && handler->delegate()) |
| 215 return handler; | 216 return handler; |
| 216 } | 217 } |
| 218 if (child->consumes_events_ && !child->children().empty()) |
| 219 return NULL; |
| 217 } | 220 } |
| 218 return delegate_ ? this : NULL; | 221 return delegate_ ? this : NULL; |
| 219 } | 222 } |
| 220 | 223 |
| 221 internal::FocusManager* Window::GetFocusManager() { | 224 internal::FocusManager* Window::GetFocusManager() { |
| 222 return parent_ ? parent_->GetFocusManager() : NULL; | 225 return parent_ ? parent_->GetFocusManager() : NULL; |
| 223 } | 226 } |
| 224 | 227 |
| 225 void Window::SetCapture() { | 228 void Window::SetCapture() { |
| 226 if (!visible_) | 229 if (!visible_) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 273 |
| 271 void Window::SchedulePaint() { | 274 void Window::SchedulePaint() { |
| 272 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); | 275 SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height())); |
| 273 } | 276 } |
| 274 | 277 |
| 275 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 278 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
| 276 delegate_->OnPaint(canvas); | 279 delegate_->OnPaint(canvas); |
| 277 } | 280 } |
| 278 | 281 |
| 279 } // namespace aura | 282 } // namespace aura |
| OLD | NEW |