| 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 <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. | 42 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. |
| 43 class VIEWS_EXPORT BridgedNativeWidget | 43 class VIEWS_EXPORT BridgedNativeWidget |
| 44 : public ui::LayerDelegate, | 44 : public ui::LayerDelegate, |
| 45 public ui::LayerOwner, | 45 public ui::LayerOwner, |
| 46 public ui::internal::InputMethodDelegate, | 46 public ui::internal::InputMethodDelegate, |
| 47 public CocoaMouseCaptureDelegate, | 47 public CocoaMouseCaptureDelegate, |
| 48 public FocusChangeListener, | 48 public FocusChangeListener, |
| 49 public ui::AcceleratedWidgetMacNSView, | 49 public ui::AcceleratedWidgetMacNSView, |
| 50 public BridgedNativeWidgetOwner { | 50 public BridgedNativeWidgetOwner { |
| 51 public: | 51 public: |
| 52 // Contains NativeViewHost->gfx::NativeView associations. |
| 53 using AssociatedViews = std::map<const views::View*, NSView*>; |
| 54 |
| 52 // Ways of changing the visibility of the bridged NSWindow. | 55 // Ways of changing the visibility of the bridged NSWindow. |
| 53 enum WindowVisibilityState { | 56 enum WindowVisibilityState { |
| 54 HIDE_WINDOW, // Hides with -[NSWindow orderOut:]. | 57 HIDE_WINDOW, // Hides with -[NSWindow orderOut:]. |
| 55 SHOW_AND_ACTIVATE_WINDOW, // Shows with -[NSWindow makeKeyAndOrderFront:]. | 58 SHOW_AND_ACTIVATE_WINDOW, // Shows with -[NSWindow makeKeyAndOrderFront:]. |
| 56 SHOW_INACTIVE, // Shows with -[NSWindow orderWindow:..]. Orders | 59 SHOW_INACTIVE, // Shows with -[NSWindow orderWindow:..]. Orders |
| 57 // the window above its parent if it has one. | 60 // the window above its parent if it has one. |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 // Return the size that |window| will take for the given client area |size|, | 63 // Return the size that |window| will take for the given client area |size|, |
| 61 // based on its current style mask. | 64 // based on its current style mask. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // See widget.h for documentation. | 152 // See widget.h for documentation. |
| 150 ui::InputMethod* GetInputMethod(); | 153 ui::InputMethod* GetInputMethod(); |
| 151 | 154 |
| 152 // The restored bounds will be derived from the current NSWindow frame unless | 155 // The restored bounds will be derived from the current NSWindow frame unless |
| 153 // fullscreen or transitioning between fullscreen states. | 156 // fullscreen or transitioning between fullscreen states. |
| 154 gfx::Rect GetRestoredBounds() const; | 157 gfx::Rect GetRestoredBounds() const; |
| 155 | 158 |
| 156 // Creates a ui::Compositor which becomes responsible for drawing the window. | 159 // Creates a ui::Compositor which becomes responsible for drawing the window. |
| 157 void CreateLayer(ui::LayerType layer_type, bool translucent); | 160 void CreateLayer(ui::LayerType layer_type, bool translucent); |
| 158 | 161 |
| 162 // Updates |associated_views_| on NativeViewHost::Attach()/Detach(). |
| 163 void SetAssociationForView(const views::View* view, NSView* native_view); |
| 164 void ClearAssociationForView(const views::View* view); |
| 165 // Sorts child NSViews according to NativeViewHosts order in views hierarchy. |
| 166 void ReorderChildViews(); |
| 167 |
| 159 NativeWidgetMac* native_widget_mac() { return native_widget_mac_; } | 168 NativeWidgetMac* native_widget_mac() { return native_widget_mac_; } |
| 160 BridgedContentView* ns_view() { return bridged_view_; } | 169 BridgedContentView* ns_view() { return bridged_view_; } |
| 161 NSWindow* ns_window() { return window_; } | 170 NSWindow* ns_window() { return window_; } |
| 162 | 171 |
| 163 TooltipManager* tooltip_manager() { return tooltip_manager_.get(); } | 172 TooltipManager* tooltip_manager() { return tooltip_manager_.get(); } |
| 164 | 173 |
| 165 // The parent widget specified in Widget::InitParams::parent. If non-null, the | 174 // The parent widget specified in Widget::InitParams::parent. If non-null, the |
| 166 // parent will close children before the parent closes, and children will be | 175 // parent will close children before the parent closes, and children will be |
| 167 // raised above their parent when window z-order changes. | 176 // raised above their parent when window z-order changes. |
| 168 BridgedNativeWidgetOwner* parent() { return parent_; } | 177 BridgedNativeWidgetOwner* parent() { return parent_; } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 bool window_visible_; | 291 bool window_visible_; |
| 283 | 292 |
| 284 // If true, the window is either visible, or wants to be visible but is | 293 // If true, the window is either visible, or wants to be visible but is |
| 285 // currently hidden due to having a hidden parent. | 294 // currently hidden due to having a hidden parent. |
| 286 bool wants_to_be_visible_; | 295 bool wants_to_be_visible_; |
| 287 | 296 |
| 288 // If true, the window has been made visible or changed shape and the window | 297 // If true, the window has been made visible or changed shape and the window |
| 289 // shadow needs to be invalidated when a frame is received for the new shape. | 298 // shadow needs to be invalidated when a frame is received for the new shape. |
| 290 bool invalidate_shadow_on_frame_swap_ = false; | 299 bool invalidate_shadow_on_frame_swap_ = false; |
| 291 | 300 |
| 301 AssociatedViews associated_views_; |
| 302 |
| 292 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 303 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
| 293 }; | 304 }; |
| 294 | 305 |
| 295 } // namespace views | 306 } // namespace views |
| 296 | 307 |
| 297 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 308 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
| OLD | NEW |