Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / message_center / views / proportional_image_view.h
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.
4
5 #ifndef UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
7
8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/view.h"
10
11 namespace message_center {
12
13 // ProportionalImageViews center their images to preserve their proportion.
14 class ProportionalImageView : public views::View {
15  public:
16   ProportionalImageView(const gfx::ImageSkia& image, const gfx::Size& max_size);
17   ~ProportionalImageView() override;
18
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;
23
24  private:
25   gfx::Size GetImageDrawingSize();
26
27   gfx::ImageSkia image_;
28   gfx::Size max_size_;
29
30   DISALLOW_COPY_AND_ASSIGN(ProportionalImageView);
31 };
32
33 }  // namespace message_center
34
35 #endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_