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

Unified Diff: ui/aura_extra/image_window_delegate.h

Issue 880703002: Move ImageWindowDelegate to ui/aura_extra (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated a comment Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura_extra/aura_extra_export.h ('k') | ui/aura_extra/image_window_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_extra/image_window_delegate.h
diff --git a/content/browser/web_contents/aura/image_window_delegate.h b/ui/aura_extra/image_window_delegate.h
similarity index 62%
rename from content/browser/web_contents/aura/image_window_delegate.h
rename to ui/aura_extra/image_window_delegate.h
index a36110d40c25501d56c26122d1194eba5187f4c4..527b84d626564cfd254d1353cea2e5584dbaa1de 100644
--- a/content/browser/web_contents/aura/image_window_delegate.h
+++ b/ui/aura_extra/image_window_delegate.h
@@ -2,23 +2,34 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_
-#define CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_
+#ifndef UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_
+#define UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_
-#include "content/common/content_export.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/window_delegate.h"
+#include "ui/aura_extra/aura_extra_export.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/image/image.h"
-namespace content {
+namespace aura_extra {
-// An ImageWindowDelegate paints an image for a Window. The delegate destroys
-// itself when the Window is destroyed. The delegate does not consume any event.
-class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
+// An ImageWindowDelegate paints an image for a Window, possibly also filling
+// the window with a specified backround color. The delegate does not consume
+// any event.
+//
+// The delegate destroys itself when the Window is destroyed. This is done in
+// |OnWindowDestroyed()| function which subclasses can override to prevent
+// self-destroying.
+class AURA_EXTRA_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
public:
ImageWindowDelegate();
void SetImage(const gfx::Image& image);
+
+ void set_background_color(SkColor color) { background_color_ = color; }
+ void set_image_offset(gfx::Vector2d offset) { offset_ = offset; }
+
bool has_image() const { return !image_.IsEmpty(); }
protected:
@@ -45,17 +56,20 @@ class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
void GetHitTestMask(gfx::Path* mask) const override;
protected:
+ SkColor background_color_;
gfx::Image image_;
+ gfx::Vector2d offset_;
+
gfx::Size window_size_;
// Keeps track of whether the window size matches the image size or not. If
- // the image size is smaller than the window size, then the delegate paints a
- // white background for the missing regions.
+ // the image size is smaller than the window size, then the delegate fills the
+ // missing regions with |background_color_| (defult is white).
bool size_mismatch_;
DISALLOW_COPY_AND_ASSIGN(ImageWindowDelegate);
};
-} // namespace content
+} // namespace aura_extra
-#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_IMAGE_WINDOW_DELEGATE_H_
+#endif // UI_AURA_EXTRA_IMAGE_WINDOW_DELEGATE_H_
« no previous file with comments | « ui/aura_extra/aura_extra_export.h ('k') | ui/aura_extra/image_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698