Chromium Code Reviews| 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/accessibility/ax_view_state.h" | 7 #include "ui/accessibility/ax_view_state.h" |
| 8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
| 9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
| 10 #include "ui/views/rect_based_targeting_utils.h" | 10 #include "ui/views/rect_based_targeting_utils.h" |
| 11 #include "ui/views/view_targeter.h" | |
| 11 #include "ui/views/widget/root_view.h" | 12 #include "ui/views/widget/root_view.h" |
| 12 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 13 #include "ui/views/window/client_view.h" | 14 #include "ui/views/window/client_view.h" |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 | 17 |
| 17 // static | 18 // static |
| 18 const char NonClientFrameView::kViewClassName[] = | 19 const char NonClientFrameView::kViewClassName[] = |
| 19 "ui/views/window/NonClientFrameView"; | 20 "ui/views/window/NonClientFrameView"; |
| 20 | 21 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 } else { | 295 } else { |
| 295 return HTNOWHERE; | 296 return HTNOWHERE; |
| 296 } | 297 } |
| 297 | 298 |
| 298 // If the window can't be resized, there are no resize boundaries, just | 299 // If the window can't be resized, there are no resize boundaries, just |
| 299 // window borders. | 300 // window borders. |
| 300 return can_resize ? component : HTBORDER; | 301 return can_resize ? component : HTBORDER; |
| 301 } | 302 } |
| 302 | 303 |
| 303 //////////////////////////////////////////////////////////////////////////////// | 304 //////////////////////////////////////////////////////////////////////////////// |
| 304 // NonClientFrameView, View overrides: | 305 // NonClientFrameView, ViewTargeterDelegate overrides: |
| 305 | 306 |
| 306 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const { | 307 bool NonClientFrameView::DoesIntersectRect(const View* target, |
| 308 const gfx::Rect& rect) const { | |
| 309 CHECK_EQ(target, this); | |
| 310 | |
| 307 // For the default case, we assume the non-client frame view never overlaps | 311 // For the default case, we assume the non-client frame view never overlaps |
| 308 // the client view. | 312 // the client view. |
| 309 return !GetWidget()->client_view()->bounds().Intersects(rect); | 313 return !GetWidget()->client_view()->bounds().Intersects(rect); |
| 310 } | 314 } |
| 311 | 315 |
| 312 //////////////////////////////////////////////////////////////////////////////// | 316 //////////////////////////////////////////////////////////////////////////////// |
| 313 // NonClientFrameView, protected: | 317 // NonClientFrameView, protected: |
| 314 | 318 |
| 315 void NonClientFrameView::GetAccessibleState(ui::AXViewState* state) { | 319 void NonClientFrameView::GetAccessibleState(ui::AXViewState* state) { |
| 316 state->role = ui::AX_ROLE_CLIENT; | 320 state->role = ui::AX_ROLE_CLIENT; |
| 317 } | 321 } |
| 318 | 322 |
| 319 const char* NonClientFrameView::GetClassName() const { | 323 const char* NonClientFrameView::GetClassName() const { |
| 320 return kViewClassName; | 324 return kViewClassName; |
| 321 } | 325 } |
| 322 | 326 |
| 323 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 327 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 324 // Overridden to do nothing. The NonClientView manually calls Layout on the | 328 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 325 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 329 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
| 326 } | 330 } |
| 327 | 331 |
| 328 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) { | 332 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) { |
| 333 // Terry - the right place for this? | |
|
sadrul
2014/07/14 16:44:14
This should be the right place to install the defa
tdanderson
2014/07/14 17:28:58
Sorry, left this in by mistake. Removed.
| |
| 334 SetEventTargeter( | |
| 335 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | |
| 329 } | 336 } |
| 330 | 337 |
| 331 } // namespace views | 338 } // namespace views |
| OLD | NEW |