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 | |
306 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const { | |
307 // For the default case, we assume the non-client frame view never overlaps | |
308 // the client view. | |
309 return !GetWidget()->client_view()->bounds().Intersects(rect); | |
310 } | |
311 | |
312 //////////////////////////////////////////////////////////////////////////////// | |
313 // NonClientFrameView, protected: | 305 // NonClientFrameView, protected: |
314 | 306 |
315 void NonClientFrameView::GetAccessibleState(ui::AXViewState* state) { | 307 void NonClientFrameView::GetAccessibleState(ui::AXViewState* state) { |
316 state->role = ui::AX_ROLE_CLIENT; | 308 state->role = ui::AX_ROLE_CLIENT; |
317 } | 309 } |
318 | 310 |
319 const char* NonClientFrameView::GetClassName() const { | 311 const char* NonClientFrameView::GetClassName() const { |
320 return kViewClassName; | 312 return kViewClassName; |
321 } | 313 } |
322 | 314 |
323 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 315 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
324 // Overridden to do nothing. The NonClientView manually calls Layout on the | 316 // Overridden to do nothing. The NonClientView manually calls Layout on the |
325 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 317 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
326 } | 318 } |
327 | 319 |
328 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) { | 320 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) { |
| 321 SetEventTargeter( |
| 322 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
| 323 } |
| 324 |
| 325 // ViewTargeterDelegate: |
| 326 bool NonClientFrameView::DoesIntersectRect(const View* target, |
| 327 const gfx::Rect& rect) const { |
| 328 CHECK_EQ(target, this); |
| 329 |
| 330 // For the default case, we assume the non-client frame view never overlaps |
| 331 // the client view. |
| 332 return !GetWidget()->client_view()->bounds().Intersects(rect); |
329 } | 333 } |
330 | 334 |
331 } // namespace views | 335 } // namespace views |
OLD | NEW |