Chromium Code Reviews| 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 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #import "ui/views/focus/focus_manager.h" | |
| 11 | 12 |
| 12 @class BridgedContentView; | 13 @class BridgedContentView; |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 | 16 |
| 16 class View; | 17 class View; |
| 17 | 18 |
| 18 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or | 19 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or |
| 19 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the | 20 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the |
| 20 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. | 21 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. |
| 21 class BridgedNativeWidget { | 22 class BridgedNativeWidget : public FocusChangeListener { |
| 22 public: | 23 public: |
| 23 BridgedNativeWidget(); | 24 BridgedNativeWidget(); |
| 24 ~BridgedNativeWidget(); | 25 virtual ~BridgedNativeWidget(); |
| 25 | 26 |
| 26 // Initialize the bridge, "retains" ownership of |window|. | 27 // Initialize the bridge, "retains" ownership of |window|. |
| 27 void Init(base::scoped_nsobject<NSWindow> window); | 28 void Init(base::scoped_nsobject<NSWindow> window); |
| 28 | 29 |
| 29 // Set or clears the views::View bridged by the content view. This does NOT | 30 // Set or clears the views::View bridged by the content view. This does NOT |
| 30 // take ownership of |view|. | 31 // take ownership of |view|. |
| 31 void SetRootView(views::View* view); | 32 void SetRootView(views::View* view); |
| 32 | 33 |
| 33 BridgedContentView* ns_view() { return bridged_view_; } | 34 BridgedContentView* ns_view() { return bridged_view_; } |
| 34 NSWindow* ns_window() { return window_; } | 35 NSWindow* ns_window() { return window_; } |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 base::scoped_nsobject<NSWindow> window_; | 38 base::scoped_nsobject<NSWindow> window_; |
| 38 base::scoped_nsobject<BridgedContentView> bridged_view_; | 39 base::scoped_nsobject<BridgedContentView> bridged_view_; |
| 39 | 40 |
| 41 // FocusChangeListener: | |
|
tapted
2014/06/17 13:23:56
convention around views seems to lean towards
//
Andre
2014/06/18 21:48:35
Done.
| |
| 42 virtual void OnWillChangeFocus(View* focused_before, | |
| 43 View* focused_now) OVERRIDE; | |
| 44 virtual void OnDidChangeFocus(View* focused_before, | |
| 45 View* focused_now) OVERRIDE; | |
| 46 | |
| 40 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); | 47 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
| 41 }; | 48 }; |
| 42 | 49 |
| 43 } // namespace views | 50 } // namespace views |
| 44 | 51 |
| 45 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ | 52 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
| OLD | NEW |