ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ui / views / widget / native_widget_mac.h
blob2ebbcfc3d81fc79ad9cecbc7a3bd74e5ca5ee87f
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"
11 namespace views {
12 namespace test {
13 class MockNativeWidgetMac;
16 class BridgedNativeWidget;
18 class VIEWS_EXPORT NativeWidgetMac : public internal::NativeWidgetPrivate {
19 public:
20 NativeWidgetMac(internal::NativeWidgetDelegate* delegate);
21 ~NativeWidgetMac() override;
23 // Retrieves the bridge associated with the given NSWindow. Returns null if
24 // the supplied handle has no associated Widget.
25 static BridgedNativeWidget* GetBridgeForNativeWindow(
26 gfx::NativeWindow window);
28 // Deletes |bridge_| and informs |delegate_| that the native widget is
29 // destroyed.
30 void OnWindowWillClose();
32 // internal::NativeWidgetPrivate:
33 void InitNativeWidget(const Widget::InitParams& params) override;
34 NonClientFrameView* CreateNonClientFrameView() override;
35 bool ShouldUseNativeFrame() const override;
36 bool ShouldWindowContentsBeTransparent() const override;
37 void FrameTypeChanged() override;
38 Widget* GetWidget() override;
39 const Widget* GetWidget() const override;
40 gfx::NativeView GetNativeView() const override;
41 gfx::NativeWindow GetNativeWindow() const override;
42 Widget* GetTopLevelWidget() override;
43 const ui::Compositor* GetCompositor() const override;
44 const ui::Layer* GetLayer() const override;
45 void ReorderNativeViews() override;
46 void ViewRemoved(View* view) override;
47 void SetNativeWindowProperty(const char* name, void* value) override;
48 void* GetNativeWindowProperty(const char* name) const override;
49 TooltipManager* GetTooltipManager() const override;
50 void SetCapture() override;
51 void ReleaseCapture() override;
52 bool HasCapture() const override;
53 InputMethod* CreateInputMethod() override;
54 internal::InputMethodDelegate* GetInputMethodDelegate() override;
55 ui::InputMethod* GetHostInputMethod() override;
56 void CenterWindow(const gfx::Size& size) override;
57 void GetWindowPlacement(gfx::Rect* bounds,
58 ui::WindowShowState* maximized) const override;
59 bool SetWindowTitle(const base::string16& title) override;
60 void SetWindowIcons(const gfx::ImageSkia& window_icon,
61 const gfx::ImageSkia& app_icon) override;
62 void InitModalType(ui::ModalType modal_type) override;
63 gfx::Rect GetWindowBoundsInScreen() const override;
64 gfx::Rect GetClientAreaBoundsInScreen() const override;
65 gfx::Rect GetRestoredBounds() const override;
66 void SetBounds(const gfx::Rect& bounds) override;
67 void SetSize(const gfx::Size& size) override;
68 void StackAbove(gfx::NativeView native_view) override;
69 void StackAtTop() override;
70 void StackBelow(gfx::NativeView native_view) override;
71 void SetShape(gfx::NativeRegion shape) override;
72 void Close() override;
73 void CloseNow() override;
74 void Show() override;
75 void Hide() override;
76 void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override;
77 void ShowWithWindowState(ui::WindowShowState state) override;
78 bool IsVisible() const override;
79 void Activate() override;
80 void Deactivate() override;
81 bool IsActive() const override;
82 void SetAlwaysOnTop(bool always_on_top) override;
83 bool IsAlwaysOnTop() const override;
84 void SetVisibleOnAllWorkspaces(bool always_visible) override;
85 void Maximize() override;
86 void Minimize() override;
87 bool IsMaximized() const override;
88 bool IsMinimized() const override;
89 void Restore() override;
90 void SetFullscreen(bool fullscreen) override;
91 bool IsFullscreen() const override;
92 void SetOpacity(unsigned char opacity) override;
93 void SetUseDragFrame(bool use_drag_frame) override;
94 void FlashFrame(bool flash_frame) override;
95 void RunShellDrag(View* view,
96 const ui::OSExchangeData& data,
97 const gfx::Point& location,
98 int operation,
99 ui::DragDropTypes::DragEventSource source) override;
100 void SchedulePaintInRect(const gfx::Rect& rect) override;
101 void SetCursor(gfx::NativeCursor cursor) override;
102 bool IsMouseEventsEnabled() const override;
103 void ClearNativeFocus() override;
104 gfx::Rect GetWorkAreaBoundsInScreen() const override;
105 Widget::MoveLoopResult RunMoveLoop(
106 const gfx::Vector2d& drag_offset,
107 Widget::MoveLoopSource source,
108 Widget::MoveLoopEscapeBehavior escape_behavior) override;
109 void EndMoveLoop() override;
110 void SetVisibilityChangedAnimationsEnabled(bool value) override;
111 void SetVisibilityAnimationDuration(const base::TimeDelta& duration) override;
112 void SetVisibilityAnimationTransition(
113 Widget::VisibilityTransition transition) override;
114 ui::NativeTheme* GetNativeTheme() const override;
115 void OnRootViewLayout() override;
116 bool IsTranslucentWindowOpacitySupported() const override;
117 void OnSizeConstraintsChanged() override;
118 void RepostNativeEvent(gfx::NativeEvent native_event) override;
120 protected:
121 internal::NativeWidgetDelegate* delegate() { return delegate_; }
123 private:
124 friend class test::MockNativeWidgetMac;
126 internal::NativeWidgetDelegate* delegate_;
127 scoped_ptr<BridgedNativeWidget> bridge_;
129 Widget::InitParams::Ownership ownership_;
131 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMac);
134 } // namespace views
136 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_