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

Side by Side Diff: ui/message_center/views/bounded_label.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/message_center/views/bounded_label.h" 5 #include "ui/message_center/views/bounded_label.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 gfx::Size BoundedLabel::GetSizeForWidthAndLines(int width, int lines) { 313 gfx::Size BoundedLabel::GetSizeForWidthAndLines(int width, int lines) {
314 return visible() ? 314 return visible() ?
315 label_->GetSizeForWidthAndLines(width, lines) : gfx::Size(); 315 label_->GetSizeForWidthAndLines(width, lines) : gfx::Size();
316 } 316 }
317 317
318 int BoundedLabel::GetBaseline() const { 318 int BoundedLabel::GetBaseline() const {
319 return label_->GetBaseline(); 319 return label_->GetBaseline();
320 } 320 }
321 321
322 gfx::Size BoundedLabel::GetPreferredSize() { 322 gfx::Size BoundedLabel::GetPreferredSize() const {
323 return visible() ? label_->GetSizeForWidthAndLines(-1, -1) : gfx::Size(); 323 return visible() ? label_->GetSizeForWidthAndLines(-1, -1) : gfx::Size();
324 } 324 }
325 325
326 int BoundedLabel::GetHeightForWidth(int width) { 326 int BoundedLabel::GetHeightForWidth(int width) const {
327 return visible() ? 327 return visible() ?
328 label_->GetSizeForWidthAndLines(width, line_limit_).height() : 0; 328 label_->GetSizeForWidthAndLines(width, line_limit_).height() : 0;
329 } 329 }
330 330
331 void BoundedLabel::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) { 331 void BoundedLabel::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) {
332 if (visible()) 332 if (visible())
333 label_->Paint(canvas, cull_set); 333 label_->Paint(canvas, cull_set);
334 } 334 }
335 335
336 bool BoundedLabel::HitTestRect(const gfx::Rect& rect) const { 336 bool BoundedLabel::HitTestRect(const gfx::Rect& rect) const {
(...skipping 11 matching lines...) Expand all
348 348
349 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { 349 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) {
350 label_->SetNativeTheme(theme); 350 label_->SetNativeTheme(theme);
351 } 351 }
352 352
353 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { 353 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) {
354 return JoinString(label_->GetWrappedText(width, lines), '\n'); 354 return JoinString(label_->GetWrappedText(width, lines), '\n');
355 } 355 }
356 356
357 } // namespace message_center 357 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/bounded_label.h ('k') | ui/message_center/views/message_center_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698