1 // Copyright 2014 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.
5 #ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_
6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/views/widget/native_widget_private.h"
13 class MockNativeWidgetMac
;
16 class BridgedNativeWidget
;
18 class VIEWS_EXPORT NativeWidgetMac
: public internal::NativeWidgetPrivate
{
20 NativeWidgetMac(internal::NativeWidgetDelegate
* delegate
);
21 virtual ~NativeWidgetMac();
23 // Deletes |bridge_| and informs |delegate_| that the native widget is
25 void OnWindowWillClose();
27 // internal::NativeWidgetPrivate:
28 virtual void InitNativeWidget(const Widget::InitParams
& params
) OVERRIDE
;
29 virtual NonClientFrameView
* CreateNonClientFrameView() OVERRIDE
;
30 virtual bool ShouldUseNativeFrame() const OVERRIDE
;
31 virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE
;
32 virtual void FrameTypeChanged() OVERRIDE
;
33 virtual Widget
* GetWidget() OVERRIDE
;
34 virtual const Widget
* GetWidget() const OVERRIDE
;
35 virtual gfx::NativeView
GetNativeView() const OVERRIDE
;
36 virtual gfx::NativeWindow
GetNativeWindow() const OVERRIDE
;
37 virtual Widget
* GetTopLevelWidget() OVERRIDE
;
38 virtual const ui::Compositor
* GetCompositor() const OVERRIDE
;
39 virtual ui::Compositor
* GetCompositor() OVERRIDE
;
40 virtual ui::Layer
* GetLayer() OVERRIDE
;
41 virtual void ReorderNativeViews() OVERRIDE
;
42 virtual void ViewRemoved(View
* view
) OVERRIDE
;
43 virtual void SetNativeWindowProperty(const char* name
, void* value
) OVERRIDE
;
44 virtual void* GetNativeWindowProperty(const char* name
) const OVERRIDE
;
45 virtual TooltipManager
* GetTooltipManager() const OVERRIDE
;
46 virtual void SetCapture() OVERRIDE
;
47 virtual void ReleaseCapture() OVERRIDE
;
48 virtual bool HasCapture() const OVERRIDE
;
49 virtual InputMethod
* CreateInputMethod() OVERRIDE
;
50 virtual internal::InputMethodDelegate
* GetInputMethodDelegate() OVERRIDE
;
51 virtual ui::InputMethod
* GetHostInputMethod() OVERRIDE
;
52 virtual void CenterWindow(const gfx::Size
& size
) OVERRIDE
;
53 virtual void GetWindowPlacement(
55 ui::WindowShowState
* maximized
) const OVERRIDE
;
56 virtual bool SetWindowTitle(const base::string16
& title
) OVERRIDE
;
57 virtual void SetWindowIcons(const gfx::ImageSkia
& window_icon
,
58 const gfx::ImageSkia
& app_icon
) OVERRIDE
;
59 virtual void InitModalType(ui::ModalType modal_type
) OVERRIDE
;
60 virtual gfx::Rect
GetWindowBoundsInScreen() const OVERRIDE
;
61 virtual gfx::Rect
GetClientAreaBoundsInScreen() const OVERRIDE
;
62 virtual gfx::Rect
GetRestoredBounds() const OVERRIDE
;
63 virtual void SetBounds(const gfx::Rect
& bounds
) OVERRIDE
;
64 virtual void SetSize(const gfx::Size
& size
) OVERRIDE
;
65 virtual void StackAbove(gfx::NativeView native_view
) OVERRIDE
;
66 virtual void StackAtTop() OVERRIDE
;
67 virtual void StackBelow(gfx::NativeView native_view
) OVERRIDE
;
68 virtual void SetShape(gfx::NativeRegion shape
) OVERRIDE
;
69 virtual void Close() OVERRIDE
;
70 virtual void CloseNow() OVERRIDE
;
71 virtual void Show() OVERRIDE
;
72 virtual void Hide() OVERRIDE
;
73 virtual void ShowMaximizedWithBounds(
74 const gfx::Rect
& restored_bounds
) OVERRIDE
;
75 virtual void ShowWithWindowState(ui::WindowShowState state
) OVERRIDE
;
76 virtual bool IsVisible() const OVERRIDE
;
77 virtual void Activate() OVERRIDE
;
78 virtual void Deactivate() OVERRIDE
;
79 virtual bool IsActive() const OVERRIDE
;
80 virtual void SetAlwaysOnTop(bool always_on_top
) OVERRIDE
;
81 virtual bool IsAlwaysOnTop() const OVERRIDE
;
82 virtual void SetVisibleOnAllWorkspaces(bool always_visible
) OVERRIDE
;
83 virtual void Maximize() OVERRIDE
;
84 virtual void Minimize() OVERRIDE
;
85 virtual bool IsMaximized() const OVERRIDE
;
86 virtual bool IsMinimized() const OVERRIDE
;
87 virtual void Restore() OVERRIDE
;
88 virtual void SetFullscreen(bool fullscreen
) OVERRIDE
;
89 virtual bool IsFullscreen() const OVERRIDE
;
90 virtual void SetOpacity(unsigned char opacity
) OVERRIDE
;
91 virtual void SetUseDragFrame(bool use_drag_frame
) OVERRIDE
;
92 virtual void FlashFrame(bool flash_frame
) OVERRIDE
;
93 virtual void RunShellDrag(View
* view
,
94 const ui::OSExchangeData
& data
,
95 const gfx::Point
& location
,
97 ui::DragDropTypes::DragEventSource source
) OVERRIDE
;
98 virtual void SchedulePaintInRect(const gfx::Rect
& rect
) OVERRIDE
;
99 virtual void SetCursor(gfx::NativeCursor cursor
) OVERRIDE
;
100 virtual bool IsMouseEventsEnabled() const OVERRIDE
;
101 virtual void ClearNativeFocus() OVERRIDE
;
102 virtual gfx::Rect
GetWorkAreaBoundsInScreen() const OVERRIDE
;
103 virtual Widget::MoveLoopResult
RunMoveLoop(
104 const gfx::Vector2d
& drag_offset
,
105 Widget::MoveLoopSource source
,
106 Widget::MoveLoopEscapeBehavior escape_behavior
) OVERRIDE
;
107 virtual void EndMoveLoop() OVERRIDE
;
108 virtual void SetVisibilityChangedAnimationsEnabled(bool value
) OVERRIDE
;
109 virtual ui::NativeTheme
* GetNativeTheme() const OVERRIDE
;
110 virtual void OnRootViewLayout() const OVERRIDE
;
111 virtual void RepostNativeEvent(gfx::NativeEvent native_event
) OVERRIDE
;
114 internal::NativeWidgetDelegate
* delegate() { return delegate_
; }
117 friend class test::MockNativeWidgetMac
;
119 internal::NativeWidgetDelegate
* delegate_
;
120 scoped_ptr
<BridgedNativeWidget
> bridge_
;
122 Widget::InitParams::Ownership ownership_
;
124 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMac
);
129 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_