| 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 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Sets the desired visibility of the window and updates the visibility of | 94 // Sets the desired visibility of the window and updates the visibility of |
| 95 // descendant windows where necessary. | 95 // descendant windows where necessary. |
| 96 void SetVisibilityState(WindowVisibilityState new_state); | 96 void SetVisibilityState(WindowVisibilityState new_state); |
| 97 | 97 |
| 98 // Acquiring mouse capture first steals capture from any existing | 98 // Acquiring mouse capture first steals capture from any existing |
| 99 // CocoaMouseCaptureDelegate, then captures all mouse events until released. | 99 // CocoaMouseCaptureDelegate, then captures all mouse events until released. |
| 100 void AcquireCapture(); | 100 void AcquireCapture(); |
| 101 void ReleaseCapture(); | 101 void ReleaseCapture(); |
| 102 bool HasCapture(); | 102 bool HasCapture(); |
| 103 | 103 |
| 104 void OnMouseEvent(NSEvent* event); |
| 105 |
| 104 // Start moving the window, pinned to the mouse cursor, and monitor events. | 106 // Start moving the window, pinned to the mouse cursor, and monitor events. |
| 105 // Return MOVE_LOOP_SUCCESSFUL on mouse up or MOVE_LOOP_CANCELED on premature | 107 // Return MOVE_LOOP_SUCCESSFUL on mouse up or MOVE_LOOP_CANCELED on premature |
| 106 // termination via EndMoveLoop() or when window is destroyed during the drag. | 108 // termination via EndMoveLoop() or when window is destroyed during the drag. |
| 107 Widget::MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset); | 109 Widget::MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset); |
| 108 void EndMoveLoop(); | 110 void EndMoveLoop(); |
| 109 | 111 |
| 110 // See views::Widget. | 112 // See views::Widget. |
| 111 void SetNativeWindowProperty(const char* key, void* value); | 113 void SetNativeWindowProperty(const char* key, void* value); |
| 112 void* GetNativeWindowProperty(const char* key) const; | 114 void* GetNativeWindowProperty(const char* key) const; |
| 113 | 115 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 void OnPaintLayer(const ui::PaintContext& context) override; | 258 void OnPaintLayer(const ui::PaintContext& context) override; |
| 257 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | 259 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| 258 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 260 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 259 | 261 |
| 260 // Overridden from ui::AcceleratedWidgetMac: | 262 // Overridden from ui::AcceleratedWidgetMac: |
| 261 NSView* AcceleratedWidgetGetNSView() const override; | 263 NSView* AcceleratedWidgetGetNSView() const override; |
| 262 void AcceleratedWidgetGetVSyncParameters( | 264 void AcceleratedWidgetGetVSyncParameters( |
| 263 base::TimeTicks* timebase, base::TimeDelta* interval) const override; | 265 base::TimeTicks* timebase, base::TimeDelta* interval) const override; |
| 264 void AcceleratedWidgetSwapCompleted() override; | 266 void AcceleratedWidgetSwapCompleted() override; |
| 265 | 267 |
| 268 void SendStoredMouseExitedEventToWidget(); |
| 269 |
| 266 // Overridden from BridgedNativeWidgetOwner: | 270 // Overridden from BridgedNativeWidgetOwner: |
| 267 NSWindow* GetNSWindow() override; | 271 NSWindow* GetNSWindow() override; |
| 268 gfx::Vector2d GetChildWindowOffset() const override; | 272 gfx::Vector2d GetChildWindowOffset() const override; |
| 269 bool IsVisibleParent() const override; | 273 bool IsVisibleParent() const override; |
| 270 void RemoveChildWindow(BridgedNativeWidget* child) override; | 274 void RemoveChildWindow(BridgedNativeWidget* child) override; |
| 271 | 275 |
| 272 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. | 276 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. |
| 273 base::scoped_nsobject<NSWindow> window_; | 277 base::scoped_nsobject<NSWindow> window_; |
| 274 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; | 278 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; |
| 275 base::scoped_nsobject<BridgedContentView> bridged_view_; | 279 base::scoped_nsobject<BridgedContentView> bridged_view_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // shadow needs to be invalidated when a frame is received for the new shape. | 317 // shadow needs to be invalidated when a frame is received for the new shape. |
| 314 bool invalidate_shadow_on_frame_swap_ = false; | 318 bool invalidate_shadow_on_frame_swap_ = false; |
| 315 | 319 |
| 316 // Whether the window's visibility is suppressed currently. For opaque non- | 320 // Whether the window's visibility is suppressed currently. For opaque non- |
| 317 // modal windows, the window's alpha value is set to 0, till the frame from | 321 // modal windows, the window's alpha value is set to 0, till the frame from |
| 318 // the compositor arrives to avoid "blinking". | 322 // the compositor arrives to avoid "blinking". |
| 319 bool initial_visibility_suppressed_ = false; | 323 bool initial_visibility_suppressed_ = false; |
| 320 | 324 |
| 321 AssociatedViews associated_views_; | 325 AssociatedViews associated_views_; |
| 322 | 326 |
| 327 // We don't immediately send MouseExited notifications when we're inside of a |
| 328 // drag operation. |
| 329 std::unique_ptr<ui::MouseEvent> pendingExitEvent_; |
| 330 bool mouse_inside_ = false; |
| 331 |
| 323 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 332 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
| 324 }; | 333 }; |
| 325 | 334 |
| 326 } // namespace views | 335 } // namespace views |
| 327 | 336 |
| 328 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 337 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
| OLD | NEW |