| 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 <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <stack> | 10 #include <stack> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
| 18 #include "ui/events/event_source.h" | 18 #include "ui/events/event_source.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 21 #include "ui/native_theme/native_theme_observer.h" | 21 #include "ui/native_theme/native_theme_observer.h" |
| 22 #include "ui/views/focus/focus_manager.h" | 22 #include "ui/views/focus/focus_manager.h" |
| 23 #include "ui/views/widget/native_widget_delegate.h" | 23 #include "ui/views/widget/native_widget_delegate.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // either owns or is owned by its NativeWidget: | 90 // either owns or is owned by its NativeWidget: |
| 91 // | 91 // |
| 92 // ownership = NATIVE_WIDGET_OWNS_WIDGET (default) | 92 // ownership = NATIVE_WIDGET_OWNS_WIDGET (default) |
| 93 // The Widget instance is owned by its NativeWidget. When the NativeWidget | 93 // The Widget instance is owned by its NativeWidget. When the NativeWidget |
| 94 // is destroyed (in response to a native destruction message), it deletes | 94 // is destroyed (in response to a native destruction message), it deletes |
| 95 // the Widget from its destructor. | 95 // the Widget from its destructor. |
| 96 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) | 96 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) |
| 97 // The Widget instance owns its NativeWidget. This state implies someone | 97 // The Widget instance owns its NativeWidget. This state implies someone |
| 98 // else wants to control the lifetime of this object. When they destroy | 98 // else wants to control the lifetime of this object. When they destroy |
| 99 // the Widget it is responsible for destroying the NativeWidget (from its | 99 // the Widget it is responsible for destroying the NativeWidget (from its |
| 100 // destructor). This is often used to place a Widget in a scoped_ptr<> or | 100 // destructor). This is often used to place a Widget in a std::unique_ptr<> |
| 101 // on the stack in a test. | 101 // or on the stack in a test. |
| 102 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, | 102 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, |
| 103 public ui::EventSource, | 103 public ui::EventSource, |
| 104 public FocusTraversable, | 104 public FocusTraversable, |
| 105 public ui::NativeThemeObserver { | 105 public ui::NativeThemeObserver { |
| 106 public: | 106 public: |
| 107 typedef std::set<Widget*> Widgets; | 107 typedef std::set<Widget*> Widgets; |
| 108 | 108 |
| 109 enum FrameType { | 109 enum FrameType { |
| 110 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 110 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
| 111 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 111 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 854 |
| 855 base::ObserverList<WidgetRemovalsObserver> removals_observers_; | 855 base::ObserverList<WidgetRemovalsObserver> removals_observers_; |
| 856 | 856 |
| 857 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied | 857 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied |
| 858 // to Init() a default WidgetDelegate is created. | 858 // to Init() a default WidgetDelegate is created. |
| 859 WidgetDelegate* widget_delegate_; | 859 WidgetDelegate* widget_delegate_; |
| 860 | 860 |
| 861 // The root of the View hierarchy attached to this window. | 861 // The root of the View hierarchy attached to this window. |
| 862 // WARNING: see warning in tooltip_manager_ for ordering dependencies with | 862 // WARNING: see warning in tooltip_manager_ for ordering dependencies with |
| 863 // this and tooltip_manager_. | 863 // this and tooltip_manager_. |
| 864 scoped_ptr<internal::RootView> root_view_; | 864 std::unique_ptr<internal::RootView> root_view_; |
| 865 | 865 |
| 866 // The View that provides the non-client area of the window (title bar, | 866 // The View that provides the non-client area of the window (title bar, |
| 867 // window controls, sizing borders etc). To use an implementation other than | 867 // window controls, sizing borders etc). To use an implementation other than |
| 868 // the default, this class must be sub-classed and this value set to the | 868 // the default, this class must be sub-classed and this value set to the |
| 869 // desired implementation before calling |InitWindow()|. | 869 // desired implementation before calling |InitWindow()|. |
| 870 NonClientView* non_client_view_; | 870 NonClientView* non_client_view_; |
| 871 | 871 |
| 872 // The focus manager keeping track of focus for this Widget and any of its | 872 // The focus manager keeping track of focus for this Widget and any of its |
| 873 // children. NULL for non top-level widgets. | 873 // children. NULL for non top-level widgets. |
| 874 // WARNING: RootView's destructor calls into the FocusManager. As such, this | 874 // WARNING: RootView's destructor calls into the FocusManager. As such, this |
| 875 // must be destroyed AFTER root_view_. This is enforced in DestroyRootView(). | 875 // must be destroyed AFTER root_view_. This is enforced in DestroyRootView(). |
| 876 scoped_ptr<FocusManager> focus_manager_; | 876 std::unique_ptr<FocusManager> focus_manager_; |
| 877 | 877 |
| 878 // A theme provider to use when no other theme provider is specified. | 878 // A theme provider to use when no other theme provider is specified. |
| 879 scoped_ptr<ui::DefaultThemeProvider> default_theme_provider_; | 879 std::unique_ptr<ui::DefaultThemeProvider> default_theme_provider_; |
| 880 | 880 |
| 881 // Valid for the lifetime of RunShellDrag(), indicates the view the drag | 881 // Valid for the lifetime of RunShellDrag(), indicates the view the drag |
| 882 // started from. | 882 // started from. |
| 883 View* dragged_view_; | 883 View* dragged_view_; |
| 884 | 884 |
| 885 // See class documentation for Widget above for a note about ownership. | 885 // See class documentation for Widget above for a note about ownership. |
| 886 InitParams::Ownership ownership_; | 886 InitParams::Ownership ownership_; |
| 887 | 887 |
| 888 // See set_is_secondary_widget(). | 888 // See set_is_secondary_widget(). |
| 889 bool is_secondary_widget_; | 889 bool is_secondary_widget_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 bool movement_disabled_; | 950 bool movement_disabled_; |
| 951 | 951 |
| 952 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; | 952 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; |
| 953 | 953 |
| 954 DISALLOW_COPY_AND_ASSIGN(Widget); | 954 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 955 }; | 955 }; |
| 956 | 956 |
| 957 } // namespace views | 957 } // namespace views |
| 958 | 958 |
| 959 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 959 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |