Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: ui/message_center/views/proportional_image_view.h

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
7 7
8 #include "ui/gfx/image/image_skia.h" 8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 10
11 namespace message_center { 11 namespace message_center {
12 12
13 // ProportionalImageViews center their images to preserve their proportion. 13 // ProportionalImageViews center their images to preserve their proportion.
14 class ProportionalImageView : public views::View { 14 class ProportionalImageView : public views::View {
15 public: 15 public:
16 ProportionalImageView(const gfx::ImageSkia& image, const gfx::Size& max_size); 16 ProportionalImageView(const gfx::ImageSkia& image, const gfx::Size& max_size);
17 virtual ~ProportionalImageView(); 17 virtual ~ProportionalImageView();
18 18
19 // Overridden from views::View: 19 // Overridden from views::View:
20 virtual gfx::Size GetPreferredSize() OVERRIDE; 20 virtual gfx::Size GetPreferredSize() const OVERRIDE;
21 virtual int GetHeightForWidth(int width) OVERRIDE; 21 virtual int GetHeightForWidth(int width) const OVERRIDE;
22 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 22 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
23 23
24 private: 24 private:
25 gfx::Size GetImageDrawingSize(); 25 gfx::Size GetImageDrawingSize();
26 26
27 gfx::ImageSkia image_; 27 gfx::ImageSkia image_;
28 gfx::Size max_size_; 28 gfx::Size max_size_;
29 29
30 DISALLOW_COPY_AND_ASSIGN(ProportionalImageView); 30 DISALLOW_COPY_AND_ASSIGN(ProportionalImageView);
31 }; 31 };
32 32
33 } // namespace message_center 33 } // namespace message_center
34 34
35 #endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_ 35 #endif // UI_MESSAGE_CENTER_VIEWS_PROPORTIONAL_IMAGE_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/padded_button.cc ('k') | ui/message_center/views/proportional_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698