| 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 "base/scoped_observer.h" |
| 15 #include "ui/aura/window_layer_type.h" | 16 #include "ui/aura/window_layer_type.h" |
| 16 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
| 17 #include "ui/events/event_source.h" | 18 #include "ui/events/event_source.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 21 #include "ui/native_theme/native_theme_observer.h" |
| 20 #include "ui/views/focus/focus_manager.h" | 22 #include "ui/views/focus/focus_manager.h" |
| 21 #include "ui/views/widget/native_widget_delegate.h" | 23 #include "ui/views/widget/native_widget_delegate.h" |
| 22 #include "ui/views/window/client_view.h" | 24 #include "ui/views/window/client_view.h" |
| 23 #include "ui/views/window/non_client_view.h" | 25 #include "ui/views/window/non_client_view.h" |
| 24 | 26 |
| 25 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 26 // Windows headers define macros for these function names which screw with us. | 28 // Windows headers define macros for these function names which screw with us. |
| 27 #if defined(IsMaximized) | 29 #if defined(IsMaximized) |
| 28 #undef IsMaximized | 30 #undef IsMaximized |
| 29 #endif | 31 #endif |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // is destroyed (in response to a native destruction message), it deletes | 90 // is destroyed (in response to a native destruction message), it deletes |
| 89 // the Widget from its destructor. | 91 // the Widget from its destructor. |
| 90 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) | 92 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) |
| 91 // The Widget instance owns its NativeWidget. This state implies someone | 93 // The Widget instance owns its NativeWidget. This state implies someone |
| 92 // else wants to control the lifetime of this object. When they destroy | 94 // else wants to control the lifetime of this object. When they destroy |
| 93 // the Widget it is responsible for destroying the NativeWidget (from its | 95 // the Widget it is responsible for destroying the NativeWidget (from its |
| 94 // destructor). | 96 // destructor). |
| 95 // | 97 // |
| 96 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, | 98 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, |
| 97 public ui::EventSource, | 99 public ui::EventSource, |
| 98 public FocusTraversable { | 100 public FocusTraversable, |
| 101 public ui::NativeThemeObserver { |
| 99 public: | 102 public: |
| 100 typedef std::set<Widget*> Widgets; | 103 typedef std::set<Widget*> Widgets; |
| 101 | 104 |
| 102 enum FrameType { | 105 enum FrameType { |
| 103 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 106 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
| 104 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 107 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
| 105 FRAME_TYPE_FORCE_NATIVE // Force the native frame. | 108 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 // Result from RunMoveLoop(). | 111 // Result from RunMoveLoop(). |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 virtual bool SetInitialFocus(ui::WindowShowState show_state) OVERRIDE; | 757 virtual bool SetInitialFocus(ui::WindowShowState show_state) OVERRIDE; |
| 755 | 758 |
| 756 // Overridden from ui::EventSource: | 759 // Overridden from ui::EventSource: |
| 757 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 760 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
| 758 | 761 |
| 759 // Overridden from FocusTraversable: | 762 // Overridden from FocusTraversable: |
| 760 virtual FocusSearch* GetFocusSearch() OVERRIDE; | 763 virtual FocusSearch* GetFocusSearch() OVERRIDE; |
| 761 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; | 764 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; |
| 762 virtual View* GetFocusTraversableParentView() OVERRIDE; | 765 virtual View* GetFocusTraversableParentView() OVERRIDE; |
| 763 | 766 |
| 767 // Overridden from ui::NativeThemeObserver: |
| 768 virtual void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) OVERRIDE; |
| 769 |
| 764 protected: | 770 protected: |
| 765 // Creates the RootView to be used within this Widget. Subclasses may override | 771 // Creates the RootView to be used within this Widget. Subclasses may override |
| 766 // to create custom RootViews that do specialized event processing. | 772 // to create custom RootViews that do specialized event processing. |
| 767 // TODO(beng): Investigate whether or not this is needed. | 773 // TODO(beng): Investigate whether or not this is needed. |
| 768 virtual internal::RootView* CreateRootView(); | 774 virtual internal::RootView* CreateRootView(); |
| 769 | 775 |
| 770 // Provided to allow the NativeWidget implementations to destroy the RootView | 776 // Provided to allow the NativeWidget implementations to destroy the RootView |
| 771 // _before_ the focus manager/tooltip manager. | 777 // _before_ the focus manager/tooltip manager. |
| 772 // TODO(beng): remove once we fold those objects onto this one. | 778 // TODO(beng): remove once we fold those objects onto this one. |
| 773 void DestroyRootView(); | 779 void DestroyRootView(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 // See description in GetRootLayers(). | 905 // See description in GetRootLayers(). |
| 900 std::vector<ui::Layer*> root_layers_; | 906 std::vector<ui::Layer*> root_layers_; |
| 901 | 907 |
| 902 // Is |root_layers_| out of date? | 908 // Is |root_layers_| out of date? |
| 903 bool root_layers_dirty_; | 909 bool root_layers_dirty_; |
| 904 | 910 |
| 905 // True when window movement via mouse interaction with the frame should be | 911 // True when window movement via mouse interaction with the frame should be |
| 906 // disabled. | 912 // disabled. |
| 907 bool movement_disabled_; | 913 bool movement_disabled_; |
| 908 | 914 |
| 915 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; |
| 916 |
| 909 DISALLOW_COPY_AND_ASSIGN(Widget); | 917 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 910 }; | 918 }; |
| 911 | 919 |
| 912 } // namespace views | 920 } // namespace views |
| 913 | 921 |
| 914 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 922 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |