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/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 void CustomFrameView::Layout() { | 215 void CustomFrameView::Layout() { |
216 if (ShouldShowTitleBarAndBorder()) { | 216 if (ShouldShowTitleBarAndBorder()) { |
217 LayoutWindowControls(); | 217 LayoutWindowControls(); |
218 LayoutTitleBar(); | 218 LayoutTitleBar(); |
219 } | 219 } |
220 | 220 |
221 LayoutClientView(); | 221 LayoutClientView(); |
222 } | 222 } |
223 | 223 |
224 gfx::Size CustomFrameView::GetPreferredSize() { | 224 gfx::Size CustomFrameView::GetPreferredSize() const { |
225 return frame_->non_client_view()->GetWindowBoundsForClientBounds( | 225 return frame_->non_client_view()->GetWindowBoundsForClientBounds( |
226 gfx::Rect(frame_->client_view()->GetPreferredSize())).size(); | 226 gfx::Rect(frame_->client_view()->GetPreferredSize())).size(); |
227 } | 227 } |
228 | 228 |
229 gfx::Size CustomFrameView::GetMinimumSize() { | 229 gfx::Size CustomFrameView::GetMinimumSize() const { |
230 return frame_->non_client_view()->GetWindowBoundsForClientBounds( | 230 return frame_->non_client_view()->GetWindowBoundsForClientBounds( |
231 gfx::Rect(frame_->client_view()->GetMinimumSize())).size(); | 231 gfx::Rect(frame_->client_view()->GetMinimumSize())).size(); |
232 } | 232 } |
233 | 233 |
234 gfx::Size CustomFrameView::GetMaximumSize() { | 234 gfx::Size CustomFrameView::GetMaximumSize() { |
235 gfx::Size max_size = frame_->client_view()->GetMaximumSize(); | 235 gfx::Size max_size = frame_->client_view()->GetMaximumSize(); |
236 gfx::Size converted_size = | 236 gfx::Size converted_size = |
237 frame_->non_client_view()->GetWindowBoundsForClientBounds( | 237 frame_->non_client_view()->GetWindowBoundsForClientBounds( |
238 gfx::Rect(max_size)).size(); | 238 gfx::Rect(max_size)).size(); |
239 return gfx::Size(max_size.width() == 0 ? 0 : converted_size.width(), | 239 return gfx::Size(max_size.width() == 0 ? 0 : converted_size.width(), |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 rb.GetImageNamed(normal_image_id).ToImageSkia()); | 582 rb.GetImageNamed(normal_image_id).ToImageSkia()); |
583 button->SetImage(CustomButton::STATE_HOVERED, | 583 button->SetImage(CustomButton::STATE_HOVERED, |
584 rb.GetImageNamed(hot_image_id).ToImageSkia()); | 584 rb.GetImageNamed(hot_image_id).ToImageSkia()); |
585 button->SetImage(CustomButton::STATE_PRESSED, | 585 button->SetImage(CustomButton::STATE_PRESSED, |
586 rb.GetImageNamed(pushed_image_id).ToImageSkia()); | 586 rb.GetImageNamed(pushed_image_id).ToImageSkia()); |
587 AddChildView(button); | 587 AddChildView(button); |
588 return button; | 588 return button; |
589 } | 589 } |
590 | 590 |
591 } // namespace views | 591 } // namespace views |
OLD | NEW |