OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 5 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Explicitly set the visibility. This is called when Cocoa requests a draw, | 125 // Explicitly set the visibility. This is called when Cocoa requests a draw, |
126 // but hasn't updated the value of -[NSWindow isVisible] yet. | 126 // but hasn't updated the value of -[NSWindow isVisible] yet. |
127 void OnVisibilityChangedTo(bool new_visibility); | 127 void OnVisibilityChangedTo(bool new_visibility); |
128 | 128 |
129 // Called by the NSWindowDelegate on a scale factor or color space change. | 129 // Called by the NSWindowDelegate on a scale factor or color space change. |
130 void OnBackingPropertiesChanged(); | 130 void OnBackingPropertiesChanged(); |
131 | 131 |
132 // Called by the NSWindowDelegate when the window becomes or resigns key. | 132 // Called by the NSWindowDelegate when the window becomes or resigns key. |
133 void OnWindowKeyStatusChangedTo(bool is_key); | 133 void OnWindowKeyStatusChangedTo(bool is_key); |
134 | 134 |
| 135 // Called by NSWindowDelegate when the application receives a mouse-down, but |
| 136 // before the event is processed by NSWindows. Returning true here will cause |
| 137 // the event to be cancelled and reposted at the CGSessionEventTap level. This |
| 138 // is used to determine whether a mouse-down should drag the window. |
| 139 virtual bool ShouldRepostPendingLeftMouseDown(NSPoint location_in_window); |
| 140 |
135 // Called by NativeWidgetMac when the window size constraints change. | 141 // Called by NativeWidgetMac when the window size constraints change. |
136 void OnSizeConstraintsChanged(); | 142 void OnSizeConstraintsChanged(); |
137 | 143 |
138 // See widget.h for documentation. | 144 // See widget.h for documentation. |
139 InputMethod* CreateInputMethod(); | 145 InputMethod* CreateInputMethod(); |
140 ui::InputMethod* GetHostInputMethod(); | 146 ui::InputMethod* GetHostInputMethod(); |
141 | 147 |
142 // The restored bounds will be derived from the current NSWindow frame unless | 148 // The restored bounds will be derived from the current NSWindow frame unless |
143 // fullscreen or transitioning between fullscreen states. | 149 // fullscreen or transitioning between fullscreen states. |
144 gfx::Rect GetRestoredBounds() const; | 150 gfx::Rect GetRestoredBounds() const; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void DestroyCompositor(); | 190 void DestroyCompositor(); |
185 | 191 |
186 // Installs the NSView for hosting the composited layer. It is later provided | 192 // Installs the NSView for hosting the composited layer. It is later provided |
187 // to |compositor_widget_| via AcceleratedWidgetGetNSView(). | 193 // to |compositor_widget_| via AcceleratedWidgetGetNSView(). |
188 void AddCompositorSuperview(); | 194 void AddCompositorSuperview(); |
189 | 195 |
190 // Size the layer to match the client area bounds, taking into account display | 196 // Size the layer to match the client area bounds, taking into account display |
191 // scale factor. | 197 // scale factor. |
192 void UpdateLayerProperties(); | 198 void UpdateLayerProperties(); |
193 | 199 |
| 200 // Sets mouseDownCanMoveWindow on |bridged_view_| and triggers the NSWindow to |
| 201 // update its draggable region. |
| 202 void SetDraggable(bool draggable); |
| 203 |
194 // Overridden from CocoaMouseCaptureDelegate: | 204 // Overridden from CocoaMouseCaptureDelegate: |
195 void PostCapturedEvent(NSEvent* event) override; | 205 void PostCapturedEvent(NSEvent* event) override; |
196 void OnMouseCaptureLost() override; | 206 void OnMouseCaptureLost() override; |
197 | 207 |
198 // Returns a properties dictionary associated with the NSWindow. | 208 // Returns a properties dictionary associated with the NSWindow. |
199 // Creates and attaches a new instance if not found. | 209 // Creates and attaches a new instance if not found. |
200 NSMutableDictionary* GetWindowProperties() const; | 210 NSMutableDictionary* GetWindowProperties() const; |
201 | 211 |
202 // Overridden from FocusChangeListener: | 212 // Overridden from FocusChangeListener: |
203 void OnWillChangeFocus(View* focused_before, | 213 void OnWillChangeFocus(View* focused_before, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // If true, the window is either visible, or wants to be visible but is | 271 // If true, the window is either visible, or wants to be visible but is |
262 // currently hidden due to having a hidden parent. | 272 // currently hidden due to having a hidden parent. |
263 bool wants_to_be_visible_; | 273 bool wants_to_be_visible_; |
264 | 274 |
265 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 275 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
266 }; | 276 }; |
267 | 277 |
268 } // namespace views | 278 } // namespace views |
269 | 279 |
270 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 280 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
OLD | NEW |