| 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/geometry/rect_conversions.h" | 9 #include "ui/gfx/geometry/rect_conversions.h" |
| 10 #include "ui/views/rect_based_targeting_utils.h" | 10 #include "ui/views/rect_based_targeting_utils.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // The frame view and the client view are always at these specific indices, | 25 // The frame view and the client view are always at these specific indices, |
| 26 // because the RootView message dispatch sends messages to items higher in the | 26 // because the RootView message dispatch sends messages to items higher in the |
| 27 // z-order first and we always want the client view to have first crack at | 27 // z-order first and we always want the client view to have first crack at |
| 28 // handling mouse messages. | 28 // handling mouse messages. |
| 29 static const int kFrameViewIndex = 0; | 29 static const int kFrameViewIndex = 0; |
| 30 static const int kClientViewIndex = 1; | 30 static const int kClientViewIndex = 1; |
| 31 // The overlay view is always on top (index == child_count() - 1). | 31 // The overlay view is always on top (index == child_count() - 1). |
| 32 | 32 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 34 // NonClientFrameView, default implementations: |
| 35 |
| 36 bool NonClientFrameView::GetClientMask(const gfx::Size& size, |
| 37 gfx::Path* mask) const { |
| 38 return false; |
| 39 } |
| 40 |
| 41 //////////////////////////////////////////////////////////////////////////////// |
| 34 // NonClientView, public: | 42 // NonClientView, public: |
| 35 | 43 |
| 36 NonClientView::NonClientView() | 44 NonClientView::NonClientView() |
| 37 : client_view_(nullptr), | 45 : client_view_(nullptr), |
| 38 overlay_view_(nullptr) { | 46 overlay_view_(nullptr) { |
| 39 SetEventTargeter( | 47 SetEventTargeter( |
| 40 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 48 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
| 41 } | 49 } |
| 42 | 50 |
| 43 NonClientView::~NonClientView() { | 51 NonClientView::~NonClientView() { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 gfx::Size NonClientView::GetMaximumSize() const { | 160 gfx::Size NonClientView::GetMaximumSize() const { |
| 153 return frame_view_->GetMaximumSize(); | 161 return frame_view_->GetMaximumSize(); |
| 154 } | 162 } |
| 155 | 163 |
| 156 void NonClientView::Layout() { | 164 void NonClientView::Layout() { |
| 157 LayoutFrameView(); | 165 LayoutFrameView(); |
| 158 | 166 |
| 159 // Then layout the ClientView, using those bounds. | 167 // Then layout the ClientView, using those bounds. |
| 160 client_view_->SetBoundsRect(frame_view_->GetBoundsForClientView()); | 168 client_view_->SetBoundsRect(frame_view_->GetBoundsForClientView()); |
| 161 | 169 |
| 170 gfx::Path client_clip; |
| 171 if (frame_view_->GetClientMask(client_view_->size(), &client_clip)) |
| 172 client_view_->set_clip_path(client_clip); |
| 173 |
| 162 // We need to manually call Layout on the ClientView as well for the same | 174 // We need to manually call Layout on the ClientView as well for the same |
| 163 // reason as above. | 175 // reason as above. |
| 164 client_view_->Layout(); | 176 client_view_->Layout(); |
| 165 | 177 |
| 166 if (overlay_view_ && overlay_view_->visible()) | 178 if (overlay_view_ && overlay_view_->visible()) |
| 167 overlay_view_->SetBoundsRect(GetLocalBounds()); | 179 overlay_view_->SetBoundsRect(GetLocalBounds()); |
| 168 } | 180 } |
| 169 | 181 |
| 170 void NonClientView::ViewHierarchyChanged( | 182 void NonClientView::ViewHierarchyChanged( |
| 171 const ViewHierarchyChangedDetails& details) { | 183 const ViewHierarchyChangedDetails& details) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // the client view. | 336 // the client view. |
| 325 return !GetWidget()->client_view()->bounds().Intersects(rect); | 337 return !GetWidget()->client_view()->bounds().Intersects(rect); |
| 326 } | 338 } |
| 327 | 339 |
| 328 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 340 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 329 // Overridden to do nothing. The NonClientView manually calls Layout on the | 341 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 330 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 342 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
| 331 } | 343 } |
| 332 | 344 |
| 333 } // namespace views | 345 } // namespace views |
| OLD | NEW |