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_CONTENT_VIEW_H_ | 5 #ifndef UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_ |
6 #define UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_ | 6 #define UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #import "ui/base/cocoa/tool_tip_base_view.h" | 11 #import "ui/base/cocoa/tool_tip_base_view.h" |
12 #import "ui/base/cocoa/tracking_area.h" | 12 #import "ui/base/cocoa/tracking_area.h" |
13 #include "ui/views/cocoa/cocoa_drag_drop_manager.h" | |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 class TextInputClient; | 16 class TextInputClient; |
16 } | 17 } |
17 | 18 |
18 namespace views { | 19 namespace views { |
20 class CocoaDragDropManager; | |
19 class View; | 21 class View; |
20 } | 22 } |
21 | 23 |
22 // The NSView that sits as the root contentView of the NSWindow, whilst it has | 24 // The NSView that sits as the root contentView of the NSWindow, whilst it has |
23 // a views::RootView present. Bridges requests from Cocoa to the hosted | 25 // a views::RootView present. Bridges requests from Cocoa to the hosted |
24 // views::View. | 26 // views::View. |
25 @interface BridgedContentView | 27 @interface BridgedContentView |
26 : ToolTipBaseView<NSTextInputClient, NSUserInterfaceValidations> { | 28 : ToolTipBaseView<NSTextInputClient, NSUserInterfaceValidations> { |
27 @private | 29 @private |
28 // Weak. The hosted RootView, owned by hostedView_->GetWidget(). | 30 // Weak. The hosted RootView, owned by hostedView_->GetWidget(). |
29 views::View* hostedView_; | 31 views::View* hostedView_; |
30 | 32 |
33 // Weak. Owned by BridgedNativeWidget. | |
34 views::CocoaDragDropManager* drag_drop_manager_; | |
tapted
2016/05/11 12:36:15
It might be nicer to have a helper function that d
spqchan
2016/05/23 21:26:21
Done.
| |
35 | |
31 // Weak. If non-null the TextInputClient of the currently focused View in the | 36 // Weak. If non-null the TextInputClient of the currently focused View in the |
32 // hierarchy rooted at |hostedView_|. Owned by the focused View. | 37 // hierarchy rooted at |hostedView_|. Owned by the focused View. |
33 ui::TextInputClient* textInputClient_; | 38 ui::TextInputClient* textInputClient_; |
34 | 39 |
35 // A tracking area installed to enable mouseMoved events. | 40 // A tracking area installed to enable mouseMoved events. |
36 ui::ScopedCrTrackingArea cursorTrackingArea_; | 41 ui::ScopedCrTrackingArea cursorTrackingArea_; |
37 | 42 |
38 // Whether the view is reacting to a keyDown event on the view. | 43 // Whether the view is reacting to a keyDown event on the view. |
39 BOOL inKeyDown_; | 44 BOOL inKeyDown_; |
40 | 45 |
(...skipping 14 matching lines...) Expand all Loading... | |
55 @property(readonly, nonatomic) views::View* hostedView; | 60 @property(readonly, nonatomic) views::View* hostedView; |
56 @property(assign, nonatomic) ui::TextInputClient* textInputClient; | 61 @property(assign, nonatomic) ui::TextInputClient* textInputClient; |
57 @property(assign, nonatomic) BOOL drawMenuBackgroundForBlur; | 62 @property(assign, nonatomic) BOOL drawMenuBackgroundForBlur; |
58 | 63 |
59 // Extends an atomic, readonly property on NSView to make it assignable. | 64 // Extends an atomic, readonly property on NSView to make it assignable. |
60 // This usually returns YES if the view is transparent. We want to control it | 65 // This usually returns YES if the view is transparent. We want to control it |
61 // so that BridgedNativeWidget can dynamically enable dragging of the window. | 66 // so that BridgedNativeWidget can dynamically enable dragging of the window. |
62 @property(assign) BOOL mouseDownCanMoveWindow; | 67 @property(assign) BOOL mouseDownCanMoveWindow; |
63 | 68 |
64 // Initialize the NSView -> views::View bridge. |viewToHost| must be non-NULL. | 69 // Initialize the NSView -> views::View bridge. |viewToHost| must be non-NULL. |
65 - (id)initWithView:(views::View*)viewToHost; | 70 - (id)initWithView:(views::View*)viewToHost |
71 dragDropManager:(views::CocoaDragDropManager*)dragDropManager; | |
66 | 72 |
67 // Clear the hosted view. For example, if it is about to be destroyed. | 73 // Clear the hosted view. For example, if it is about to be destroyed. |
68 - (void)clearView; | 74 - (void)clearView; |
69 | 75 |
70 // Process a mouse event captured while the widget had global mouse capture. | 76 // Process a mouse event captured while the widget had global mouse capture. |
71 - (void)processCapturedMouseEvent:(NSEvent*)theEvent; | 77 - (void)processCapturedMouseEvent:(NSEvent*)theEvent; |
72 | 78 |
73 // Mac's version of views::corewm::TooltipController::UpdateIfRequired(). | 79 // Mac's version of views::corewm::TooltipController::UpdateIfRequired(). |
74 // Updates the tooltip on the ToolTipBaseView if the text needs to change. | 80 // Updates the tooltip on the ToolTipBaseView if the text needs to change. |
75 // |locationInContent| is the position from the top left of the window's | 81 // |locationInContent| is the position from the top left of the window's |
76 // contentRect (also this NSView's frame), as given by a ui::LocatedEvent. | 82 // contentRect (also this NSView's frame), as given by a ui::LocatedEvent. |
77 - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent; | 83 - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent; |
78 | 84 |
79 // Update windowMask_ depending on the current view bounds. | 85 // Update windowMask_ depending on the current view bounds. |
80 - (void)updateWindowMask; | 86 - (void)updateWindowMask; |
81 | 87 |
82 // Notifies the associated FocusManager whether full keyboard access is enabled | 88 // Notifies the associated FocusManager whether full keyboard access is enabled |
83 // or not. | 89 // or not. |
84 - (void)updateFullKeyboardAccess; | 90 - (void)updateFullKeyboardAccess; |
85 | 91 |
86 @end | 92 @end |
87 | 93 |
88 #endif // UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_ | 94 #endif // UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_ |
OLD | NEW |