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 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/message_center/message_center_style.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace message_center {
const char ProportionalImageView::kViewClassName[] = "ProportionalImageView";
ProportionalImageView::ProportionalImageView(const gfx::Size& view_size) {
SetPreferredSize(view_size);
}
......@@ -43,10 +42,6 @@ void ProportionalImageView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawImageInt(image, draw_bounds.x(), draw_bounds.y());
}
const char* ProportionalImageView::GetClassName() const {
return kViewClassName;
}
gfx::Size ProportionalImageView::GetImageDrawingSize() {
if (!GetVisible())
return gfx::Size();
......@@ -56,4 +51,7 @@ gfx::Size ProportionalImageView::GetImageDrawingSize() {
return GetImageSizeForContainerSize(max_size, image_.size());
}
BEGIN_METADATA(ProportionalImageView, views::View)
END_METADATA
} // namespace message_center
......@@ -16,10 +16,10 @@ namespace message_center {
// original proportions.
class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View {
public:
// Internal class name.
static const char kViewClassName[];
METADATA_HEADER(ProportionalImageView);
explicit ProportionalImageView(const gfx::Size& view_size);
ProportionalImageView(const ProportionalImageView&) = delete;
ProportionalImageView& operator=(const ProportionalImageView&) = delete;
~ProportionalImageView() override;
// |image| is scaled to fit within |view_size| and |max_image_size| while
......@@ -31,17 +31,14 @@ class MESSAGE_CENTER_EXPORT ProportionalImageView : public views::View {
// Overridden from views::View:
void OnPaint(gfx::Canvas* canvas) override;
const char* GetClassName() const override;
private:
gfx::Size GetImageDrawingSize();
gfx::ImageSkia image_;
gfx::Size max_image_size_;
DISALLOW_COPY_AND_ASSIGN(ProportionalImageView);
};
} // namespace message_center
#endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
#endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
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