Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / views / widget / widget_observer.h
blob2cad7142e2584eb592c64f4c138a7d707d1c5452
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_
6 #define UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_
8 #include "ui/views/views_export.h"
10 namespace gfx {
11 class Rect;
14 namespace views {
16 class Widget;
17 class View;
19 // Observers can listen to various events on the Widgets.
20 class VIEWS_EXPORT WidgetObserver {
21 public:
22 // The closing notification is sent immediately in response to (i.e. in the
23 // same call stack as) a request to close the Widget (via Close() or
24 // CloseNow()).
25 virtual void OnWidgetClosing(Widget* widget) {}
27 // Invoked after notification is received from the event loop that the native
28 // widget has been created.
29 virtual void OnWidgetCreated(Widget* widget) {}
31 // The destroying event occurs immediately before the widget is destroyed.
32 // This typically occurs asynchronously with respect the the close request, as
33 // a result of a later invocation from the event loop.
34 virtual void OnWidgetDestroying(Widget* widget) {}
36 // Invoked after notification is received from the event loop that the native
37 // widget has been destroyed.
38 virtual void OnWidgetDestroyed(Widget* widget) {}
40 virtual void OnWidgetVisibilityChanging(Widget* widget, bool visible) {}
42 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {}
44 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {}
46 virtual void OnWidgetBoundsChanged(Widget* widget,
47 const gfx::Rect& new_bounds) {}
49 protected:
50 virtual ~WidgetObserver() {}
53 } // namespace views
55 #endif // UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_