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 "ash/wm/frame_painter.h" | 5 #include "ash/wm/frame_painter.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/property_util.h" | 10 #include "ash/wm/property_util.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 gfx::Size FramePainter::GetMinimumSize(views::NonClientFrameView* view) { | 315 gfx::Size FramePainter::GetMinimumSize(views::NonClientFrameView* view) { |
316 gfx::Size min_size = frame_->client_view()->GetMinimumSize(); | 316 gfx::Size min_size = frame_->client_view()->GetMinimumSize(); |
317 // Ensure we can display the top of the caption area. | 317 // Ensure we can display the top of the caption area. |
318 gfx::Rect client_bounds = view->GetBoundsForClientView(); | 318 gfx::Rect client_bounds = view->GetBoundsForClientView(); |
319 min_size.Enlarge(0, client_bounds.y()); | 319 min_size.Enlarge(0, client_bounds.y()); |
320 // Ensure we have enough space for the window icon and buttons. We allow | 320 // Ensure we have enough space for the window icon and buttons. We allow |
321 // the title string to collapse to zero width. | 321 // the title string to collapse to zero width. |
322 int title_width = GetTitleOffsetX() + | 322 int title_width = GetTitleOffsetX() + |
323 size_button_->width() + kSizeButtonOffsetX + | 323 size_button_->width() + kSizeButtonOffsetX + |
324 close_button_->width() + kCloseButtonOffsetX; | 324 close_button_->width() + kCloseButtonOffsetX; |
325 if (immersive_button_) | 325 if (immersive_button_ && immersive_button_->visible()) |
326 title_width += immersive_button_->width() + kImmersiveButtonOffsetX; | 326 title_width += immersive_button_->width() + kImmersiveButtonOffsetX; |
327 if (title_width > min_size.width()) | 327 if (title_width > min_size.width()) |
328 min_size.set_width(title_width); | 328 min_size.set_width(title_width); |
329 return min_size; | 329 return min_size; |
330 } | 330 } |
331 | 331 |
332 gfx::Size FramePainter::GetMaximumSize(views::NonClientFrameView* view) { | 332 gfx::Size FramePainter::GetMaximumSize(views::NonClientFrameView* view) { |
333 return frame_->client_view()->GetMaximumSize(); | 333 return frame_->client_view()->GetMaximumSize(); |
334 } | 334 } |
335 | 335 |
336 int FramePainter::GetRightInset() const { | 336 int FramePainter::GetRightInset() const { |
337 gfx::Size close_size = close_button_->GetPreferredSize(); | 337 gfx::Size close_size = close_button_->GetPreferredSize(); |
338 gfx::Size size_button_size = size_button_->GetPreferredSize(); | 338 gfx::Size size_button_size = size_button_->GetPreferredSize(); |
339 int inset = close_size.width() + kCloseButtonOffsetX + | 339 int inset = close_size.width() + kCloseButtonOffsetX + |
340 size_button_size.width() + kSizeButtonOffsetX; | 340 size_button_size.width() + kSizeButtonOffsetX; |
341 if (immersive_button_) { | 341 if (immersive_button_ && immersive_button_->visible()) { |
342 gfx::Size immersive_size = immersive_button_->GetPreferredSize(); | 342 gfx::Size immersive_size = immersive_button_->GetPreferredSize(); |
343 inset += immersive_size.width() + kImmersiveButtonOffsetX; | 343 inset += immersive_size.width() + kImmersiveButtonOffsetX; |
344 } | 344 } |
345 return inset; | 345 return inset; |
346 } | 346 } |
347 | 347 |
348 int FramePainter::GetThemeBackgroundXInset() const { | 348 int FramePainter::GetThemeBackgroundXInset() const { |
349 return kThemeFrameImageInsetX; | 349 return kThemeFrameImageInsetX; |
350 } | 350 } |
351 | 351 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 int title_y = | 873 int title_y = |
874 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; | 874 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; |
875 return gfx::Rect( | 875 return gfx::Rect( |
876 title_x, | 876 title_x, |
877 std::max(0, title_y), | 877 std::max(0, title_y), |
878 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), | 878 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), |
879 title_font.GetHeight()); | 879 title_font.GetHeight()); |
880 } | 880 } |
881 | 881 |
882 } // namespace ash | 882 } // namespace ash |
OLD | NEW |