OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | |
6 #define VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/scoped_vector.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "ui/aura/client/window_drag_drop_delegate.h" | |
12 #include "ui/aura/window_delegate.h" | |
13 #include "ui/base/events.h" | |
14 #include "views/views_export.h" | |
15 #include "views/widget/native_widget_private.h" | |
16 | |
17 namespace aura { | |
18 class Window; | |
19 } | |
20 namespace gfx { | |
21 class Font; | |
22 } | |
23 | |
24 namespace views { | |
25 | |
26 class DropHelper; | |
27 class TooltipManagerViews; | |
28 | |
29 class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, | |
30 public aura::WindowDelegate, | |
31 public aura::WindowDragDropDelegate { | |
32 public: | |
33 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); | |
34 virtual ~NativeWidgetAura(); | |
35 | |
36 // TODO(beng): Find a better place for this, and the similar method on | |
37 // NativeWidgetWin. | |
38 static gfx::Font GetWindowTitleFont(); | |
39 | |
40 // Overridden from internal::NativeWidgetPrivate: | |
41 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | |
42 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | |
43 virtual void UpdateFrameAfterFrameChange() OVERRIDE; | |
44 virtual bool ShouldUseNativeFrame() const OVERRIDE; | |
45 virtual void FrameTypeChanged() OVERRIDE; | |
46 virtual Widget* GetWidget() OVERRIDE; | |
47 virtual const Widget* GetWidget() const OVERRIDE; | |
48 virtual gfx::NativeView GetNativeView() const OVERRIDE; | |
49 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | |
50 virtual Widget* GetTopLevelWidget() OVERRIDE; | |
51 virtual const ui::Compositor* GetCompositor() const OVERRIDE; | |
52 virtual ui::Compositor* GetCompositor() OVERRIDE; | |
53 virtual void CalculateOffsetToAncestorWithLayer( | |
54 gfx::Point* offset, | |
55 ui::Layer** layer_parent) OVERRIDE; | |
56 virtual void ReorderLayers() OVERRIDE; | |
57 virtual void ViewRemoved(View* view) OVERRIDE; | |
58 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; | |
59 virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; | |
60 virtual TooltipManager* GetTooltipManager() const OVERRIDE; | |
61 virtual bool IsScreenReaderActive() const OVERRIDE; | |
62 virtual void SendNativeAccessibilityEvent( | |
63 View* view, | |
64 ui::AccessibilityTypes::Event event_type) OVERRIDE; | |
65 virtual void SetMouseCapture() OVERRIDE; | |
66 virtual void ReleaseMouseCapture() OVERRIDE; | |
67 virtual bool HasMouseCapture() const OVERRIDE; | |
68 virtual InputMethod* CreateInputMethod() OVERRIDE; | |
69 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | |
70 virtual void GetWindowPlacement( | |
71 gfx::Rect* bounds, | |
72 ui::WindowShowState* maximized) const OVERRIDE; | |
73 virtual void SetWindowTitle(const string16& title) OVERRIDE; | |
74 virtual void SetWindowIcons(const SkBitmap& window_icon, | |
75 const SkBitmap& app_icon) OVERRIDE; | |
76 virtual void SetAccessibleName(const string16& name) OVERRIDE; | |
77 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; | |
78 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; | |
79 virtual void BecomeModal() OVERRIDE; | |
80 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; | |
81 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; | |
82 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | |
83 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | |
84 virtual void SetSize(const gfx::Size& size) OVERRIDE; | |
85 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; | |
86 virtual void MoveToTop() OVERRIDE; | |
87 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; | |
88 virtual void Close() OVERRIDE; | |
89 virtual void CloseNow() OVERRIDE; | |
90 virtual void EnableClose(bool enable) OVERRIDE; | |
91 virtual void Show() OVERRIDE; | |
92 virtual void Hide() OVERRIDE; | |
93 virtual void ShowMaximizedWithBounds( | |
94 const gfx::Rect& restored_bounds) OVERRIDE; | |
95 virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; | |
96 virtual bool IsVisible() const OVERRIDE; | |
97 virtual void Activate() OVERRIDE; | |
98 virtual void Deactivate() OVERRIDE; | |
99 virtual bool IsActive() const OVERRIDE; | |
100 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; | |
101 virtual void Maximize() OVERRIDE; | |
102 virtual void Minimize() OVERRIDE; | |
103 virtual bool IsMaximized() const OVERRIDE; | |
104 virtual bool IsMinimized() const OVERRIDE; | |
105 virtual void Restore() OVERRIDE; | |
106 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | |
107 virtual bool IsFullscreen() const OVERRIDE; | |
108 virtual void SetOpacity(unsigned char opacity) OVERRIDE; | |
109 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; | |
110 virtual bool IsAccessibleWidget() const OVERRIDE; | |
111 virtual void RunShellDrag(View* view, | |
112 const ui::OSExchangeData& data, | |
113 int operation) OVERRIDE; | |
114 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; | |
115 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | |
116 virtual void ClearNativeFocus() OVERRIDE; | |
117 virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE; | |
118 virtual bool ConvertPointFromAncestor( | |
119 const Widget* ancestor, gfx::Point* point) const OVERRIDE; | |
120 virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; | |
121 virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; | |
122 | |
123 // Overridden from views::InputMethodDelegate: | |
124 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; | |
125 | |
126 // Overridden from aura::WindowDelegate: | |
127 virtual void OnBoundsChanging(gfx::Rect* new_bounds) OVERRIDE; | |
128 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | |
129 const gfx::Rect& new_bounds) OVERRIDE; | |
130 virtual void OnFocus() OVERRIDE; | |
131 virtual void OnBlur() OVERRIDE; | |
132 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; | |
133 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | |
134 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | |
135 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; | |
136 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; | |
137 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; | |
138 virtual void OnActivated() OVERRIDE; | |
139 virtual void OnLostActive() OVERRIDE; | |
140 virtual void OnCaptureLost() OVERRIDE; | |
141 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
142 virtual void OnWindowDestroying() OVERRIDE; | |
143 virtual void OnWindowDestroyed() OVERRIDE; | |
144 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | |
145 | |
146 // Overridden from aura::WindowDragDropDelegate: | |
147 virtual bool CanDrop(const aura::DropTargetEvent& event) OVERRIDE; | |
148 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; | |
149 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; | |
150 virtual void OnDragExited() OVERRIDE; | |
151 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; | |
152 | |
153 protected: | |
154 internal::NativeWidgetDelegate* delegate() { return delegate_; } | |
155 | |
156 private: | |
157 class DesktopObserverImpl; | |
158 | |
159 internal::NativeWidgetDelegate* delegate_; | |
160 | |
161 aura::Window* window_; | |
162 | |
163 // See class documentation for Widget in widget.h for a note about ownership. | |
164 Widget::InitParams::Ownership ownership_; | |
165 | |
166 // The following factory is used for calls to close the NativeWidgetAura | |
167 // instance. | |
168 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; | |
169 | |
170 // Can we be made active? | |
171 bool can_activate_; | |
172 | |
173 gfx::NativeCursor cursor_; | |
174 | |
175 scoped_ptr<TooltipManagerViews> tooltip_manager_; | |
176 | |
177 scoped_ptr<DesktopObserverImpl> desktop_observer_; | |
178 | |
179 scoped_ptr<DropHelper> drop_helper_; | |
180 | |
181 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); | |
182 }; | |
183 | |
184 } // namespace views | |
185 | |
186 #endif // VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | |
OLD | NEW |