Commit c1f8a306 authored by Sara Kato's avatar Sara Kato Committed by Chromium LUCI CQ

views-posse: Add metadata to proportional_image_view

Bug: 1159562
Test: build
Change-Id: I48f18f8d345e34c219c58f5e5599f8e8fa7f1420
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616052Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Sara Kato <sarakato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844626}
parent 18502f05
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/image/image_skia_operations.h"
#include "ui/message_center/message_center_style.h" #include "ui/message_center/message_center_style.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace message_center { namespace message_center {
const char ProportionalImageView::kViewClassName[] = "ProportionalImageView";
ProportionalImageView::ProportionalImageView(const gfx::Size& view_size) { ProportionalImageView::ProportionalImageView(const gfx::Size& view_size) {
SetPreferredSize(view_size); SetPreferredSize(view_size);
} }
...@@ -43,10 +42,6 @@ void ProportionalImageView::OnPaint(gfx::Canvas* canvas) { ...@@ -43,10 +42,6 @@ void ProportionalImageView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawImageInt(image, draw_bounds.x(), draw_bounds.y()); canvas->DrawImageInt(image, draw_bounds.x(), draw_bounds.y());
} }
const char* ProportionalImageView::GetClassName() const {
return kViewClassName;
}
gfx::Size ProportionalImageView::GetImageDrawingSize() { gfx::Size ProportionalImageView::GetImageDrawingSize() {
if (!GetVisible()) if (!GetVisible())
return gfx::Size(); return gfx::Size();
...@@ -56,4 +51,7 @@ gfx::Size ProportionalImageView::GetImageDrawingSize() { ...@@ -56,4 +51,7 @@ gfx::Size ProportionalImageView::GetImageDrawingSize() {
return GetImageSizeForContainerSize(max_size, image_.size()); return GetImageSizeForContainerSize(max_size, image_.size());
} }
BEGIN_METADATA(ProportionalImageView, views::View)
END_METADATA
} // namespace message_center } // namespace message_center
...@@ -16,10 +16,10 @@ namespace message_center { ...@@ -16,10 +16,10 @@ namespace message_center {
// original proportions. // original proportions.
class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View { class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View {
public: public:
// Internal class name. METADATA_HEADER(ProportionalImageView);
static const char kViewClassName[];
explicit ProportionalImageView(const gfx::Size& view_size); explicit ProportionalImageView(const gfx::Size& view_size);
ProportionalImageView(const ProportionalImageView&) = delete;
ProportionalImageView& operator=(const ProportionalImageView&) = delete;
~ProportionalImageView() override; ~ProportionalImageView() override;
// |image| is scaled to fit within |view_size| and |max_image_size| while // |image| is scaled to fit within |view_size| and |max_image_size| while
...@@ -31,15 +31,12 @@ class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View { ...@@ -31,15 +31,12 @@ class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View {
// Overridden from views::View: // Overridden from views::View:
void OnPaint(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override;
const char* GetClassName() const override;
private: private:
gfx::Size GetImageDrawingSize(); gfx::Size GetImageDrawingSize();
gfx::ImageSkia image_; gfx::ImageSkia image_;
gfx::Size max_image_size_; gfx::Size max_image_size_;
DISALLOW_COPY_AND_ASSIGN(ProportionalImageView);
}; };
} // namespace message_center } // namespace message_center
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment