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