OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_VIEWS_WIDGET_WIDGET_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_H_ |
6 #define UI_VIEWS_WIDGET_WIDGET_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <stack> | 9 #include <stack> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "ui/base/accessibility/accessibility_types.h" | 15 #include "ui/base/accessibility/accessibility_types.h" |
16 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
17 #include "ui/compositor/layer_type.h" | 17 #include "ui/compositor/layer_type.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 #include "ui/views/focus/focus_manager.h" | 20 #include "ui/views/focus/focus_manager.h" |
21 #include "ui/views/widget/native_widget_delegate.h" | 21 #include "ui/views/widget/native_widget_delegate.h" |
22 #include "ui/views/widget/widget_observer.h" | |
22 #include "ui/views/window/client_view.h" | 23 #include "ui/views/window/client_view.h" |
23 #include "ui/views/window/non_client_view.h" | 24 #include "ui/views/window/non_client_view.h" |
24 | 25 |
25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
26 // Windows headers define macros for these function names which screw with us. | 27 // Windows headers define macros for these function names which screw with us. |
27 #if defined(IsMaximized) | 28 #if defined(IsMaximized) |
28 #undef IsMaximized | 29 #undef IsMaximized |
29 #endif | 30 #endif |
30 #if defined(IsMinimized) | 31 #if defined(IsMinimized) |
31 #undef IsMinimized | 32 #undef IsMinimized |
(...skipping 21 matching lines...) Expand all Loading... | |
53 namespace views { | 54 namespace views { |
54 | 55 |
55 class DefaultThemeProvider; | 56 class DefaultThemeProvider; |
56 class DesktopRootWindowHost; | 57 class DesktopRootWindowHost; |
57 class InputMethod; | 58 class InputMethod; |
58 class NativeWidget; | 59 class NativeWidget; |
59 class NonClientFrameView; | 60 class NonClientFrameView; |
60 class ScopedEvent; | 61 class ScopedEvent; |
61 class View; | 62 class View; |
62 class WidgetDelegate; | 63 class WidgetDelegate; |
63 class WidgetObserver; | |
64 | 64 |
65 namespace internal { | 65 namespace internal { |
66 class NativeWidgetPrivate; | 66 class NativeWidgetPrivate; |
67 class RootView; | 67 class RootView; |
68 } | 68 } |
69 | 69 |
70 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
71 // Widget class | 71 // Widget class |
72 // | 72 // |
73 // Encapsulates the platform-specific rendering, event receiving and widget | 73 // Encapsulates the platform-specific rendering, event receiving and widget |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
844 // Is |root_layers_| out of date? | 844 // Is |root_layers_| out of date? |
845 bool root_layers_dirty_; | 845 bool root_layers_dirty_; |
846 | 846 |
847 // True when window movement via mouse interaction with the frame should be | 847 // True when window movement via mouse interaction with the frame should be |
848 // disabled. | 848 // disabled. |
849 bool movement_disabled_; | 849 bool movement_disabled_; |
850 | 850 |
851 DISALLOW_COPY_AND_ASSIGN(Widget); | 851 DISALLOW_COPY_AND_ASSIGN(Widget); |
852 }; | 852 }; |
853 | 853 |
854 // A simple WidgetObserver that can be probed for the life of a widget. | |
855 class WidgetDeletionObserver : public WidgetObserver { | |
sky
2013/04/05 17:23:37
Move this (and implementation) into its own file.
varunjain
2013/04/05 18:01:44
Done.
| |
856 public: | |
857 explicit WidgetDeletionObserver(Widget* widget); | |
858 ~WidgetDeletionObserver(); | |
sky
2013/04/05 17:23:37
virtual
varunjain
2013/04/05 18:01:44
Done.
| |
859 | |
860 // Returns true if the widget passed in the constructor is still alive. | |
861 bool IsWidgetAlive(); | |
sky
2013/04/05 17:23:37
nit: inline this.
varunjain
2013/04/05 18:01:44
Done.
| |
862 | |
863 // Overridden from WidgetObserver. | |
864 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; | |
865 | |
866 private: | |
867 void CleanupWidget(); | |
868 Widget* widget_; | |
sky
2013/04/05 17:23:37
nit: newline between 867/868.
varunjain
2013/04/05 18:01:44
Done.
| |
869 | |
870 DISALLOW_COPY_AND_ASSIGN(WidgetDeletionObserver); | |
871 }; | |
872 | |
854 } // namespace views | 873 } // namespace views |
855 | 874 |
856 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 875 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |