OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_WIDGET_WIDGET_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_H_ |
6 #define VIEWS_WIDGET_WIDGET_H_ | 6 #define VIEWS_WIDGET_WIDGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Observers can listen to various events on the Widgets. | 94 // Observers can listen to various events on the Widgets. |
95 class Observer { | 95 class Observer { |
96 public: | 96 public: |
97 virtual void OnWidgetClosing(Widget* widget) {} | 97 virtual void OnWidgetClosing(Widget* widget) {} |
98 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} | 98 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} |
99 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} | 99 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} |
100 }; | 100 }; |
101 | 101 |
102 typedef std::set<Widget*> Widgets; | 102 typedef std::set<Widget*> Widgets; |
103 | 103 |
| 104 enum DestroyState { |
| 105 // The default, everything is good and alive. |
| 106 DESTROY_STATE_NONE = 1, |
| 107 |
| 108 // Set once OnNativeWidgetDestroying has been invoked. |
| 109 DESTROY_STATE_IN_DESTROYING, |
| 110 |
| 111 // Set once OnNativeWidgetDestroyed has been invoked. |
| 112 DESTROY_STATE_DESTROYED, |
| 113 |
| 114 // Set once the destructor is invoked. |
| 115 DESTROY_STATE_DELETED, |
| 116 }; |
| 117 |
104 enum FrameType { | 118 enum FrameType { |
105 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 119 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
106 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 120 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
107 FRAME_TYPE_FORCE_NATIVE // Force the native frame. | 121 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
108 }; | 122 }; |
109 | 123 |
110 struct VIEWS_EXPORT InitParams { | 124 struct VIEWS_EXPORT InitParams { |
111 enum Type { | 125 enum Type { |
112 TYPE_WINDOW, // A decorated Window, like a frame window. | 126 TYPE_WINDOW, // A decorated Window, like a frame window. |
113 // Widgets of TYPE_WINDOW will have a NonClientView. | 127 // Widgets of TYPE_WINDOW will have a NonClientView. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 // are added to. The default implementation returns the contents view | 571 // are added to. The default implementation returns the contents view |
558 // if it exists and the root view otherwise. | 572 // if it exists and the root view otherwise. |
559 virtual View* GetChildViewParent(); | 573 virtual View* GetChildViewParent(); |
560 | 574 |
561 // True if the widget is considered top level widget. Top level widget | 575 // True if the widget is considered top level widget. Top level widget |
562 // is a widget of TYPE_WINDOW, TYPE_WINDOW_FRAMELESS, POPUP or MENU, and | 576 // is a widget of TYPE_WINDOW, TYPE_WINDOW_FRAMELESS, POPUP or MENU, and |
563 // has a focus manager and input method object associated with it. | 577 // has a focus manager and input method object associated with it. |
564 // TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. | 578 // TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. |
565 bool is_top_level() const { return is_top_level_; } | 579 bool is_top_level() const { return is_top_level_; } |
566 | 580 |
| 581 DestroyState destroy_state() const { return destroy_state_; } |
| 582 |
567 // Overridden from NativeWidgetDelegate: | 583 // Overridden from NativeWidgetDelegate: |
568 virtual bool IsModal() const OVERRIDE; | 584 virtual bool IsModal() const OVERRIDE; |
569 virtual bool IsDialogBox() const OVERRIDE; | 585 virtual bool IsDialogBox() const OVERRIDE; |
570 virtual bool CanActivate() const OVERRIDE; | 586 virtual bool CanActivate() const OVERRIDE; |
571 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; | 587 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; |
572 virtual void EnableInactiveRendering() OVERRIDE; | 588 virtual void EnableInactiveRendering() OVERRIDE; |
573 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; | 589 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; |
574 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; | 590 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; |
575 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; | 591 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; |
576 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; | 592 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 bool focus_on_creation_; | 736 bool focus_on_creation_; |
721 | 737 |
722 scoped_ptr<InputMethod> input_method_; | 738 scoped_ptr<InputMethod> input_method_; |
723 | 739 |
724 // See |is_top_leve()| accessor. | 740 // See |is_top_leve()| accessor. |
725 bool is_top_level_; | 741 bool is_top_level_; |
726 | 742 |
727 // Factory used to create Compositors. Settable by tests. | 743 // Factory used to create Compositors. Settable by tests. |
728 static ui::Compositor*(*compositor_factory_)(); | 744 static ui::Compositor*(*compositor_factory_)(); |
729 | 745 |
| 746 // Tracks destroy state. |
| 747 // TODO(sky): remove this, used in tracking 91396. |
| 748 DestroyState destroy_state_; |
| 749 |
730 DISALLOW_COPY_AND_ASSIGN(Widget); | 750 DISALLOW_COPY_AND_ASSIGN(Widget); |
731 }; | 751 }; |
732 | 752 |
733 } // namespace views | 753 } // namespace views |
734 | 754 |
735 #endif // VIEWS_WIDGET_WIDGET_H_ | 755 #endif // VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |