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 const ui::Layer
* GetLayer() const override
;
40 virtual void ReorderNativeViews() override
;
41 virtual void ViewRemoved(View
* view
) override
;
42 virtual void SetNativeWindowProperty(const char* name
, void* value
) override
;
43 virtual void* GetNativeWindowProperty(const char* name
) const override
;
44 virtual TooltipManager
* GetTooltipManager() const override
;
45 virtual void SetCapture() override
;
46 virtual void ReleaseCapture() override
;
47 virtual bool HasCapture() const override
;
48 virtual InputMethod
* CreateInputMethod() override
;
49 virtual internal::InputMethodDelegate
* GetInputMethodDelegate() override
;
50 virtual ui::InputMethod
* GetHostInputMethod() override
;
51 virtual void CenterWindow(const gfx::Size
& size
) override
;
52 virtual void GetWindowPlacement(
54 ui::WindowShowState
* maximized
) const override
;
55 virtual bool SetWindowTitle(const base::string16
& title
) override
;
56 virtual void SetWindowIcons(const gfx::ImageSkia
& window_icon
,
57 const gfx::ImageSkia
& app_icon
) override
;
58 virtual void InitModalType(ui::ModalType modal_type
) override
;
59 virtual gfx::Rect
GetWindowBoundsInScreen() const override
;
60 virtual gfx::Rect
GetClientAreaBoundsInScreen() const override
;
61 virtual gfx::Rect
GetRestoredBounds() const override
;
62 virtual void SetBounds(const gfx::Rect
& bounds
) override
;
63 virtual void SetSize(const gfx::Size
& size
) override
;
64 virtual void StackAbove(gfx::NativeView native_view
) override
;
65 virtual void StackAtTop() override
;
66 virtual void StackBelow(gfx::NativeView native_view
) override
;
67 virtual void SetShape(gfx::NativeRegion shape
) override
;
68 virtual void Close() override
;
69 virtual void CloseNow() override
;
70 virtual void Show() override
;
71 virtual void Hide() override
;
72 virtual void ShowMaximizedWithBounds(
73 const gfx::Rect
& restored_bounds
) override
;
74 virtual void ShowWithWindowState(ui::WindowShowState state
) override
;
75 virtual bool IsVisible() const override
;
76 virtual void Activate() override
;
77 virtual void Deactivate() override
;
78 virtual bool IsActive() const override
;
79 virtual void SetAlwaysOnTop(bool always_on_top
) override
;
80 virtual bool IsAlwaysOnTop() const override
;
81 virtual void SetVisibleOnAllWorkspaces(bool always_visible
) override
;
82 virtual void Maximize() override
;
83 virtual void Minimize() override
;
84 virtual bool IsMaximized() const override
;
85 virtual bool IsMinimized() const override
;
86 virtual void Restore() override
;
87 virtual void SetFullscreen(bool fullscreen
) override
;
88 virtual bool IsFullscreen() const override
;
89 virtual void SetOpacity(unsigned char opacity
) override
;
90 virtual void SetUseDragFrame(bool use_drag_frame
) override
;
91 virtual void FlashFrame(bool flash_frame
) override
;
92 virtual void RunShellDrag(View
* view
,
93 const ui::OSExchangeData
& data
,
94 const gfx::Point
& location
,
96 ui::DragDropTypes::DragEventSource source
) override
;
97 virtual void SchedulePaintInRect(const gfx::Rect
& rect
) override
;
98 virtual void SetCursor(gfx::NativeCursor cursor
) override
;
99 virtual bool IsMouseEventsEnabled() const override
;
100 virtual void ClearNativeFocus() override
;
101 virtual gfx::Rect
GetWorkAreaBoundsInScreen() const override
;
102 virtual Widget::MoveLoopResult
RunMoveLoop(
103 const gfx::Vector2d
& drag_offset
,
104 Widget::MoveLoopSource source
,
105 Widget::MoveLoopEscapeBehavior escape_behavior
) override
;
106 virtual void EndMoveLoop() override
;
107 virtual void SetVisibilityChangedAnimationsEnabled(bool value
) override
;
108 virtual void SetVisibilityAnimationDuration(
109 const base::TimeDelta
& duration
) override
;
110 virtual void SetVisibilityAnimationTransition(
111 Widget::VisibilityTransition transition
) override
;
112 virtual ui::NativeTheme
* GetNativeTheme() const override
;
113 virtual void OnRootViewLayout() override
;
114 virtual bool IsTranslucentWindowOpacitySupported() const override
;
115 virtual void OnSizeConstraintsChanged() override
;
116 virtual void RepostNativeEvent(gfx::NativeEvent native_event
) override
;
119 internal::NativeWidgetDelegate
* delegate() { return delegate_
; }
122 friend class test::MockNativeWidgetMac
;
124 internal::NativeWidgetDelegate
* delegate_
;
125 scoped_ptr
<BridgedNativeWidget
> bridge_
;
127 Widget::InitParams::Ownership ownership_
;
129 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMac
);
134 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_