| OLD | NEW |
| 1 // Copyright (c) 2010 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 "views/window/non_client_view.h" | 5 #include "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 "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 #include "views/window/client_view.h" | 10 #include "views/window/client_view.h" |
| 11 #include "views/window/window.h" | 11 #include "views/window/window.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 View* child) { | 161 View* child) { |
| 162 // Add our two child views here as we are added to the Widget so that if we | 162 // Add our two child views here as we are added to the Widget so that if we |
| 163 // are subsequently resized all the parent-child relationships are | 163 // are subsequently resized all the parent-child relationships are |
| 164 // established. | 164 // established. |
| 165 if (is_add && GetWidget() && child == this) { | 165 if (is_add && GetWidget() && child == this) { |
| 166 AddChildViewAt(frame_view_.get(), kFrameViewIndex); | 166 AddChildViewAt(frame_view_.get(), kFrameViewIndex); |
| 167 AddChildViewAt(client_view_, kClientViewIndex); | 167 AddChildViewAt(client_view_, kClientViewIndex); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 void NonClientView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 172 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
| 173 state->name = accessible_name_; |
| 174 } |
| 175 |
| 171 views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { | 176 views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { |
| 172 // Because of the z-ordering of our child views (the client view is positioned | 177 // Because of the z-ordering of our child views (the client view is positioned |
| 173 // over the non-client frame view, if the client view ever overlaps the frame | 178 // over the non-client frame view, if the client view ever overlaps the frame |
| 174 // view visually (as it does for the browser window), then it will eat mouse | 179 // view visually (as it does for the browser window), then it will eat mouse |
| 175 // events for the window controls. We override this method here so that we can | 180 // events for the window controls. We override this method here so that we can |
| 176 // detect this condition and re-route the events to the non-client frame view. | 181 // detect this condition and re-route the events to the non-client frame view. |
| 177 // The assumption is that the frame view's implementation of HitTest will only | 182 // The assumption is that the frame view's implementation of HitTest will only |
| 178 // return true for area not occupied by the client view. | 183 // return true for area not occupied by the client view. |
| 179 gfx::Point point_in_child_coords(point); | 184 gfx::Point point_in_child_coords(point); |
| 180 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 185 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
| 181 if (frame_view_->HitTest(point_in_child_coords)) | 186 if (frame_view_->HitTest(point_in_child_coords)) |
| 182 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 187 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); |
| 183 | 188 |
| 184 return View::GetEventHandlerForPoint(point); | 189 return View::GetEventHandlerForPoint(point); |
| 185 } | 190 } |
| 186 | 191 |
| 187 void NonClientView::GetAccessibleState(ui::AccessibleViewState* state) { | |
| 188 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | |
| 189 state->name = accessible_name_; | |
| 190 } | |
| 191 | |
| 192 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
| 193 // NonClientFrameView, View overrides: | 193 // NonClientFrameView, View overrides: |
| 194 | 194 |
| 195 bool NonClientFrameView::AlwaysUseCustomFrame() const { | 195 bool NonClientFrameView::AlwaysUseCustomFrame() const { |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 bool NonClientFrameView::AlwaysUseNativeFrame() const { | 199 bool NonClientFrameView::AlwaysUseNativeFrame() const { |
| 200 return false; | 200 return false; |
| 201 } | 201 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 265 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 266 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 266 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
| 267 } | 267 } |
| 268 | 268 |
| 269 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 269 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 270 // Overridden to do nothing. The NonClientView manually calls Layout on the | 270 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 271 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 271 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace views | 274 } // namespace views |
| OLD | NEW |