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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Ways of changing the visibility of the bridged NSWindow. | 45 // Ways of changing the visibility of the bridged NSWindow. |
46 enum WindowVisibilityState { | 46 enum WindowVisibilityState { |
47 HIDE_WINDOW, // Hides with -[NSWindow orderOut:]. | 47 HIDE_WINDOW, // Hides with -[NSWindow orderOut:]. |
48 SHOW_AND_ACTIVATE_WINDOW, // Shows with -[NSWindow makeKeyAndOrderFront:]. | 48 SHOW_AND_ACTIVATE_WINDOW, // Shows with -[NSWindow makeKeyAndOrderFront:]. |
49 SHOW_INACTIVE, // Shows with -[NSWindow orderWindow:..]. Orders | 49 SHOW_INACTIVE, // Shows with -[NSWindow orderWindow:..]. Orders |
50 // the window above its parent if it has one. | 50 // the window above its parent if it has one. |
51 }; | 51 }; |
52 | 52 |
53 // Creates one side of the bridge. |parent| must not be NULL. | 53 // Creates one side of the bridge. |parent| must not be NULL. |
54 explicit BridgedNativeWidget(NativeWidgetMac* parent); | 54 explicit BridgedNativeWidget(NativeWidgetMac* parent); |
55 virtual ~BridgedNativeWidget(); | 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. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // raised above their parent when window z-order changes. | 137 // raised above their parent when window z-order changes. |
138 BridgedNativeWidget* parent() { return parent_; } | 138 BridgedNativeWidget* parent() { return parent_; } |
139 const std::vector<BridgedNativeWidget*>& child_windows() { | 139 const std::vector<BridgedNativeWidget*>& child_windows() { |
140 return child_windows_; | 140 return child_windows_; |
141 } | 141 } |
142 | 142 |
143 bool target_fullscreen_state() const { return target_fullscreen_state_; } | 143 bool target_fullscreen_state() const { return target_fullscreen_state_; } |
144 bool window_visible() { return window_visible_; } | 144 bool window_visible() { return window_visible_; } |
145 | 145 |
146 // Overridden from internal::InputMethodDelegate: | 146 // Overridden from internal::InputMethodDelegate: |
147 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; | 147 void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; |
148 | 148 |
149 private: | 149 private: |
150 // Closes all child windows. BridgedNativeWidget children will be destroyed. | 150 // Closes all child windows. BridgedNativeWidget children will be destroyed. |
151 void RemoveOrDestroyChildren(); | 151 void RemoveOrDestroyChildren(); |
152 | 152 |
153 // Remove the given |child| from |child_windows_|. | 153 // Remove the given |child| from |child_windows_|. |
154 void RemoveChildWindow(BridgedNativeWidget* child); | 154 void RemoveChildWindow(BridgedNativeWidget* child); |
155 | 155 |
156 // Notify descendants of a visibility change. | 156 // Notify descendants of a visibility change. |
157 void NotifyVisibilityChangeDown(); | 157 void NotifyVisibilityChangeDown(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // If true, the window is either visible, or wants to be visible but is | 236 // If true, the window is either visible, or wants to be visible but is |
237 // currently hidden due to having a hidden parent. | 237 // currently hidden due to having a hidden parent. |
238 bool wants_to_be_visible_; | 238 bool wants_to_be_visible_; |
239 | 239 |
240 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 240 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
241 }; | 241 }; |
242 | 242 |
243 } // namespace views | 243 } // namespace views |
244 | 244 |
245 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 245 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
OLD | NEW |