OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <IOSurface/IOSurfaceAPI.h> | 9 #include <IOSurface/IOSurfaceAPI.h> |
10 #include <list> | 10 #include <list> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h" | 24 #include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h" |
25 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 25 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
27 #include "content/common/cursors/webcursor.h" | 27 #include "content/common/cursors/webcursor.h" |
28 #include "content/common/edit_command.h" | 28 #include "content/common/edit_command.h" |
29 #import "content/public/browser/render_widget_host_view_mac_base.h" | 29 #import "content/public/browser/render_widget_host_view_mac_base.h" |
30 #include "ipc/ipc_sender.h" | 30 #include "ipc/ipc_sender.h" |
31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
32 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 32 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
33 #include "ui/accelerated_widget_mac/io_surface_layer.h" | 33 #include "ui/accelerated_widget_mac/io_surface_layer.h" |
34 #include "ui/base/cocoa/base_view.h" | |
35 #include "ui/base/cocoa/remote_layer_api.h" | 34 #include "ui/base/cocoa/remote_layer_api.h" |
| 35 #import "ui/base/cocoa/tool_tip_base_view.h" |
36 #include "ui/gfx/display_observer.h" | 36 #include "ui/gfx/display_observer.h" |
37 | 37 |
38 namespace content { | 38 namespace content { |
39 class RenderWidgetHostImpl; | 39 class RenderWidgetHostImpl; |
40 class RenderWidgetHostViewMac; | 40 class RenderWidgetHostViewMac; |
41 class RenderWidgetHostViewMacEditCommandHelper; | 41 class RenderWidgetHostViewMacEditCommandHelper; |
42 class WebContents; | 42 class WebContents; |
43 } | 43 } |
44 | 44 |
45 namespace ui { | 45 namespace ui { |
46 class Compositor; | 46 class Compositor; |
47 class Layer; | 47 class Layer; |
48 } | 48 } |
49 | 49 |
50 @class FullscreenWindowManager; | 50 @class FullscreenWindowManager; |
51 @protocol RenderWidgetHostViewMacDelegate; | 51 @protocol RenderWidgetHostViewMacDelegate; |
52 @class ToolTip; | |
53 | 52 |
54 @protocol RenderWidgetHostViewMacOwner | 53 @protocol RenderWidgetHostViewMacOwner |
55 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac; | 54 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac; |
56 @end | 55 @end |
57 | 56 |
58 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, | 57 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, |
59 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles | 58 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles |
60 // but that means that the view needs to own the delegate and will dispose of it | 59 // but that means that the view needs to own the delegate and will dispose of it |
61 // when it's removed from the view system. | 60 // when it's removed from the view system. |
62 @interface RenderWidgetHostViewCocoa | 61 @interface RenderWidgetHostViewCocoa |
63 : BaseView <RenderWidgetHostViewMacBase, | 62 : ToolTipBaseView<RenderWidgetHostViewMacBase, |
64 RenderWidgetHostViewMacOwner, | 63 RenderWidgetHostViewMacOwner, |
65 NSTextInputClient> { | 64 NSTextInputClient> { |
66 @private | 65 @private |
67 scoped_ptr<content::RenderWidgetHostViewMac> renderWidgetHostView_; | 66 scoped_ptr<content::RenderWidgetHostViewMac> renderWidgetHostView_; |
68 // This ivar is the cocoa delegate of the NSResponder. | 67 // This ivar is the cocoa delegate of the NSResponder. |
69 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate>> | 68 base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate>> |
70 responderDelegate_; | 69 responderDelegate_; |
71 BOOL canBeKeyView_; | 70 BOOL canBeKeyView_; |
72 BOOL closeOnDeactivate_; | 71 BOOL closeOnDeactivate_; |
73 BOOL opaque_; | 72 BOOL opaque_; |
74 scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper> | 73 scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper> |
75 editCommand_helper_; | 74 editCommand_helper_; |
76 | 75 |
77 // These are part of the magic tooltip code from WebKit's WebHTMLView: | |
78 id trackingRectOwner_; // (not retained) | |
79 void* trackingRectUserData_; | |
80 NSTrackingRectTag lastToolTipTag_; | |
81 base::scoped_nsobject<NSString> toolTip_; | |
82 | |
83 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up. | 76 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up. |
84 BOOL hasOpenMouseDown_; | 77 BOOL hasOpenMouseDown_; |
85 | 78 |
86 NSWindow* lastWindow_; // weak | 79 NSWindow* lastWindow_; // weak |
87 | 80 |
88 // The cursor for the page. This is passed up from the renderer. | 81 // The cursor for the page. This is passed up from the renderer. |
89 base::scoped_nsobject<NSCursor> currentCursor_; | 82 base::scoped_nsobject<NSCursor> currentCursor_; |
90 | 83 |
91 // Variables used by our implementaion of the NSTextInput protocol. | 84 // Variables used by our implementaion of the NSTextInput protocol. |
92 // An input method of Mac calls the methods of this protocol not only to | 85 // An input method of Mac calls the methods of this protocol not only to |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // orientation. | 179 // orientation. |
187 content::MouseWheelRailsFilterMac mouseWheelFilter_; | 180 content::MouseWheelRailsFilterMac mouseWheelFilter_; |
188 } | 181 } |
189 | 182 |
190 @property(nonatomic, readonly) NSRange selectedRange; | 183 @property(nonatomic, readonly) NSRange selectedRange; |
191 @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp; | 184 @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp; |
192 | 185 |
193 - (void)setCanBeKeyView:(BOOL)can; | 186 - (void)setCanBeKeyView:(BOOL)can; |
194 - (void)setCloseOnDeactivate:(BOOL)b; | 187 - (void)setCloseOnDeactivate:(BOOL)b; |
195 - (void)setOpaque:(BOOL)opaque; | 188 - (void)setOpaque:(BOOL)opaque; |
196 - (void)setToolTipAtMousePoint:(NSString *)string; | |
197 // True for always-on-top special windows (e.g. Balloons and Panels). | 189 // True for always-on-top special windows (e.g. Balloons and Panels). |
198 - (BOOL)acceptsMouseEventsWhenInactive; | 190 - (BOOL)acceptsMouseEventsWhenInactive; |
199 // Cancel ongoing composition (abandon the marked text). | 191 // Cancel ongoing composition (abandon the marked text). |
200 - (void)cancelComposition; | 192 - (void)cancelComposition; |
201 // Confirm ongoing composition. | 193 // Confirm ongoing composition. |
202 - (void)confirmComposition; | 194 - (void)confirmComposition; |
203 // Enables or disables plugin IME. | 195 // Enables or disables plugin IME. |
204 - (void)setPluginImeActive:(BOOL)active; | 196 - (void)setPluginImeActive:(BOOL)active; |
205 // Updates the current plugin focus state. | 197 // Updates the current plugin focus state. |
206 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId; | 198 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 576 |
585 // Factory used to safely scope delayed calls to ShutdownHost(). | 577 // Factory used to safely scope delayed calls to ShutdownHost(). |
586 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 578 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
587 | 579 |
588 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 580 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
589 }; | 581 }; |
590 | 582 |
591 } // namespace content | 583 } // namespace content |
592 | 584 |
593 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 585 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |