| 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/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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 void NonClientView::GetAccessibleState(ui::AccessibleViewState* state) { | 159 void NonClientView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 160 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 160 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
| 161 state->name = accessible_name_; | 161 state->name = accessible_name_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 std::string NonClientView::GetClassName() const { | 164 std::string NonClientView::GetClassName() const { |
| 165 return kViewClassName; | 165 return kViewClassName; |
| 166 } | 166 } |
| 167 | 167 |
| 168 views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { | 168 View* NonClientView::GetEventHandler(const gfx::Rect& rect, EventType type) { |
| 169 // Because of the z-ordering of our child views (the client view is positioned | 169 // Because of the z-ordering of our child views (the client view is positioned |
| 170 // over the non-client frame view, if the client view ever overlaps the frame | 170 // over the non-client frame view, if the client view ever overlaps the frame |
| 171 // view visually (as it does for the browser window), then it will eat mouse | 171 // view visually (as it does for the browser window), then it will eat mouse |
| 172 // events for the window controls. We override this method here so that we can | 172 // events for the window controls. We override this method here so that we can |
| 173 // detect this condition and re-route the events to the non-client frame view. | 173 // detect this condition and re-route the events to the non-client frame view. |
| 174 // The assumption is that the frame view's implementation of HitTest will only | 174 // The assumption is that the frame view's implementation of HitTest will only |
| 175 // return true for area not occupied by the client view. | 175 // return true for area not occupied by the client view. |
| 176 if (frame_view_->parent() == this) { | 176 if (frame_view_->parent() == this) { |
| 177 // During the reset of the frame_view_ it's possible to be in this code | 177 // During the reset of the frame_view_ it's possible to be in this code |
| 178 // after it's been removed from the view hierarchy but before it's been | 178 // after it's been removed from the view hierarchy but before it's been |
| 179 // removed from the NonClientView. | 179 // removed from the NonClientView. |
| 180 gfx::Point point_in_child_coords(point); | 180 gfx::Rect rect_in_child_coords(rect); |
| 181 View::ConvertPointToTarget(this, frame_view_.get(), &point_in_child_coords); | 181 View::ConvertRectToTarget(this, frame_view_.get(), &rect_in_child_coords); |
| 182 if (frame_view_->HitTestPoint(point_in_child_coords)) | 182 if (frame_view_->HitTestRect(rect_in_child_coords)) |
| 183 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 183 return frame_view_->GetEventHandler(rect_in_child_coords, type); |
| 184 } | 184 } |
| 185 | 185 |
| 186 return View::GetEventHandlerForPoint(point); | 186 return View::GetEventHandler(rect, type); |
| 187 } | 187 } |
| 188 | 188 |
| 189 //////////////////////////////////////////////////////////////////////////////// | 189 //////////////////////////////////////////////////////////////////////////////// |
| 190 // NonClientFrameView, public: | 190 // NonClientFrameView, public: |
| 191 | 191 |
| 192 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { | 192 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { |
| 193 // See comment in Widget::SetInactiveRenderingDisabled as to why we don't | 193 // See comment in Widget::SetInactiveRenderingDisabled as to why we don't |
| 194 // conditionally invoke ShouldPaintAsActiveChanged. | 194 // conditionally invoke ShouldPaintAsActiveChanged. |
| 195 paint_as_active_ = disable; | 195 paint_as_active_ = disable; |
| 196 ShouldPaintAsActiveChanged(); | 196 ShouldPaintAsActiveChanged(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 std::string NonClientFrameView::GetClassName() const { | 273 std::string NonClientFrameView::GetClassName() const { |
| 274 return kViewClassName; | 274 return kViewClassName; |
| 275 } | 275 } |
| 276 | 276 |
| 277 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 277 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 278 // Overridden to do nothing. The NonClientView manually calls Layout on the | 278 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 279 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 279 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace views | 282 } // namespace views |
| OLD | NEW |