| 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 for which IME is currently enabled (-1 if not enabled). | 113 // The plugin for which IME is currently enabled (-1 if not enabled). |
| 124 int pluginImeIdentifier_; | 114 int pluginImeIdentifier_; |
| 125 } | 115 } |
| 126 | 116 |
| 127 @property(assign, nonatomic) NSRect caretRect; | |
| 128 | |
| 129 - (void)setCanBeKeyView:(BOOL)can; | 117 - (void)setCanBeKeyView:(BOOL)can; |
| 130 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; | 118 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; |
| 131 - (void)setCloseOnDeactivate:(BOOL)b; | 119 - (void)setCloseOnDeactivate:(BOOL)b; |
| 132 - (void)setToolTipAtMousePoint:(NSString *)string; | 120 - (void)setToolTipAtMousePoint:(NSString *)string; |
| 133 // Set frame, then notify the RenderWidgetHost that the frame has been changed, | 121 // Set frame, then notify the RenderWidgetHost that the frame has been changed, |
| 134 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. | 122 // but do it in a separate task, using |performSelector:withObject:afterDelay:|. |
| 135 // This stops the flickering issue in http://crbug.com/31970 | 123 // This stops the flickering issue in http://crbug.com/31970 |
| 136 - (void)setFrameWithDeferredUpdate:(NSRect)frame; | 124 - (void)setFrameWithDeferredUpdate:(NSRect)frame; |
| 137 // Notify the RenderWidgetHost that the frame was updated so it can resize | 125 // Notify the RenderWidgetHost that the frame was updated so it can resize |
| 138 // its contents. | 126 // its contents. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const gfx::Rect& caret_rect); | 186 const gfx::Rect& caret_rect); |
| 199 virtual void ImeCancelComposition(); | 187 virtual void ImeCancelComposition(); |
| 200 virtual void DidUpdateBackingStore( | 188 virtual void DidUpdateBackingStore( |
| 201 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 189 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
| 202 const std::vector<gfx::Rect>& copy_rects); | 190 const std::vector<gfx::Rect>& copy_rects); |
| 203 virtual void RenderViewGone(base::TerminationStatus status, | 191 virtual void RenderViewGone(base::TerminationStatus status, |
| 204 int error_code); | 192 int error_code); |
| 205 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; | 193 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; |
| 206 virtual void Destroy(); | 194 virtual void Destroy(); |
| 207 virtual void SetTooltipText(const std::wstring& tooltip_text); | 195 virtual void SetTooltipText(const std::wstring& tooltip_text); |
| 208 virtual void SelectionChanged(const std::string& text); | 196 virtual void SelectionChanged(const std::string& text, int start, int end); |
| 209 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 197 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
| 210 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); | 198 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); |
| 211 virtual gfx::Rect GetWindowRect(); | 199 virtual gfx::Rect GetWindowRect(); |
| 212 virtual gfx::Rect GetRootWindowRect(); | 200 virtual gfx::Rect GetRootWindowRect(); |
| 213 virtual void SetActive(bool active); | 201 virtual void SetActive(bool active); |
| 214 virtual void SetWindowVisibility(bool visible); | 202 virtual void SetWindowVisibility(bool visible); |
| 215 virtual void WindowFrameChanged(); | 203 virtual void WindowFrameChanged(); |
| 216 virtual void SetBackground(const SkBitmap& background); | 204 virtual void SetBackground(const SkBitmap& background); |
| 217 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 205 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
| 218 | 206 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 353 |
| 366 // When rendering transitions from gpu to software, the gpu widget can't be | 354 // When rendering transitions from gpu to software, the gpu widget can't be |
| 367 // hidden until the software backing store has been updated. This variable is | 355 // hidden until the software backing store has been updated. This variable is |
| 368 // set when the gpu widget needs to be hidden once a paint is completed. | 356 // set when the gpu widget needs to be hidden once a paint is completed. |
| 369 bool needs_gpu_visibility_update_after_repaint_; | 357 bool needs_gpu_visibility_update_after_repaint_; |
| 370 | 358 |
| 371 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 359 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 372 }; | 360 }; |
| 373 | 361 |
| 374 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 362 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |