Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1890)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.h

Issue 150206: Implement the NSTextInput protocol.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.h
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.h (revision 22136)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.h (working copy)
@@ -29,7 +29,8 @@
// but that means that the view needs to own the delegate and will dispose of it
// when it's removed from the view system.
-@interface RenderWidgetHostViewCocoa : BaseView <RenderWidgetHostViewMacOwner> {
+@interface RenderWidgetHostViewCocoa
+ : BaseView <RenderWidgetHostViewMacOwner, NSTextInput> {
@private
RenderWidgetHostViewMac* renderWidgetHostView_;
BOOL canBeKeyView_;
@@ -130,6 +131,49 @@
// value returns true for is_null() if we are not recording whiteout times.
base::TimeTicks whiteout_start_time_;
+ // Variables used by our implementaion of the NSTextInput protocol.
+ // An input method of Mac calls the methods of this protocol not only to
+ // notify an application of its status, but also to retrieve the status of
+ // the application. That is, an application cannot control an input method
+ // directly.
+ // This object keeps the status of a composition of the renderer and returns
+ // it when an input method asks for it.
+ // We need to implement Objective-C methods for the NSTextInput protocol. On
+ // the other hand, we need to implement a C++ method for an IPC-message
+ // handler which receives input-method events from the renderer.
+ // To avoid fragmentation of variables used by our input-method
+ // implementation, we define all variables as public member variables of
+ // this C++ class so both the C++ methods and the Objective-C methods can
+ // access them.
+
+ // Represents the input-method attributes supported by this object.
+ NSArray* im_attributes_;
+
+ // Represents whether or not an input method is composing a text.
+ bool im_composing_;
+
+ // Represents the range of the composition string (i.e. a text being
+ // composed by an input method), and the range of the selected text of the
+ // composition string.
+ // TODO(hbono): need to save the composition string itself for the
+ // attributedSubstringFromRange method?
+ NSRange im_marked_range_;
+ NSRange im_selected_range_;
+
+ // Represents the state of modifier keys.
+ // An input method doesn't notify the state of modifier keys. On the other
+ // hand, the state of modifier keys are required by Char events because they
+ // are dispatched to onkeypress() event handlers of JavaScript.
+ // To create a Char event in NSTextInput methods, we save the latest state
+ // of modifier keys when we receive it.
+ int im_modifiers_;
+
+ // Represents the cursor position in this view coordinate.
+ // The renderer sends the cursor position through an IPC message.
+ // We save the latest cursor position here and return it when an input
+ // methods needs it.
+ NSRect im_caret_rect_;
+
private:
// Updates the display cursor to the current cursor if the cursor is over this
// render view.
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698