Chromium Code Reviews| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 gfx::Canvas* canvas) { | 485 gfx::Canvas* canvas) { |
| 486 // Paint the line just above the content area. | 486 // Paint the line just above the content area. |
| 487 gfx::Rect client_bounds = view->GetBoundsForClientView(); | 487 gfx::Rect client_bounds = view->GetBoundsForClientView(); |
| 488 canvas->FillRect(gfx::Rect(client_bounds.x(), | 488 canvas->FillRect(gfx::Rect(client_bounds.x(), |
| 489 client_bounds.y() - kHeaderContentSeparatorSize, | 489 client_bounds.y() - kHeaderContentSeparatorSize, |
| 490 client_bounds.width(), | 490 client_bounds.width(), |
| 491 kHeaderContentSeparatorSize), | 491 kHeaderContentSeparatorSize), |
| 492 kHeaderContentSeparatorColor); | 492 kHeaderContentSeparatorColor); |
| 493 } | 493 } |
| 494 | 494 |
| 495 int FramePainter::HeaderContentSeparatorSize() const { | 495 int FramePainter::HeaderHeight() const { |
| 496 return kHeaderContentSeparatorSize; | 496 int bottom_y = std::max(size_button_->bounds().bottom(), |
| 497 close_button_->bounds().bottom()); | |
| 498 return (bottom_y - 1) + kHeaderContentSeparatorSize; | |
|
James Cook
2012/11/20 22:08:41
nit: Consider documenting that the -1 is because t
| |
| 497 } | 499 } |
| 498 | 500 |
| 499 void FramePainter::PaintTitleBar(views::NonClientFrameView* view, | 501 void FramePainter::PaintTitleBar(views::NonClientFrameView* view, |
| 500 gfx::Canvas* canvas, | 502 gfx::Canvas* canvas, |
| 501 const gfx::Font& title_font) { | 503 const gfx::Font& title_font) { |
| 502 // The window icon is painted by its own views::View. | 504 // The window icon is painted by its own views::View. |
| 503 views::WidgetDelegate* delegate = frame_->widget_delegate(); | 505 views::WidgetDelegate* delegate = frame_->widget_delegate(); |
| 504 if (delegate && delegate->ShouldShowWindowTitle()) { | 506 if (delegate && delegate->ShouldShowWindowTitle()) { |
| 505 gfx::Rect title_bounds = GetTitleBounds(view, title_font); | 507 gfx::Rect title_bounds = GetTitleBounds(view, title_font); |
| 506 canvas->DrawStringInt(delegate->GetWindowTitle(), | 508 canvas->DrawStringInt(delegate->GetWindowTitle(), |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 854 int title_y = | 856 int title_y = |
| 855 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; | 857 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; |
| 856 return gfx::Rect( | 858 return gfx::Rect( |
| 857 title_x, | 859 title_x, |
| 858 std::max(0, title_y), | 860 std::max(0, title_y), |
| 859 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), | 861 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), |
| 860 title_font.GetHeight()); | 862 title_font.GetHeight()); |
| 861 } | 863 } |
| 862 | 864 |
| 863 } // namespace ash | 865 } // namespace ash |
| OLD | NEW |