| 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.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 |
| 30 #if defined(IsMinimized) | 32 #if defined(IsMinimized) |
| 31 #undef IsMinimized | 33 #undef IsMinimized |
| 32 #endif | 34 #endif |
| 33 #if defined(CreateWindow) | 35 #if defined(CreateWindow) |
| 34 #undef CreateWindow | 36 #undef CreateWindow |
| 35 #endif | 37 #endif |
| 36 #endif | 38 #endif |
| 37 | 39 |
| 38 namespace gfx { | 40 namespace gfx { |
| 39 class Canvas; | 41 class Canvas; |
| 40 class Point; | 42 class Point; |
| 41 class Rect; | 43 class Rect; |
| 42 } | 44 } |
| 43 | 45 |
| 44 namespace ui { | 46 namespace ui { |
| 45 class Accelerator; | 47 class Accelerator; |
| 46 class Compositor; | 48 class Compositor; |
| 47 class DefaultThemeProvider; | 49 class DefaultThemeProvider; |
| 48 class Layer; | 50 class Layer; |
| 49 class NativeTheme; | |
| 50 class OSExchangeData; | 51 class OSExchangeData; |
| 51 class ThemeProvider; | 52 class ThemeProvider; |
| 52 } | 53 } |
| 53 | 54 |
| 54 namespace views { | 55 namespace views { |
| 55 | 56 |
| 56 class DesktopWindowTreeHost; | 57 class DesktopWindowTreeHost; |
| 57 class InputMethod; | 58 class InputMethod; |
| 58 class NativeWidget; | 59 class NativeWidget; |
| 59 class NonClientFrameView; | 60 class NonClientFrameView; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 88 // is destroyed (in response to a native destruction message), it deletes | 89 // is destroyed (in response to a native destruction message), it deletes |
| 89 // the Widget from its destructor. | 90 // the Widget from its destructor. |
| 90 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) | 91 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) |
| 91 // The Widget instance owns its NativeWidget. This state implies someone | 92 // The Widget instance owns its NativeWidget. This state implies someone |
| 92 // else wants to control the lifetime of this object. When they destroy | 93 // else wants to control the lifetime of this object. When they destroy |
| 93 // the Widget it is responsible for destroying the NativeWidget (from its | 94 // the Widget it is responsible for destroying the NativeWidget (from its |
| 94 // destructor). | 95 // destructor). |
| 95 // | 96 // |
| 96 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, | 97 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, |
| 97 public ui::EventSource, | 98 public ui::EventSource, |
| 98 public FocusTraversable { | 99 public FocusTraversable, |
| 100 public ui::NativeThemeObserver { |
| 99 public: | 101 public: |
| 100 typedef std::set<Widget*> Widgets; | 102 typedef std::set<Widget*> Widgets; |
| 101 | 103 |
| 102 enum FrameType { | 104 enum FrameType { |
| 103 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 105 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
| 104 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 106 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
| 105 FRAME_TYPE_FORCE_NATIVE // Force the native frame. | 107 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 // Result from RunMoveLoop(). | 110 // 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; | 756 virtual bool SetInitialFocus(ui::WindowShowState show_state) OVERRIDE; |
| 755 | 757 |
| 756 // Overridden from ui::EventSource: | 758 // Overridden from ui::EventSource: |
| 757 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 759 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
| 758 | 760 |
| 759 // Overridden from FocusTraversable: | 761 // Overridden from FocusTraversable: |
| 760 virtual FocusSearch* GetFocusSearch() OVERRIDE; | 762 virtual FocusSearch* GetFocusSearch() OVERRIDE; |
| 761 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; | 763 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; |
| 762 virtual View* GetFocusTraversableParentView() OVERRIDE; | 764 virtual View* GetFocusTraversableParentView() OVERRIDE; |
| 763 | 765 |
| 766 // Overridden from ui::NativeThemeObserver: |
| 767 virtual void OnNativeThemeUpdate() OVERRIDE; |
| 768 |
| 764 protected: | 769 protected: |
| 765 // Creates the RootView to be used within this Widget. Subclasses may override | 770 // Creates the RootView to be used within this Widget. Subclasses may override |
| 766 // to create custom RootViews that do specialized event processing. | 771 // to create custom RootViews that do specialized event processing. |
| 767 // TODO(beng): Investigate whether or not this is needed. | 772 // TODO(beng): Investigate whether or not this is needed. |
| 768 virtual internal::RootView* CreateRootView(); | 773 virtual internal::RootView* CreateRootView(); |
| 769 | 774 |
| 770 // Provided to allow the NativeWidget implementations to destroy the RootView | 775 // Provided to allow the NativeWidget implementations to destroy the RootView |
| 771 // _before_ the focus manager/tooltip manager. | 776 // _before_ the focus manager/tooltip manager. |
| 772 // TODO(beng): remove once we fold those objects onto this one. | 777 // TODO(beng): remove once we fold those objects onto this one. |
| 773 void DestroyRootView(); | 778 void DestroyRootView(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 // See description in GetRootLayers(). | 904 // See description in GetRootLayers(). |
| 900 std::vector<ui::Layer*> root_layers_; | 905 std::vector<ui::Layer*> root_layers_; |
| 901 | 906 |
| 902 // Is |root_layers_| out of date? | 907 // Is |root_layers_| out of date? |
| 903 bool root_layers_dirty_; | 908 bool root_layers_dirty_; |
| 904 | 909 |
| 905 // True when window movement via mouse interaction with the frame should be | 910 // True when window movement via mouse interaction with the frame should be |
| 906 // disabled. | 911 // disabled. |
| 907 bool movement_disabled_; | 912 bool movement_disabled_; |
| 908 | 913 |
| 914 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; |
| 915 |
| 909 DISALLOW_COPY_AND_ASSIGN(Widget); | 916 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 910 }; | 917 }; |
| 911 | 918 |
| 912 } // namespace views | 919 } // namespace views |
| 913 | 920 |
| 914 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 921 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |