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

Side by Side Diff: chrome/browser/ui/views/sad_tab_view.cc

Issue 5158006: Convert SizeStringInt from taking a wstring to a string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/username_view.cc ('k') | gfx/canvas_skia.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/sad_tab_view.h" 5 #include "chrome/browser/views/sad_tab_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/utf_string_conversions.h"
9 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 11 #include "chrome/browser/tab_contents/tab_contents.h"
11 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 12 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
12 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
13 #include "gfx/canvas.h" 14 #include "gfx/canvas.h"
14 #include "gfx/canvas_skia.h" 15 #include "gfx/canvas_skia.h"
15 #include "gfx/size.h" 16 #include "gfx/size.h"
16 #include "gfx/skia_util.h" 17 #include "gfx/skia_util.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
18 #include "grit/locale_settings.h" 19 #include "grit/locale_settings.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 icon_bounds_.SetRect(icon_x, icon_y, icon_width, icon_height); 89 icon_bounds_.SetRect(icon_x, icon_y, icon_width, icon_height);
89 90
90 int title_x = (width() - title_width_) / 2; 91 int title_x = (width() - title_width_) / 2;
91 int title_y = icon_bounds_.bottom() + kIconTitleSpacing; 92 int title_y = icon_bounds_.bottom() + kIconTitleSpacing;
92 int title_height = title_font_->GetHeight(); 93 int title_height = title_font_->GetHeight();
93 title_bounds_.SetRect(title_x, title_y, title_width_, title_height); 94 title_bounds_.SetRect(title_x, title_y, title_width_, title_height);
94 95
95 gfx::CanvasSkia cc(0, 0, true); 96 gfx::CanvasSkia cc(0, 0, true);
96 int message_width = static_cast<int>(width() * kMessageSize); 97 int message_width = static_cast<int>(width() * kMessageSize);
97 int message_height = 0; 98 int message_height = 0;
98 cc.SizeStringInt(message_, *message_font_, &message_width, &message_height, 99 cc.SizeStringInt(WideToUTF16Hack(message_), *message_font_, &message_width,
99 gfx::Canvas::MULTI_LINE); 100 &message_height, gfx::Canvas::MULTI_LINE);
100 int message_x = (width() - message_width) / 2; 101 int message_x = (width() - message_width) / 2;
101 int message_y = title_bounds_.bottom() + kTitleMessageSpacing; 102 int message_y = title_bounds_.bottom() + kTitleMessageSpacing;
102 message_bounds_.SetRect(message_x, message_y, message_width, message_height); 103 message_bounds_.SetRect(message_x, message_y, message_width, message_height);
103 104
104 if (learn_more_link_ != NULL) { 105 if (learn_more_link_ != NULL) {
105 gfx::Size sz = learn_more_link_->GetPreferredSize(); 106 gfx::Size sz = learn_more_link_->GetPreferredSize();
106 gfx::Insets insets = learn_more_link_->GetInsets(); 107 gfx::Insets insets = learn_more_link_->GetInsets();
107 link_bounds_.SetRect((width() - sz.width()) / 2, 108 link_bounds_.SetRect((width() - sz.width()) / 2,
108 message_bounds_.bottom() + kTitleMessageSpacing - 109 message_bounds_.bottom() + kTitleMessageSpacing -
109 insets.top(), sz.width(), sz.height()); 110 insets.top(), sz.width(), sz.height());
(...skipping 28 matching lines...) Expand all
138 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); 139 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1));
139 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); 140 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB);
140 141
141 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); 142 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE);
142 title_width_ = title_font_->GetStringWidth(title_); 143 title_width_ = title_font_->GetStringWidth(title_);
143 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); 144 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE);
144 145
145 initialized = true; 146 initialized = true;
146 } 147 }
147 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/username_view.cc ('k') | gfx/canvas_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698