summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 19:56:42 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-13 19:56:42 +0000
commita562cb7d8304af4d5d04a6d8e63e455e5077d3cd (patch)
tree4b04f108588386e4754af750bd4a9e1d0b042929 /chrome/browser
parentdbb8211ed7a2a52da822cd5304096cea366c1fb6 (diff)
downloadchromium_src-a562cb7d8304af4d5d04a6d8e63e455e5077d3cd.zip
chromium_src-a562cb7d8304af4d5d04a6d8e63e455e5077d3cd.tar.gz
chromium_src-a562cb7d8304af4d5d04a6d8e63e455e5077d3cd.tar.bz2
Use system title bar font for app windows, detached popups, constrained popups.
http://crbug.com/3376 Review URL: http://codereview.chromium.org/7274 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/constrained_window_impl.cc8
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc18
2 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 8cb16f8..76e3eb1 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -603,6 +603,12 @@ void ConstrainedWindowNonClientView::Layout() {
int title_left = icon_bounds_.right() + spacing;
title_bounds_.SetRect(title_left, kTitleTopOffset,
title_right - title_left, title_font_.height());
+
+ // Center the icon within the vertical bounds of the title if the title
+ // is taller.
+ int delta_y = title_bounds_.height() - icon_bounds_.height();
+ if (delta_y > 0)
+ icon_bounds_.set_y(title_bounds_.y() + static_cast<int>(delta_y / 2));
}
}
@@ -770,6 +776,8 @@ void ConstrainedWindowNonClientView::InitClass() {
throbber_frame_count_ =
throbber_frames_.width() / throbber_frames_.height();
+ title_font_ = win_util::GetWindowTitleFont();
+
initialized = true;
}
}
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 19628c8..f3b3afa 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -11,6 +11,7 @@
#include "chrome/common/gfx/path.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
+#include "chrome/common/win_util.h"
#include "chrome/views/root_view.h"
#include "chrome/views/window_resources.h"
#include "chromium_strings.h"
@@ -306,7 +307,7 @@ static const int kWindowIconLeftOffset = 5;
static const int kWindowIconTopOffset = 5;
// The distance between the window icon and the window title when a title-bar
// is showing.
-static const int kWindowIconTitleSpacing = 3;
+static const int kWindowIconTitleSpacing = 4;
// The distance between the top of the window and the title text when a
// title-bar is showing.
static const int kTitleTopOffset = 6;
@@ -985,8 +986,6 @@ void OpaqueNonClientView::LayoutTitleBar() {
icon_bounds_.SetRect(kWindowIconLeftOffset, kWindowIconLeftOffset,
show_icon ? kWindowIconSize : 0,
show_icon ? kWindowIconSize : 0);
- if (window_icon_)
- window_icon_->SetBounds(icon_bounds_.ToRECT());
// Size the title, if visible.
if (d->ShouldShowWindowTitle()) {
@@ -997,7 +996,17 @@ void OpaqueNonClientView::LayoutTitleBar() {
title_bounds_.SetRect(title_left, kTitleTopOffset + top_offset,
std::max(0, static_cast<int>(title_right - icon_right)),
title_font_.height());
+
+ // Adjust the Y-position of the icon to be vertically centered within
+ // the bounds of the title text.
+ int delta_y = title_bounds_.height() - icon_bounds_.height();
+ if (delta_y > 0)
+ icon_bounds_.set_y(title_bounds_.y() + static_cast<int>(delta_y / 2));
}
+
+ // Do this last, after the icon has been moved.
+ if (window_icon_)
+ window_icon_->SetBounds(icon_bounds_.ToRECT());
}
void OpaqueNonClientView::LayoutClientView() {
@@ -1030,8 +1039,7 @@ void OpaqueNonClientView::InitClass() {
void OpaqueNonClientView::InitAppWindowResources() {
static bool initialized = false;
if (!initialized) {
- title_font_ = ResourceBundle::GetSharedInstance().GetFont(
- ResourceBundle::BaseFont).DeriveFont(1, ChromeFont::BOLD);
+ title_font_ = win_util::GetWindowTitleFont();
initialized = true;
}
}