OLD | NEW |
1 // Copyright (c) 2011 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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void NonClientView::UpdateFrame() { | 61 void NonClientView::UpdateFrame() { |
62 SetFrameView(frame_->CreateFrameViewForWindow()); | 62 SetFrameView(frame_->CreateFrameViewForWindow()); |
63 GetWidget()->ThemeChanged(); | 63 GetWidget()->ThemeChanged(); |
64 Layout(); | 64 Layout(); |
65 SchedulePaint(); | 65 SchedulePaint(); |
66 frame_->UpdateFrameAfterFrameChange(); | 66 frame_->UpdateFrameAfterFrameChange(); |
67 } | 67 } |
68 | 68 |
| 69 bool NonClientView::UseNativeFrame() const { |
| 70 if (frame_view_.get()) { |
| 71 // The frame view may always require a native frame, e.g. popups on Vista+ |
| 72 // when themes are active. |
| 73 if (frame_view_->AlwaysUseNativeFrame()) |
| 74 return true; |
| 75 |
| 76 // The frame view may always require a custom frame, e.g. Constrained |
| 77 // Windows. |
| 78 if (frame_view_->AlwaysUseCustomFrame()) |
| 79 return false; |
| 80 } |
| 81 return frame_->ShouldUseNativeFrame(); |
| 82 } |
| 83 |
69 void NonClientView::DisableInactiveRendering(bool disable) { | 84 void NonClientView::DisableInactiveRendering(bool disable) { |
70 frame_view_->DisableInactiveRendering(disable); | 85 frame_view_->DisableInactiveRendering(disable); |
71 } | 86 } |
72 | 87 |
73 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( | 88 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( |
74 const gfx::Rect client_bounds) const { | 89 const gfx::Rect client_bounds) const { |
75 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); | 90 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); |
76 } | 91 } |
77 | 92 |
78 int NonClientView::NonClientHitTest(const gfx::Point& point) { | 93 int NonClientView::NonClientHitTest(const gfx::Point& point) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 185 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
171 if (frame_view_->HitTest(point_in_child_coords)) | 186 if (frame_view_->HitTest(point_in_child_coords)) |
172 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 187 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); |
173 | 188 |
174 return View::GetEventHandlerForPoint(point); | 189 return View::GetEventHandlerForPoint(point); |
175 } | 190 } |
176 | 191 |
177 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
178 // NonClientFrameView, View overrides: | 193 // NonClientFrameView, View overrides: |
179 | 194 |
| 195 bool NonClientFrameView::AlwaysUseCustomFrame() const { |
| 196 return false; |
| 197 } |
| 198 |
| 199 bool NonClientFrameView::AlwaysUseNativeFrame() const { |
| 200 return false; |
| 201 } |
| 202 |
180 bool NonClientFrameView::HitTest(const gfx::Point& l) const { | 203 bool NonClientFrameView::HitTest(const gfx::Point& l) const { |
181 // For the default case, we assume the non-client frame view never overlaps | 204 // For the default case, we assume the non-client frame view never overlaps |
182 // the client view. | 205 // the client view. |
183 return !GetWindow()->client_view()->bounds().Contains(l); | 206 return !GetWindow()->client_view()->bounds().Contains(l); |
184 } | 207 } |
185 | 208 |
186 //////////////////////////////////////////////////////////////////////////////// | 209 //////////////////////////////////////////////////////////////////////////////// |
187 // NonClientFrameView, protected: | 210 // NonClientFrameView, protected: |
188 | 211 |
189 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, | 212 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 265 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
243 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 266 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
244 } | 267 } |
245 | 268 |
246 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 269 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
247 // Overridden to do nothing. The NonClientView manually calls Layout on the | 270 // Overridden to do nothing. The NonClientView manually calls Layout on the |
248 // 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. |
249 } | 272 } |
250 | 273 |
251 } // namespace views | 274 } // namespace views |
OLD | NEW |