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 11 matching lines...) Expand all Loading... | |
22 @class BridgedContentView; | 22 @class BridgedContentView; |
23 @class ViewsNSWindowDelegate; | 23 @class ViewsNSWindowDelegate; |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 class InputMethod; | 26 class InputMethod; |
27 } | 27 } |
28 | 28 |
29 namespace views { | 29 namespace views { |
30 | 30 |
31 class CocoaMouseCapture; | 31 class CocoaMouseCapture; |
32 class CocoaNonClientDrag; | |
32 class InputMethod; | 33 class InputMethod; |
33 class NativeWidgetMac; | 34 class NativeWidgetMac; |
34 class View; | 35 class View; |
35 | 36 |
36 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or | 37 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or |
37 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the | 38 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the |
38 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. | 39 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. |
39 class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate, | 40 class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate, |
40 public ui::LayerOwner, | 41 public ui::LayerOwner, |
41 public internal::InputMethodDelegate, | 42 public internal::InputMethodDelegate, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // Explicitly set the visibility. This is called when Cocoa requests a draw, | 126 // Explicitly set the visibility. This is called when Cocoa requests a draw, |
126 // but hasn't updated the value of -[NSWindow isVisible] yet. | 127 // but hasn't updated the value of -[NSWindow isVisible] yet. |
127 void OnVisibilityChangedTo(bool new_visibility); | 128 void OnVisibilityChangedTo(bool new_visibility); |
128 | 129 |
129 // Called by the NSWindowDelegate on a scale factor or color space change. | 130 // Called by the NSWindowDelegate on a scale factor or color space change. |
130 void OnBackingPropertiesChanged(); | 131 void OnBackingPropertiesChanged(); |
131 | 132 |
132 // Called by the NSWindowDelegate when the window becomes or resigns key. | 133 // Called by the NSWindowDelegate when the window becomes or resigns key. |
133 void OnWindowKeyStatusChangedTo(bool is_key); | 134 void OnWindowKeyStatusChangedTo(bool is_key); |
134 | 135 |
136 // Called when the application receives a mouse-down, but before the event | |
137 // is processed by NSWindows. Returning true here will cause the event to be | |
138 // reposted. | |
tapted
2015/05/20 07:18:15
Perhaps say why this exists here.
jackhou1
2015/05/22 02:49:16
Done.
| |
139 bool OnWindowWillReceiveLeftMouseDown(NSPoint location_in_window); | |
tapted
2015/05/20 07:18:15
perhaps ShouldRepostPendingLeftMouseDown ?
jackhou1
2015/05/22 02:49:16
Done.
| |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 gfx::Vector2d GetChildWindowOffset() const override; | 227 gfx::Vector2d GetChildWindowOffset() const override; |
222 bool IsVisibleParent() const override; | 228 bool IsVisibleParent() const override; |
223 void RemoveChildWindow(BridgedNativeWidget* child) override; | 229 void RemoveChildWindow(BridgedNativeWidget* child) override; |
224 | 230 |
225 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. | 231 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. |
226 base::scoped_nsobject<NSWindow> window_; | 232 base::scoped_nsobject<NSWindow> window_; |
227 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; | 233 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; |
228 base::scoped_nsobject<BridgedContentView> bridged_view_; | 234 base::scoped_nsobject<BridgedContentView> bridged_view_; |
229 scoped_ptr<ui::InputMethod> input_method_; | 235 scoped_ptr<ui::InputMethod> input_method_; |
230 scoped_ptr<CocoaMouseCapture> mouse_capture_; | 236 scoped_ptr<CocoaMouseCapture> mouse_capture_; |
237 scoped_ptr<CocoaNonClientDrag> non_client_drag_; | |
231 FocusManager* focus_manager_; // Weak. Owned by our Widget. | 238 FocusManager* focus_manager_; // Weak. Owned by our Widget. |
232 Widget::InitParams::Type widget_type_; | 239 Widget::InitParams::Type widget_type_; |
233 | 240 |
234 BridgedNativeWidgetOwner* parent_; // Weak. If non-null, owns this. | 241 BridgedNativeWidgetOwner* parent_; // Weak. If non-null, owns this. |
235 std::vector<BridgedNativeWidget*> child_windows_; | 242 std::vector<BridgedNativeWidget*> child_windows_; |
236 | 243 |
237 base::scoped_nsobject<NSView> compositor_superview_; | 244 base::scoped_nsobject<NSView> compositor_superview_; |
238 scoped_ptr<ui::AcceleratedWidgetMac> compositor_widget_; | 245 scoped_ptr<ui::AcceleratedWidgetMac> compositor_widget_; |
239 scoped_ptr<ui::Compositor> compositor_; | 246 scoped_ptr<ui::Compositor> compositor_; |
240 | 247 |
(...skipping 17 matching lines...) Expand all Loading... | |
258 // If true, the window is either visible, or wants to be visible but is | 265 // If true, the window is either visible, or wants to be visible but is |
259 // currently hidden due to having a hidden parent. | 266 // currently hidden due to having a hidden parent. |
260 bool wants_to_be_visible_; | 267 bool wants_to_be_visible_; |
261 | 268 |
262 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 269 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
263 }; | 270 }; |
264 | 271 |
265 } // namespace views | 272 } // namespace views |
266 | 273 |
267 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 274 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
OLD | NEW |