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/views/window/non_client_view.h" | 5 #include "ui/views/window/non_client_view.h" |
6 | 6 |
7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
9 #include "ui/views/widget/root_view.h" | 9 #include "ui/views/widget/root_view.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { | 163 views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { |
164 // Because of the z-ordering of our child views (the client view is positioned | 164 // Because of the z-ordering of our child views (the client view is positioned |
165 // over the non-client frame view, if the client view ever overlaps the frame | 165 // over the non-client frame view, if the client view ever overlaps the frame |
166 // view visually (as it does for the browser window), then it will eat mouse | 166 // view visually (as it does for the browser window), then it will eat mouse |
167 // events for the window controls. We override this method here so that we can | 167 // events for the window controls. We override this method here so that we can |
168 // detect this condition and re-route the events to the non-client frame view. | 168 // detect this condition and re-route the events to the non-client frame view. |
169 // The assumption is that the frame view's implementation of HitTest will only | 169 // The assumption is that the frame view's implementation of HitTest will only |
170 // return true for area not occupied by the client view. | 170 // return true for area not occupied by the client view. |
171 gfx::Point point_in_child_coords(point); | 171 if (frame_view_->parent() == this) { |
172 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 172 // During the reset of the frame_view_ it's possible to be in this code |
173 if (frame_view_->HitTest(point_in_child_coords)) | 173 // after it's been removed from the view hierarchy but before it's been |
174 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 174 // removed from the NonClientView. |
| 175 gfx::Point point_in_child_coords(point); |
| 176 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
| 177 if (frame_view_->HitTest(point_in_child_coords)) |
| 178 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); |
| 179 } |
175 | 180 |
176 return View::GetEventHandlerForPoint(point); | 181 return View::GetEventHandlerForPoint(point); |
177 } | 182 } |
178 | 183 |
179 //////////////////////////////////////////////////////////////////////////////// | 184 //////////////////////////////////////////////////////////////////////////////// |
180 // NonClientFrameView, public: | 185 // NonClientFrameView, public: |
181 | 186 |
182 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { | 187 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { |
183 // See comment in Widget::SetInactiveRenderingDisabled as to why we don't | 188 // See comment in Widget::SetInactiveRenderingDisabled as to why we don't |
184 // conditionally invoke ShouldPaintAsActiveChanged. | 189 // conditionally invoke ShouldPaintAsActiveChanged. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 std::string NonClientFrameView::GetClassName() const { | 268 std::string NonClientFrameView::GetClassName() const { |
264 return kViewClassName; | 269 return kViewClassName; |
265 } | 270 } |
266 | 271 |
267 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 272 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
268 // Overridden to do nothing. The NonClientView manually calls Layout on the | 273 // Overridden to do nothing. The NonClientView manually calls Layout on the |
269 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 274 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
270 } | 275 } |
271 | 276 |
272 } // namespace views | 277 } // namespace views |
OLD | NEW |