OLD | NEW |
1 // Copyright (c) 2006-2008 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> |
11 | 11 |
(...skipping 54 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_; |
113 | 103 |
114 // Indicates if doCommandBySelector method receives any edit command when | 104 // Indicates if doCommandBySelector method receives any edit command when |
115 // handling a key down event. | 105 // handling a key down event. |
116 BOOL hasEditCommands_; | 106 BOOL hasEditCommands_; |
117 | 107 |
118 // Contains edit commands received by the -doCommandBySelector: method when | 108 // Contains edit commands received by the -doCommandBySelector: method when |
119 // handling a key down event, not including inserting commands, eg. insertTab, | 109 // handling a key down event, not including inserting commands, eg. insertTab, |
120 // etc. | 110 // etc. |
121 EditCommands editCommands_; | 111 EditCommands editCommands_; |
122 | 112 |
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 | 119 |
130 @property(assign, nonatomic) NSRect caretRect; | 120 @property(nonatomic, readonly) NSRange selectedRange; |
131 | 121 |
132 - (void)setCanBeKeyView:(BOOL)can; | 122 - (void)setCanBeKeyView:(BOOL)can; |
133 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; | 123 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; |
134 - (void)setCloseOnDeactivate:(BOOL)b; | 124 - (void)setCloseOnDeactivate:(BOOL)b; |
135 - (void)setToolTipAtMousePoint:(NSString *)string; | 125 - (void)setToolTipAtMousePoint:(NSString *)string; |
136 // Set frame, then notify the RenderWidgetHost that the frame has been changed, | 126 // Set frame, then notify the RenderWidgetHost that the frame has been changed, |
137 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. | 127 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. |
138 // This stops the flickering issue in http://crbug.com/31970 | 128 // This stops the flickering issue in http://crbug.com/31970 |
139 - (void)setFrameWithDeferredUpdate:(NSRect)frame; | 129 - (void)setFrameWithDeferredUpdate:(NSRect)frame; |
140 // Notify the RenderWidgetHost that the frame was updated so it can resize | 130 // Notify the RenderWidgetHost that the frame was updated so it can resize |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 virtual bool HasFocus(); | 185 virtual bool HasFocus(); |
196 virtual void Show(); | 186 virtual void Show(); |
197 virtual void Hide(); | 187 virtual void Hide(); |
198 virtual bool IsShowing(); | 188 virtual bool IsShowing(); |
199 virtual gfx::Rect GetViewBounds() const; | 189 virtual gfx::Rect GetViewBounds() const; |
200 virtual void UpdateCursor(const WebCursor& cursor); | 190 virtual void UpdateCursor(const WebCursor& cursor); |
201 virtual void SetIsLoading(bool is_loading); | 191 virtual void SetIsLoading(bool is_loading); |
202 virtual void ImeUpdateTextInputState(WebKit::WebTextInputType state, | 192 virtual void ImeUpdateTextInputState(WebKit::WebTextInputType state, |
203 const gfx::Rect& caret_rect); | 193 const gfx::Rect& caret_rect); |
204 virtual void ImeCancelComposition(); | 194 virtual void ImeCancelComposition(); |
| 195 virtual void ImeCompositionRangeChanged(int start, int end); |
205 virtual void DidUpdateBackingStore( | 196 virtual void DidUpdateBackingStore( |
206 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 197 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
207 const std::vector<gfx::Rect>& copy_rects); | 198 const std::vector<gfx::Rect>& copy_rects); |
208 virtual void RenderViewGone(base::TerminationStatus status, | 199 virtual void RenderViewGone(base::TerminationStatus status, |
209 int error_code); | 200 int error_code); |
210 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; | 201 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; |
211 virtual void Destroy(); | 202 virtual void Destroy(); |
212 virtual void SetTooltipText(const std::wstring& tooltip_text); | 203 virtual void SetTooltipText(const std::wstring& tooltip_text); |
213 virtual void SelectionChanged(const std::string& text); | 204 virtual void SelectionChanged(const std::string& text, int start, int end); |
214 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 205 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
215 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); | 206 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); |
216 // See comment in RenderWidgetHostView! | 207 // See comment in RenderWidgetHostView! |
217 virtual gfx::Rect GetViewCocoaBounds() const; | 208 virtual gfx::Rect GetViewCocoaBounds() const; |
218 virtual gfx::Rect GetRootWindowRect(); | 209 virtual gfx::Rect GetRootWindowRect(); |
219 virtual void SetActive(bool active); | 210 virtual void SetActive(bool active); |
220 virtual void SetWindowVisibility(bool visible); | 211 virtual void SetWindowVisibility(bool visible); |
221 virtual void WindowFrameChanged(); | 212 virtual void WindowFrameChanged(); |
222 virtual void SetBackground(const SkBitmap& background); | 213 virtual void SetBackground(const SkBitmap& background); |
223 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 214 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 363 |
373 // When rendering transitions from gpu to software, the gpu widget can't be | 364 // When rendering transitions from gpu to software, the gpu widget can't be |
374 // hidden until the software backing store has been updated. This variable is | 365 // hidden until the software backing store has been updated. This variable is |
375 // set when the gpu widget needs to be hidden once a paint is completed. | 366 // set when the gpu widget needs to be hidden once a paint is completed. |
376 bool needs_gpu_visibility_update_after_repaint_; | 367 bool needs_gpu_visibility_update_after_repaint_; |
377 | 368 |
378 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 369 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
379 }; | 370 }; |
380 | 371 |
381 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 372 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |