summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/first_run_bubble.cc
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 00:42:11 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 00:42:11 +0000
commit358e4745427bb4a8a28545c2c4718978c493c531 (patch)
tree0673c7820a4259f9cf69ba806a0a1f080200e062 /chrome/browser/views/first_run_bubble.cc
parenta050d710a6d7a00e79cd2dc2f8fe58569e504631 (diff)
downloadchromium_src-358e4745427bb4a8a28545c2c4718978c493c531.zip
chromium_src-358e4745427bb4a8a28545c2c4718978c493c531.tar.gz
chromium_src-358e4745427bb4a8a28545c2c4718978c493c531.tar.bz2
Fix first run OEM bubble size issue.
BUG= 20267 TEST= Force the first run OEM bubble to appear on a Windows machine with "classic" and "aero" theme. Note that the box is large enough to contain the text in both cases. Review URL: http://codereview.chromium.org/374001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/first_run_bubble.cc')
-rw-r--r--chrome/browser/views/first_run_bubble.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc
index a0233be4..4c9c95d 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/views/first_run_bubble.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/views/first_run_bubble.h"
+#include "app/gfx/font_util.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "app/win_util.h"
#include "base/win_util.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
@@ -334,9 +336,28 @@ void FirstRunOEMBubbleView::Layout() {
}
gfx::Size FirstRunOEMBubbleView::GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
- IDS_FIRSTRUNOEMBUBBLE_DIALOG_WIDTH_CHARS,
- IDS_FIRSTRUNOEMBUBBLE_DIALOG_HEIGHT_LINES));
+ // Calculate width based on font and text.
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ const gfx::Font& font = rb.GetFont(
+ ResourceBundle::MediumFont).DeriveFont(3, gfx::Font::BOLD);
+ gfx::Size size = gfx::Size(
+ gfx::GetLocalizedContentsWidthForFont(
+ IDS_FIRSTRUNOEMBUBBLE_DIALOG_WIDTH_CHARS, font),
+ gfx::GetLocalizedContentsHeightForFont(
+ IDS_FIRSTRUNOEMBUBBLE_DIALOG_HEIGHT_LINES, font));
+
+ // WARNING: HACK. Vista and XP calculate font size differently; this means
+ // that a dialog box correctly proportioned for XP will appear too large in
+ // Vista. The correct thing to do is to change font size calculations in
+ // XP or Vista so that the length of a string is calculated properly. For
+ // now, we force Vista to show a correctly-sized box by taking account of
+ // the difference in font size calculation. The coefficient should not be
+ // stored in a variable because it's a hack and should go away.
+ if (win_util::ShouldUseVistaFrame()) {
+ size.set_width(static_cast<int>(size.width() * 0.85));
+ size.set_height(static_cast<int>(size.height() * 0.85));
+ }
+ return size;
}
void FirstRunOEMBubbleView::FocusWillChange(View* focused_before,