| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/views/frame/app_panel_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/app_panel_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 close_button_size.height() + top_extra_height); | 470 close_button_size.height() + top_extra_height); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void AppPanelBrowserFrameView::LayoutTitleBar() { | 473 void AppPanelBrowserFrameView::LayoutTitleBar() { |
| 474 // Size the icon first; the window title is based on the icon position. | 474 // Size the icon first; the window title is based on the icon position. |
| 475 gfx::Rect icon_bounds(IconBounds()); | 475 gfx::Rect icon_bounds(IconBounds()); |
| 476 window_icon_->SetBounds(icon_bounds); | 476 window_icon_->SetBounds(icon_bounds); |
| 477 | 477 |
| 478 // Size the title. | 478 // Size the title. |
| 479 int title_x = icon_bounds.right() + kIconTitleSpacing; | 479 int title_x = icon_bounds.right() + kIconTitleSpacing; |
| 480 int title_height = BrowserFrame::GetTitleFont().height(); | 480 int title_height = BrowserFrame::GetTitleFont().GetHeight(); |
| 481 // We bias the title position so that when the difference between the icon | 481 // We bias the title position so that when the difference between the icon |
| 482 // and title heights is odd, the extra pixel of the title is above the | 482 // and title heights is odd, the extra pixel of the title is above the |
| 483 // vertical midline rather than below. This compensates for how the icon is | 483 // vertical midline rather than below. This compensates for how the icon is |
| 484 // already biased downwards (see IconBounds()) and helps prevent descenders | 484 // already biased downwards (see IconBounds()) and helps prevent descenders |
| 485 // on the title from overlapping the 3D edge at the bottom of the titlebar. | 485 // on the title from overlapping the 3D edge at the bottom of the titlebar. |
| 486 title_bounds_.SetRect(title_x, | 486 title_bounds_.SetRect(title_x, |
| 487 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), | 487 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), |
| 488 std::max(0, close_button_->x() - kTitleCloseButtonSpacing - title_x), | 488 std::max(0, close_button_->x() - kTitleCloseButtonSpacing - title_x), |
| 489 title_height); | 489 title_height); |
| 490 } | 490 } |
| 491 | 491 |
| 492 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, | 492 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, |
| 493 int height) const { | 493 int height) const { |
| 494 int top_height = NonClientTopBorderHeight(); | 494 int top_height = NonClientTopBorderHeight(); |
| 495 int border_thickness = NonClientBorderThickness(); | 495 int border_thickness = NonClientBorderThickness(); |
| 496 return gfx::Rect(border_thickness, top_height, | 496 return gfx::Rect(border_thickness, top_height, |
| 497 std::max(0, width - (2 * border_thickness)), | 497 std::max(0, width - (2 * border_thickness)), |
| 498 std::max(0, height - top_height - border_thickness)); | 498 std::max(0, height - top_height - border_thickness)); |
| 499 } | 499 } |
| OLD | NEW |