OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // } | 272 // } |
273 // Once we cancel updating the text direction, we have to ignore all | 273 // Once we cancel updating the text direction, we have to ignore all |
274 // succeeding UpdateTextDirection() requests until calling | 274 // succeeding UpdateTextDirection() requests until calling |
275 // NotifyTextDirection(). (We may receive keydown events even after we | 275 // NotifyTextDirection(). (We may receive keydown events even after we |
276 // canceled updating the text direction because of auto-repeat.) | 276 // canceled updating the text direction because of auto-repeat.) |
277 // Note: we cannot undo this change for compatibility with Firefox and IE. | 277 // Note: we cannot undo this change for compatibility with Firefox and IE. |
278 void UpdateTextDirection(WebTextDirection direction); | 278 void UpdateTextDirection(WebTextDirection direction); |
279 void CancelUpdateTextDirection(); | 279 void CancelUpdateTextDirection(); |
280 void NotifyTextDirection(); | 280 void NotifyTextDirection(); |
281 | 281 |
| 282 // Notifies the renderer whether or not the IME attached to this process is |
| 283 // activated. |
| 284 // When the IME is activated, a renderer process sends IPC messages to notify |
| 285 // the status of its composition node. (This message is mainly used for |
| 286 // notifying the position of the input cursor so that the browser can |
| 287 // display IME windows under the cursor.) |
| 288 void ImeSetInputMode(bool activate); |
| 289 |
| 290 // Update the composition node of the renderer (or WebKit). |
| 291 // WebKit has a special node (a composition node) for IMEs to change its text |
| 292 // without affecting any other DOM nodes. When the IME (attached to the |
| 293 // browser) updates its text, the browser sends IPC messages to update the |
| 294 // composition node of the renderer. |
| 295 // (Read the comments of each function for its detail.) |
| 296 |
| 297 // Sets the text of the composition node. |
| 298 // This function can also update the cursor position and mark the specified |
| 299 // range in the composition node. |
| 300 // A browser should call this function: |
| 301 // * when it receives a WM_IME_COMPOSITION message with a GCS_COMPSTR flag |
| 302 // (on Windows); |
| 303 // * when it receives a "preedit_changed" signal of GtkIMContext (on Linux); |
| 304 // * when markedText of NSTextInput is called (on Mac). |
| 305 void ImeSetComposition(const std::wstring& ime_string, |
| 306 int cursor_position, |
| 307 int target_start, |
| 308 int target_end); |
| 309 |
| 310 // Finishes an ongoing composition with the specified text. |
| 311 // A browser should call this function: |
| 312 // * when it receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR flag |
| 313 // (on Windows); |
| 314 // * when it receives a "commit" signal of GtkIMContext (on Linux); |
| 315 // * when insertText of NSTextInput is called (on Mac). |
| 316 void ImeConfirmComposition(const std::wstring& ime_string); |
| 317 |
| 318 // Cancels an ongoing composition. |
| 319 void ImeCancelComposition(); |
| 320 |
282 // This is for derived classes to give us access to the resizer rect. | 321 // This is for derived classes to give us access to the resizer rect. |
283 // And to also expose it to the RenderWidgetHostView. | 322 // And to also expose it to the RenderWidgetHostView. |
284 virtual gfx::Rect GetRootWindowResizerRect() const; | 323 virtual gfx::Rect GetRootWindowResizerRect() const; |
285 | 324 |
286 protected: | 325 protected: |
287 // Internal implementation of the public Forward*Event() methods. | 326 // Internal implementation of the public Forward*Event() methods. |
288 void ForwardInputEvent( | 327 void ForwardInputEvent( |
289 const WebKit::WebInputEvent& input_event, int event_size); | 328 const WebKit::WebInputEvent& input_event, int event_size); |
290 | 329 |
291 // Called when we receive a notification indicating that the renderer | 330 // Called when we receive a notification indicating that the renderer |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 496 |
458 // Set when we cancel updating the text direction. | 497 // Set when we cancel updating the text direction. |
459 // This flag also ignores succeeding update requests until we call | 498 // This flag also ignores succeeding update requests until we call |
460 // NotifyTextDirection(). | 499 // NotifyTextDirection(). |
461 bool text_direction_canceled_; | 500 bool text_direction_canceled_; |
462 | 501 |
463 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); | 502 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); |
464 }; | 503 }; |
465 | 504 |
466 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 505 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
OLD | NEW |