Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: chrome/browser/views/first_run_bubble.cc

Issue 374001: Fix first run OEM bubble size issue.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/first_run_bubble.cc
===================================================================
--- chrome/browser/views/first_run_bubble.cc (revision 31117)
+++ chrome/browser/views/first_run_bubble.cc (working copy)
@@ -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 @@
}
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,
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698