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
3 // found in the LICENSE file.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/view.h"
11 namespace message_center
{
13 // ProportionalImageViews center their images to preserve their proportion.
14 class ProportionalImageView
: public views::View
{
16 ProportionalImageView(const gfx::ImageSkia
& image
, const gfx::Size
& max_size
);
17 ~ProportionalImageView() override
;
19 // Overridden from views::View:
20 gfx::Size
GetPreferredSize() const override
;
21 int GetHeightForWidth(int width
) const override
;
22 void OnPaint(gfx::Canvas
* canvas
) override
;
25 gfx::Size
GetImageDrawingSize();
27 gfx::ImageSkia image_
;
30 DISALLOW_COPY_AND_ASSIGN(ProportionalImageView
);
33 } // namespace message_center
35 #endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_