| OLD | NEW |
| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 int BoundedLabel::GetHeightForWidth(int width) { | 321 int BoundedLabel::GetHeightForWidth(int width) { |
| 322 return visible() ? | 322 return visible() ? |
| 323 label_->GetSizeForWidthAndLines(width, line_limit_).height() : 0; | 323 label_->GetSizeForWidthAndLines(width, line_limit_).height() : 0; |
| 324 } | 324 } |
| 325 | 325 |
| 326 void BoundedLabel::Paint(gfx::Canvas* canvas) { | 326 void BoundedLabel::Paint(gfx::Canvas* canvas) { |
| 327 if (visible()) | 327 if (visible()) |
| 328 label_->Paint(canvas); | 328 label_->Paint(canvas); |
| 329 } | 329 } |
| 330 | 330 |
| 331 bool BoundedLabel::HitTestRect(const gfx::Rect& rect) const { | 331 bool BoundedLabel::HitTestRect(const gfx::RectF& rect) const { |
| 332 return label_->HitTestRect(rect); | 332 return label_->HitTestRect(rect); |
| 333 } | 333 } |
| 334 | 334 |
| 335 void BoundedLabel::GetAccessibleState(ui::AXViewState* state) { | 335 void BoundedLabel::GetAccessibleState(ui::AXViewState* state) { |
| 336 label_->GetAccessibleState(state); | 336 label_->GetAccessibleState(state); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void BoundedLabel::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 339 void BoundedLabel::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 340 label_->SetBoundsRect(bounds()); | 340 label_->SetBoundsRect(bounds()); |
| 341 views::View::OnBoundsChanged(previous_bounds); | 341 views::View::OnBoundsChanged(previous_bounds); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 344 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 345 label_->SetNativeTheme(theme); | 345 label_->SetNativeTheme(theme); |
| 346 } | 346 } |
| 347 | 347 |
| 348 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { | 348 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { |
| 349 return JoinString(label_->GetWrappedText(width, lines), '\n'); | 349 return JoinString(label_->GetWrappedText(width, lines), '\n'); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace message_center | 352 } // namespace message_center |
| OLD | NEW |