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

Unified Diff: ash/accelerators/exit_warning_handler.cc

Issue 2901503003: Rename GetPreferredSize to CalculatePreferredSize in ash/ (Closed)
Patch Set: improvements Created 3 years, 7 months 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 | « no previous file | ash/autoclick/common/autoclick_ring_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/exit_warning_handler.cc
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc
index 7b8f3c5ac2a2cd4abffff98876e3ba5e3038df9f..f5d70abeb718b5f21f1204c3b0f536381bc9a9e0 100644
--- a/ash/accelerators/exit_warning_handler.cc
+++ b/ash/accelerators/exit_warning_handler.cc
@@ -45,15 +45,14 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
: text_(l10n_util::GetStringUTF16(IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT)),
accessible_name_(l10n_util::GetStringUTF16(
IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT_ACCESSIBLE)),
- text_width_(0),
- width_(0),
- height_(0) {
+ text_width_(0) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::FontList& font_list =
rb.GetFontList(ui::ResourceBundle::LargeFont);
text_width_ = gfx::GetStringWidth(text_, font_list);
- width_ = text_width_ + kHorizontalMarginAroundText;
- height_ = font_list.GetHeight() + kVerticalMarginAroundText;
+ set_preferred_size(
+ gfx::Size(text_width_ + kHorizontalMarginAroundText,
+ font_list.GetHeight() + kVerticalMarginAroundText));
views::Label* label = new views::Label();
label->SetText(text_);
label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
@@ -66,10 +65,6 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
SetLayoutManager(new views::FillLayout);
}
- gfx::Size GetPreferredSize() const override {
- return gfx::Size(width_, height_);
- }
-
void OnPaint(gfx::Canvas* canvas) override {
cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style);
@@ -87,8 +82,6 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
base::string16 text_;
base::string16 accessible_name_;
int text_width_;
- int width_;
- int height_;
DISALLOW_COPY_AND_ASSIGN(ExitWarningWidgetDelegateView);
};
« no previous file with comments | « no previous file | ash/autoclick/common/autoclick_ring_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698