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 | |
84 void NonClientView::DisableInactiveRendering(bool disable) { | 69 void NonClientView::DisableInactiveRendering(bool disable) { |
85 frame_view_->DisableInactiveRendering(disable); | 70 frame_view_->DisableInactiveRendering(disable); |
86 } | 71 } |
87 | 72 |
88 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( | 73 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( |
89 const gfx::Rect client_bounds) const { | 74 const gfx::Rect client_bounds) const { |
90 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); | 75 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); |
91 } | 76 } |
92 | 77 |
93 int NonClientView::NonClientHitTest(const gfx::Point& point) { | 78 int NonClientView::NonClientHitTest(const gfx::Point& point) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 170 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
186 if (frame_view_->HitTest(point_in_child_coords)) | 171 if (frame_view_->HitTest(point_in_child_coords)) |
187 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 172 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); |
188 | 173 |
189 return View::GetEventHandlerForPoint(point); | 174 return View::GetEventHandlerForPoint(point); |
190 } | 175 } |
191 | 176 |
192 //////////////////////////////////////////////////////////////////////////////// | 177 //////////////////////////////////////////////////////////////////////////////// |
193 // NonClientFrameView, View overrides: | 178 // NonClientFrameView, View overrides: |
194 | 179 |
195 bool NonClientFrameView::AlwaysUseCustomFrame() const { | |
196 return false; | |
197 } | |
198 | |
199 bool NonClientFrameView::AlwaysUseNativeFrame() const { | |
200 return false; | |
201 } | |
202 | |
203 bool NonClientFrameView::HitTest(const gfx::Point& l) const { | 180 bool NonClientFrameView::HitTest(const gfx::Point& l) const { |
204 // For the default case, we assume the non-client frame view never overlaps | 181 // For the default case, we assume the non-client frame view never overlaps |
205 // the client view. | 182 // the client view. |
206 return !GetWindow()->client_view()->bounds().Contains(l); | 183 return !GetWindow()->client_view()->bounds().Contains(l); |
207 } | 184 } |
208 | 185 |
209 //////////////////////////////////////////////////////////////////////////////// | 186 //////////////////////////////////////////////////////////////////////////////// |
210 // NonClientFrameView, protected: | 187 // NonClientFrameView, protected: |
211 | 188 |
212 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, | 189 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 242 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
266 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 243 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
267 } | 244 } |
268 | 245 |
269 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 246 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
270 // Overridden to do nothing. The NonClientView manually calls Layout on the | 247 // Overridden to do nothing. The NonClientView manually calls Layout on the |
271 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 248 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
272 } | 249 } |
273 | 250 |
274 } // namespace views | 251 } // namespace views |
OLD | NEW |