OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 #import <QuartzCore/CALayer.h> | 10 #import <QuartzCore/CALayer.h> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // directly. | 66 // directly. |
67 // This object keeps the status of a composition of the renderer and returns | 67 // This object keeps the status of a composition of the renderer and returns |
68 // it when an input method asks for it. | 68 // it when an input method asks for it. |
69 // We need to implement Objective-C methods for the NSTextInput protocol. On | 69 // We need to implement Objective-C methods for the NSTextInput protocol. On |
70 // the other hand, we need to implement a C++ method for an IPC-message | 70 // the other hand, we need to implement a C++ method for an IPC-message |
71 // handler which receives input-method events from the renderer. | 71 // handler which receives input-method events from the renderer. |
72 | 72 |
73 // Represents the input-method attributes supported by this object. | 73 // Represents the input-method attributes supported by this object. |
74 scoped_nsobject<NSArray> validAttributesForMarkedText_; | 74 scoped_nsobject<NSArray> validAttributesForMarkedText_; |
75 | 75 |
76 // Represents the cursor position in this view coordinate. | |
77 // The renderer sends the cursor position through an IPC message. | |
78 // We save the latest cursor position here and return it when an input | |
79 // methods needs it. | |
80 NSRect caretRect_; | |
81 | |
82 // Indicates if we are currently handling a key down event. | 76 // Indicates if we are currently handling a key down event. |
83 BOOL handlingKeyDown_; | 77 BOOL handlingKeyDown_; |
84 | 78 |
85 // Indicates if there is any marked text. | 79 // Indicates if there is any marked text. |
86 BOOL hasMarkedText_; | 80 BOOL hasMarkedText_; |
87 | 81 |
88 // Indicates if unmarkText is called or not when handling a keyboard | 82 // Indicates if unmarkText is called or not when handling a keyboard |
89 // event. | 83 // event. |
90 BOOL unmarkTextCalled_; | 84 BOOL unmarkTextCalled_; |
91 | 85 |
92 // The range of current marked text inside the whole content of the DOM node | 86 // The range of current marked text inside the whole content of the DOM node |
93 // being edited. | 87 // being edited. |
94 // TODO(suzhe): This is currently a fake value, as we do not support accessing | 88 // TODO(suzhe): This is currently a fake value, as we do not support accessing |
95 // the whole content yet. | 89 // the whole content yet. |
96 NSRange markedRange_; | 90 NSRange markedRange_; |
97 | 91 |
98 // The selected range inside current marked text. | 92 // The selected range, cached from a message sent by the renderer. |
99 // TODO(suzhe): Currently it's only valid when there is any marked text. | |
100 // In the future, we may need to support accessing the whole content of the | |
101 // DOM node being edited, then this should be the selected range inside the | |
102 // DOM node. | |
103 NSRange selectedRange_; | 93 NSRange selectedRange_; |
104 | 94 |
105 // Text to be inserted which was generated by handling a key down event. | 95 // Text to be inserted which was generated by handling a key down event. |
106 string16 textToBeInserted_; | 96 string16 textToBeInserted_; |
107 | 97 |
108 // Marked text which was generated by handling a key down event. | 98 // Marked text which was generated by handling a key down event. |
109 string16 markedText_; | 99 string16 markedText_; |
110 | 100 |
111 // Underline information of the |markedText_|. | 101 // Underline information of the |markedText_|. |
112 std::vector<WebKit::WebCompositionUnderline> underlines_; | 102 std::vector<WebKit::WebCompositionUnderline> underlines_; |
(...skipping 10 matching lines...) Expand all Loading... |
123 // The plugin that currently has focus (-1 if no plugin has focus). | 113 // The plugin that currently has focus (-1 if no plugin has focus). |
124 int focusedPluginIdentifier_; | 114 int focusedPluginIdentifier_; |
125 | 115 |
126 // Whether or not plugin IME is currently enabled active. | 116 // Whether or not plugin IME is currently enabled active. |
127 BOOL pluginImeActive_; | 117 BOOL pluginImeActive_; |
128 | 118 |
129 // Whether the previous mouse event was ignored due to hitTest check. | 119 // Whether the previous mouse event was ignored due to hitTest check. |
130 BOOL mouseEventWasIgnored_; | 120 BOOL mouseEventWasIgnored_; |
131 } | 121 } |
132 | 122 |
133 @property(assign, nonatomic) NSRect caretRect; | 123 @property(nonatomic, readonly) NSRange selectedRange; |
134 | 124 |
135 - (void)setCanBeKeyView:(BOOL)can; | 125 - (void)setCanBeKeyView:(BOOL)can; |
136 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; | 126 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; |
137 - (void)setCloseOnDeactivate:(BOOL)b; | 127 - (void)setCloseOnDeactivate:(BOOL)b; |
138 - (void)setToolTipAtMousePoint:(NSString *)string; | 128 - (void)setToolTipAtMousePoint:(NSString *)string; |
139 // Set frame, then notify the RenderWidgetHost that the frame has been changed, | 129 // Set frame, then notify the RenderWidgetHost that the frame has been changed, |
140 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. | 130 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. |
141 // This stops the flickering issue in http://crbug.com/31970 | 131 // This stops the flickering issue in http://crbug.com/31970 |
142 - (void)setFrameWithDeferredUpdate:(NSRect)frame; | 132 - (void)setFrameWithDeferredUpdate:(NSRect)frame; |
143 // Notify the RenderWidgetHost that the frame was updated so it can resize | 133 // Notify the RenderWidgetHost that the frame was updated so it can resize |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 virtual bool HasFocus(); | 189 virtual bool HasFocus(); |
200 virtual void Show(); | 190 virtual void Show(); |
201 virtual void Hide(); | 191 virtual void Hide(); |
202 virtual bool IsShowing(); | 192 virtual bool IsShowing(); |
203 virtual gfx::Rect GetViewBounds() const; | 193 virtual gfx::Rect GetViewBounds() const; |
204 virtual void UpdateCursor(const WebCursor& cursor); | 194 virtual void UpdateCursor(const WebCursor& cursor); |
205 virtual void SetIsLoading(bool is_loading); | 195 virtual void SetIsLoading(bool is_loading); |
206 virtual void ImeUpdateTextInputState(WebKit::WebTextInputType state, | 196 virtual void ImeUpdateTextInputState(WebKit::WebTextInputType state, |
207 const gfx::Rect& caret_rect); | 197 const gfx::Rect& caret_rect); |
208 virtual void ImeCancelComposition(); | 198 virtual void ImeCancelComposition(); |
| 199 virtual void ImeCompositionRangeChanged(const ui::Range& range); |
209 virtual void DidUpdateBackingStore( | 200 virtual void DidUpdateBackingStore( |
210 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 201 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
211 const std::vector<gfx::Rect>& copy_rects); | 202 const std::vector<gfx::Rect>& copy_rects); |
212 virtual void RenderViewGone(base::TerminationStatus status, | 203 virtual void RenderViewGone(base::TerminationStatus status, |
213 int error_code); | 204 int error_code); |
214 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; | 205 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; |
215 virtual void Destroy(); | 206 virtual void Destroy(); |
216 virtual void SetTooltipText(const std::wstring& tooltip_text); | 207 virtual void SetTooltipText(const std::wstring& tooltip_text); |
217 virtual void SelectionChanged(const std::string& text); | 208 virtual void SelectionChanged(const std::string& text, |
| 209 const ui::Range& range); |
218 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 210 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
219 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); | 211 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); |
220 // See comment in RenderWidgetHostView! | 212 // See comment in RenderWidgetHostView! |
221 virtual gfx::Rect GetViewCocoaBounds() const; | 213 virtual gfx::Rect GetViewCocoaBounds() const; |
222 virtual gfx::Rect GetRootWindowRect(); | 214 virtual gfx::Rect GetRootWindowRect(); |
223 virtual void SetActive(bool active); | 215 virtual void SetActive(bool active); |
224 virtual void SetWindowVisibility(bool visible); | 216 virtual void SetWindowVisibility(bool visible); |
225 virtual void WindowFrameChanged(); | 217 virtual void WindowFrameChanged(); |
226 virtual void SetBackground(const SkBitmap& background); | 218 virtual void SetBackground(const SkBitmap& background); |
227 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 219 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // hidden until the software backing store has been updated. This variable is | 377 // hidden until the software backing store has been updated. This variable is |
386 // set when the gpu widget needs to be hidden once a paint is completed. | 378 // set when the gpu widget needs to be hidden once a paint is completed. |
387 bool needs_gpu_visibility_update_after_repaint_; | 379 bool needs_gpu_visibility_update_after_repaint_; |
388 | 380 |
389 gfx::PluginWindowHandle compositing_surface_; | 381 gfx::PluginWindowHandle compositing_surface_; |
390 | 382 |
391 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 383 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
392 }; | 384 }; |
393 | 385 |
394 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 386 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |