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

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: Moved to ui/aura_extra 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
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 64%
rename from content/browser/web_contents/aura/image_window_delegate.h
rename to ui/aura_extra/image_window_delegate.h
index a36110d40c25501d56c26122d1194eba5187f4c4..478bbed973737cbbd8640b58a1dca4090b086916 100644
--- a/content/browser/web_contents/aura/image_window_delegate.h
+++ b/ui/aura_extra/image_window_delegate.h
@@ -2,23 +2,33 @@
// 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. By default the delegate destroys
+// itself when the Window is destroyed. Use |SetSelfDestroy| to override. The
+// delegate does not consume any event.
+class AURA_EXTRA_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
public:
ImageWindowDelegate();
+ void SetBackgroundColor(SkColor color);
sadrul 2015/01/28 18:26:56 set_background_color
mohsen 2015/01/28 21:10:29 Done.
void SetImage(const gfx::Image& image);
+ void SetImageOffset(gfx::Vector2d offset);
sadrul 2015/01/28 18:26:56 set_image_offset
mohsen 2015/01/28 21:10:29 Done.
+
+ // Controls whether the delegate destroys itself when its window is destroyed.
+ void SetSelfDestroy(bool self_destroy);
sadrul 2015/01/28 18:26:56 set_self_destroy()
mohsen 2015/01/28 21:10:29 Done.
+
bool has_image() const { return !image_.IsEmpty(); }
protected:
@@ -45,7 +55,11 @@ class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
void GetHitTestMask(gfx::Path* mask) const override;
protected:
+ SkColor background_color_;
gfx::Image image_;
+ gfx::Vector2d offset_;
+ bool self_destroy_;
+
gfx::Size window_size_;
// Keeps track of whether the window size matches the image size or not. If
@@ -56,6 +70,6 @@ class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
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_

Powered by Google App Engine
This is Rietveld 408576698