| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ | 5 #ifndef UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ |
| 6 #define UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/aura/window_delegate.h" | 9 #include "ui/aura/window_delegate.h" |
| 10 #include "ui/aura_extra/aura_extra_export.h" | 10 #include "ui/aura_extra/aura_extra_export.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // The delegate destroys itself when the Window is destroyed. This is done in | 21 // The delegate destroys itself when the Window is destroyed. This is done in |
| 22 // |OnWindowDestroyed()| function which subclasses can override to prevent | 22 // |OnWindowDestroyed()| function which subclasses can override to prevent |
| 23 // self-destroying. | 23 // self-destroying. |
| 24 class AURA_EXTRA_EXPORT ImageWindowDelegate : public aura::WindowDelegate { | 24 class AURA_EXTRA_EXPORT ImageWindowDelegate : public aura::WindowDelegate { |
| 25 public: | 25 public: |
| 26 ImageWindowDelegate(); | 26 ImageWindowDelegate(); |
| 27 | 27 |
| 28 void SetImage(const gfx::Image& image); | 28 void SetImage(const gfx::Image& image); |
| 29 | 29 |
| 30 void set_background_color(SkColor color) { background_color_ = color; } | 30 void set_background_color(SkColor color) { background_color_ = color; } |
| 31 void set_image_offset(gfx::Vector2d offset) { offset_ = offset; } | 31 void set_image_offset(const gfx::Vector2d& offset) { offset_ = offset; } |
| 32 | 32 |
| 33 bool has_image() const { return !image_.IsEmpty(); } | 33 bool has_image() const { return !image_.IsEmpty(); } |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 ~ImageWindowDelegate() override; | 36 ~ImageWindowDelegate() override; |
| 37 | 37 |
| 38 // Overridden from aura::WindowDelegate: | 38 // Overridden from aura::WindowDelegate: |
| 39 gfx::Size GetMinimumSize() const override; | 39 gfx::Size GetMinimumSize() const override; |
| 40 gfx::Size GetMaximumSize() const override; | 40 gfx::Size GetMaximumSize() const override; |
| 41 void OnBoundsChanged(const gfx::Rect& old_bounds, | 41 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 67 // the image size is smaller than the window size, then the delegate fills the | 67 // the image size is smaller than the window size, then the delegate fills the |
| 68 // missing regions with |background_color_| (defult is white). | 68 // missing regions with |background_color_| (defult is white). |
| 69 bool size_mismatch_; | 69 bool size_mismatch_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ImageWindowDelegate); | 71 DISALLOW_COPY_AND_ASSIGN(ImageWindowDelegate); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace aura_extra | 74 } // namespace aura_extra |
| 75 | 75 |
| 76 #endif // UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ | 76 #endif // UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_ |
| OLD | NEW |