| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 return cursor_; | 812 return cursor_; |
| 813 } | 813 } |
| 814 | 814 |
| 815 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { | 815 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { |
| 816 return delegate_->GetNonClientComponent(point); | 816 return delegate_->GetNonClientComponent(point); |
| 817 } | 817 } |
| 818 | 818 |
| 819 bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling( | 819 bool NativeWidgetAura::ShouldDescendIntoChildForEventHandling( |
| 820 aura::Window* child, | 820 aura::Window* child, |
| 821 const gfx::Point& location) { | 821 const gfx::Point& location) { |
| 822 views::WidgetDelegate* widget_delegate = GetWidget()->widget_delegate(); | 822 return delegate_->ShouldDescendIntoChildForEventHandling( |
| 823 if (widget_delegate && | 823 window_->layer(), child, child->layer(), location); |
| 824 !widget_delegate->ShouldDescendIntoChildForEventHandling(child, location)) | |
| 825 return false; | |
| 826 | |
| 827 // Don't descend into |child| if there is a view with a Layer that contains | |
| 828 // the point and is stacked above |child|s layer. | |
| 829 typedef std::vector<ui::Layer*> Layers; | |
| 830 const Layers& root_layers(delegate_->GetRootLayers()); | |
| 831 if (root_layers.empty()) | |
| 832 return true; | |
| 833 | |
| 834 Layers::const_iterator child_layer_iter( | |
| 835 std::find(window_->layer()->children().begin(), | |
| 836 window_->layer()->children().end(), child->layer())); | |
| 837 if (child_layer_iter == window_->layer()->children().end()) | |
| 838 return true; | |
| 839 | |
| 840 for (std::vector<ui::Layer*>::const_reverse_iterator i = root_layers.rbegin(); | |
| 841 i != root_layers.rend(); ++i) { | |
| 842 ui::Layer* layer = *i; | |
| 843 if (layer->visible() && layer->bounds().Contains(location)) { | |
| 844 Layers::const_iterator root_layer_iter( | |
| 845 std::find(window_->layer()->children().begin(), | |
| 846 window_->layer()->children().end(), layer)); | |
| 847 if (root_layer_iter > child_layer_iter) | |
| 848 return false; | |
| 849 } | |
| 850 } | |
| 851 return true; | |
| 852 } | 824 } |
| 853 | 825 |
| 854 bool NativeWidgetAura::CanFocus() { | 826 bool NativeWidgetAura::CanFocus() { |
| 855 return ShouldActivate(); | 827 return ShouldActivate(); |
| 856 } | 828 } |
| 857 | 829 |
| 858 void NativeWidgetAura::OnCaptureLost() { | 830 void NativeWidgetAura::OnCaptureLost() { |
| 859 delegate_->OnMouseCaptureLost(); | 831 delegate_->OnMouseCaptureLost(); |
| 860 } | 832 } |
| 861 | 833 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 gfx::NativeView native_view) { | 1203 gfx::NativeView native_view) { |
| 1232 aura::client::CaptureClient* capture_client = | 1204 aura::client::CaptureClient* capture_client = |
| 1233 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1205 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1234 if (!capture_client) | 1206 if (!capture_client) |
| 1235 return nullptr; | 1207 return nullptr; |
| 1236 return capture_client->GetGlobalCaptureWindow(); | 1208 return capture_client->GetGlobalCaptureWindow(); |
| 1237 } | 1209 } |
| 1238 | 1210 |
| 1239 } // namespace internal | 1211 } // namespace internal |
| 1240 } // namespace views | 1212 } // namespace views |
| OLD | NEW |