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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ~BridgedNativeWidget() override; | 55 ~BridgedNativeWidget() override; |
56 | 56 |
57 // Initialize the bridge, "retains" ownership of |window|. | 57 // Initialize the bridge, "retains" ownership of |window|. |
58 void Init(base::scoped_nsobject<NSWindow> window, | 58 void Init(base::scoped_nsobject<NSWindow> window, |
59 const Widget::InitParams& params); | 59 const Widget::InitParams& params); |
60 | 60 |
61 // Sets or clears the focus manager to use for tracking focused views. | 61 // Sets or clears the focus manager to use for tracking focused views. |
62 // This does NOT take ownership of |focus_manager|. | 62 // This does NOT take ownership of |focus_manager|. |
63 void SetFocusManager(FocusManager* focus_manager); | 63 void SetFocusManager(FocusManager* focus_manager); |
64 | 64 |
65 // Changes the bounds of the window and the hosted layer if present. | 65 // Changes the bounds of the window and the hosted layer if present. The |
| 66 // origin is a location in screen coordinates except for "child" windows, |
| 67 // which are positioned relative to their parent(). SetBounds() considers a |
| 68 // "child" window to be one initialized with InitParams specifying all of: |
| 69 // a |parent| NSWindow, the |child| attribute, and a |type| that |
| 70 // views::GetAuraWindowTypeForWidgetType does not consider a "popup" type. |
66 void SetBounds(const gfx::Rect& new_bounds); | 71 void SetBounds(const gfx::Rect& new_bounds); |
67 | 72 |
68 // Set or clears the views::View bridged by the content view. This does NOT | 73 // Set or clears the views::View bridged by the content view. This does NOT |
69 // take ownership of |view|. | 74 // take ownership of |view|. |
70 void SetRootView(views::View* view); | 75 void SetRootView(views::View* view); |
71 | 76 |
72 // Sets the desired visibility of the window and updates the visibility of | 77 // Sets the desired visibility of the window and updates the visibility of |
73 // descendant windows where necessary. | 78 // descendant windows where necessary. |
74 void SetVisibilityState(WindowVisibilityState new_state); | 79 void SetVisibilityState(WindowVisibilityState new_state); |
75 | 80 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 const std::vector<ui::LatencyInfo>& latency_info) override; | 209 const std::vector<ui::LatencyInfo>& latency_info) override; |
205 void AcceleratedWidgetHitError() override; | 210 void AcceleratedWidgetHitError() override; |
206 | 211 |
207 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. | 212 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. |
208 base::scoped_nsobject<NSWindow> window_; | 213 base::scoped_nsobject<NSWindow> window_; |
209 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; | 214 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; |
210 base::scoped_nsobject<BridgedContentView> bridged_view_; | 215 base::scoped_nsobject<BridgedContentView> bridged_view_; |
211 scoped_ptr<ui::InputMethod> input_method_; | 216 scoped_ptr<ui::InputMethod> input_method_; |
212 scoped_ptr<CocoaMouseCapture> mouse_capture_; | 217 scoped_ptr<CocoaMouseCapture> mouse_capture_; |
213 FocusManager* focus_manager_; // Weak. Owned by our Widget. | 218 FocusManager* focus_manager_; // Weak. Owned by our Widget. |
| 219 Widget::InitParams::Type widget_type_; |
214 | 220 |
215 BridgedNativeWidget* parent_; // Weak. If non-null, owns this. | 221 BridgedNativeWidget* parent_; // Weak. If non-null, owns this. |
216 std::vector<BridgedNativeWidget*> child_windows_; | 222 std::vector<BridgedNativeWidget*> child_windows_; |
217 | 223 |
218 base::scoped_nsobject<NSView> compositor_superview_; | 224 base::scoped_nsobject<NSView> compositor_superview_; |
219 scoped_ptr<ui::AcceleratedWidgetMac> compositor_widget_; | 225 scoped_ptr<ui::AcceleratedWidgetMac> compositor_widget_; |
220 scoped_ptr<ui::Compositor> compositor_; | 226 scoped_ptr<ui::Compositor> compositor_; |
221 | 227 |
222 // Tracks the bounds when the window last started entering fullscreen. Used to | 228 // Tracks the bounds when the window last started entering fullscreen. Used to |
223 // provide an answer for GetRestoredBounds(), but not ever sent to Cocoa (it | 229 // provide an answer for GetRestoredBounds(), but not ever sent to Cocoa (it |
(...skipping 15 matching lines...) Expand all Loading... |
239 // If true, the window is either visible, or wants to be visible but is | 245 // If true, the window is either visible, or wants to be visible but is |
240 // currently hidden due to having a hidden parent. | 246 // currently hidden due to having a hidden parent. |
241 bool wants_to_be_visible_; | 247 bool wants_to_be_visible_; |
242 | 248 |
243 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 249 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
244 }; | 250 }; |
245 | 251 |
246 } // namespace views | 252 } // namespace views |
247 | 253 |
248 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 254 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
OLD | NEW |