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 ignore_events_(false) { |
34 } | 35 } |
35 | 36 |
36 Window::~Window() { | 37 Window::~Window() { |
37 // Let the delegate know we're in the processing of destroying. | 38 // Let the delegate know we're in the processing of destroying. |
38 if (delegate_) | 39 if (delegate_) |
39 delegate_->OnWindowDestroying(); | 40 delegate_->OnWindowDestroying(); |
40 | 41 |
41 // Let the root know so that it can remove any references to us. | 42 // Let the root know so that it can remove any references to us. |
42 Desktop* desktop = GetDesktop(); | 43 Desktop* desktop = GetDesktop(); |
43 if (desktop) | 44 if (desktop) |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 if ((for_event_handling && !HitTest(local_point)) || | 466 if ((for_event_handling && !HitTest(local_point)) || |
466 (!for_event_handling && !ContainsPoint(local_point))) | 467 (!for_event_handling && !ContainsPoint(local_point))) |
467 return NULL; | 468 return NULL; |
468 | 469 |
469 if (!return_tightest && delegate_) | 470 if (!return_tightest && delegate_) |
470 return this; | 471 return this; |
471 | 472 |
472 for (Windows::const_reverse_iterator it = children_.rbegin(); | 473 for (Windows::const_reverse_iterator it = children_.rbegin(); |
473 it != children_.rend(); ++it) { | 474 it != children_.rend(); ++it) { |
474 Window* child = *it; | 475 Window* child = *it; |
475 if (!child->IsVisible()) | 476 if (!child->IsVisible() || (for_event_handling && child->ignore_events_)) |
476 continue; | 477 continue; |
477 | 478 |
478 gfx::Point point_in_child_coords(local_point); | 479 gfx::Point point_in_child_coords(local_point); |
479 Window::ConvertPointToWindow(this, child, &point_in_child_coords); | 480 Window::ConvertPointToWindow(this, child, &point_in_child_coords); |
480 Window* match = child->GetWindowForPoint(point_in_child_coords, | 481 Window* match = child->GetWindowForPoint(point_in_child_coords, |
481 return_tightest, | 482 return_tightest, |
482 for_event_handling); | 483 for_event_handling); |
483 if (match) | 484 if (match) |
484 return match; | 485 return match; |
485 | 486 |
486 if (for_event_handling && child->StopsEventPropagation()) | 487 if (for_event_handling && child->StopsEventPropagation()) |
487 break; | 488 break; |
488 } | 489 } |
489 | 490 |
490 return delegate_ ? this : NULL; | 491 return delegate_ ? this : NULL; |
491 } | 492 } |
492 | 493 |
493 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 494 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
494 if (delegate_) | 495 if (delegate_) |
495 delegate_->OnPaint(canvas); | 496 delegate_->OnPaint(canvas); |
496 } | 497 } |
497 | 498 |
498 } // namespace aura | 499 } // namespace aura |
OLD | NEW |