| 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/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/activation_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { | 753 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { |
| 754 return cursor_; | 754 return cursor_; |
| 755 } | 755 } |
| 756 | 756 |
| 757 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { | 757 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { |
| 758 return delegate_->GetNonClientComponent(point); | 758 return delegate_->GetNonClientComponent(point); |
| 759 } | 759 } |
| 760 | 760 |
| 761 bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling( | 761 bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling( |
| 762 aura::Window* child, | 762 aura::Window* child, |
| 763 const gfx::Point& location) { | 763 const gfx::Point& event_location, |
| 764 ui::EventType event_type) { |
| 765 views::WidgetDelegate* widget_delegate = GetWidget()->widget_delegate(); |
| 766 if (widget_delegate && |
| 767 !widget_delegate->ShouldDescendIntoChildForEventHandling( |
| 768 child, event_location, event_type)) |
| 769 return false; |
| 770 |
| 764 // Don't descend into |child| if there is a view with a Layer that contains | 771 // Don't descend into |child| if there is a view with a Layer that contains |
| 765 // the point and is stacked above |child|s layer. | 772 // the point and is stacked above |child|s layer. |
| 766 typedef std::vector<ui::Layer*> Layers; | 773 typedef std::vector<ui::Layer*> Layers; |
| 767 const Layers& root_layers(delegate_->GetRootLayers()); | 774 const Layers& root_layers(delegate_->GetRootLayers()); |
| 768 if (root_layers.empty()) | 775 if (root_layers.empty()) |
| 769 return true; | 776 return true; |
| 770 | 777 |
| 771 Layers::const_iterator child_layer_iter( | 778 Layers::const_iterator child_layer_iter( |
| 772 std::find(window_->layer()->children().begin(), | 779 std::find(window_->layer()->children().begin(), |
| 773 window_->layer()->children().end(), child->layer())); | 780 window_->layer()->children().end(), child->layer())); |
| 774 if (child_layer_iter == window_->layer()->children().end()) | 781 if (child_layer_iter == window_->layer()->children().end()) |
| 775 return true; | 782 return true; |
| 776 | 783 |
| 777 for (std::vector<ui::Layer*>::const_reverse_iterator i = root_layers.rbegin(); | 784 for (std::vector<ui::Layer*>::const_reverse_iterator i = root_layers.rbegin(); |
| 778 i != root_layers.rend(); ++i) { | 785 i != root_layers.rend(); ++i) { |
| 779 ui::Layer* layer = *i; | 786 ui::Layer* layer = *i; |
| 780 if (layer->visible() && layer->bounds().Contains(location)) { | 787 if (layer->visible() && layer->bounds().Contains(event_location)) { |
| 781 Layers::const_iterator root_layer_iter( | 788 Layers::const_iterator root_layer_iter( |
| 782 std::find(window_->layer()->children().begin(), | 789 std::find(window_->layer()->children().begin(), |
| 783 window_->layer()->children().end(), layer)); | 790 window_->layer()->children().end(), layer)); |
| 784 if (root_layer_iter > child_layer_iter) | 791 if (root_layer_iter > child_layer_iter) |
| 785 return false; | 792 return false; |
| 786 } | 793 } |
| 787 } | 794 } |
| 788 return true; | 795 return true; |
| 789 } | 796 } |
| 790 | 797 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 return aura::Env::GetInstance()->is_mouse_button_down(); | 1050 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 1044 } | 1051 } |
| 1045 | 1052 |
| 1046 // static | 1053 // static |
| 1047 bool NativeWidgetPrivate::IsTouchDown() { | 1054 bool NativeWidgetPrivate::IsTouchDown() { |
| 1048 return aura::Env::GetInstance()->is_touch_down(); | 1055 return aura::Env::GetInstance()->is_touch_down(); |
| 1049 } | 1056 } |
| 1050 | 1057 |
| 1051 } // namespace internal | 1058 } // namespace internal |
| 1052 } // namespace views | 1059 } // namespace views |
| OLD | NEW |