Index: views/view.h |
diff --git a/views/view.h b/views/view.h |
index c188531537a91bf0919c72854bf614d7a504dafb..7371a3e89a68904bbb5f69e25c088381fd1065fb 100644 |
--- a/views/view.h |
+++ b/views/view.h |
@@ -57,6 +57,7 @@ class FocusTraversable; |
class InputMethod; |
class LayerPropertySetter; |
class LayoutManager; |
+class PaintListener; |
class ScrollView; |
class TextInputClient; |
class Widget; |
@@ -476,6 +477,12 @@ class VIEWS_EXPORT View : public AcceleratorTarget { |
// Get the theme provider from the parent widget. |
virtual ui::ThemeProvider* GetThemeProvider() const; |
+ // Add/Remove listeners that are notified when painting and compositing end. |
+ // The view does not own the listeners, and it is the responsibility of the |
+ // listener to remove itself when it is done listening. |
+ void AddPaintListener(PaintListener* listener); |
+ void RemovePaintListener(PaintListener* listener); |
+ |
// RTL painting -------------------------------------------------------------- |
// This method determines whether the gfx::Canvas object passed to |
@@ -1104,6 +1111,7 @@ class VIEWS_EXPORT View : public AcceleratorTarget { |
friend class FocusManager; |
friend class ViewStorage; |
friend class Widget; |
+ friend class PaintLock; |
// Used to track a drag. RootView passes this into |
// ProcessMousePressed/Dragged. |
@@ -1229,6 +1237,9 @@ class VIEWS_EXPORT View : public AcceleratorTarget { |
// Accelerated painting ------------------------------------------------------ |
+ // Disables painting during time-critical operations. Used by PaintLock. |
+ void set_painting_enabled(bool enabled) { painting_enabled_ = enabled; } |
+ |
// Returns true if this view should paint to layer. |
bool ShouldPaintToLayer() const; |
@@ -1353,6 +1364,9 @@ class VIEWS_EXPORT View : public AcceleratorTarget { |
// Whether this view is enabled. |
bool enabled_; |
+ // Whether this view is painting. |
+ bool painting_enabled_; |
+ |
// Whether or not RegisterViewForVisibleBoundsNotification on the RootView |
// has been invoked. |
bool registered_for_visible_bounds_notification_; |
@@ -1384,6 +1398,9 @@ class VIEWS_EXPORT View : public AcceleratorTarget { |
// Border. |
scoped_ptr<Border> border_; |
+ // Listeners. These are not owned by the view. |
+ std::set<PaintListener*> paint_listeners_; |
sky
2011/08/26 19:10:25
Use ObserverList (in base) for this.
I don't like
|
+ |
// RTL painting -------------------------------------------------------------- |
// Indicates whether or not the gfx::Canvas object passed to View::Paint() |