| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Becauses of auto-repeat, we may receive the same key-press event many | 231 // Becauses of auto-repeat, we may receive the same key-press event many |
| 232 // times while we presses the keys and it is nonsense to send the same IPC | 232 // times while we presses the keys and it is nonsense to send the same IPC |
| 233 // messsage every time when we receive a key-press event. | 233 // messsage every time when we receive a key-press event. |
| 234 // To suppress the number of IPC messages, we just update the text direction | 234 // To suppress the number of IPC messages, we just update the text direction |
| 235 // when receiving a key-press event and send an IPC message when we release | 235 // when receiving a key-press event and send an IPC message when we release |
| 236 // the keys as listed in the following snippet. | 236 // the keys as listed in the following snippet. |
| 237 // if (key_event.type == WebKeyboardEvent::KEY_DOWN) { | 237 // if (key_event.type == WebKeyboardEvent::KEY_DOWN) { |
| 238 // if (key_event.windows_key_code == 'A' && | 238 // if (key_event.windows_key_code == 'A' && |
| 239 // key_event.modifiers == WebKeyboardEvent::CTRL_KEY) { | 239 // key_event.modifiers == WebKeyboardEvent::CTRL_KEY) { |
| 240 // UpdateTextDirection(dir); | 240 // UpdateTextDirection(dir); |
| 241 // } else { |
| 242 // CancelUpdateTextDirection(); |
| 241 // } | 243 // } |
| 242 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) { | 244 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) { |
| 243 // NotifyTextDirection(); | 245 // NotifyTextDirection(); |
| 244 // } | 246 // } |
| 247 // Once we cancel updating the text direction, we have to ignore all |
| 248 // succeeding UpdateTextDirection() requests until calling |
| 249 // NotifyTextDirection(). (We may receive keydown events even after we |
| 250 // canceled updating the text direction because of auto-repeat.) |
| 245 // Note: we cannot undo this change for compatibility with Firefox and IE. | 251 // Note: we cannot undo this change for compatibility with Firefox and IE. |
| 246 void UpdateTextDirection(WebTextDirection direction); | 252 void UpdateTextDirection(WebTextDirection direction); |
| 253 void CancelUpdateTextDirection(); |
| 247 void NotifyTextDirection(); | 254 void NotifyTextDirection(); |
| 248 | 255 |
| 249 // This is for derived classes to give us access to the resizer rect. | 256 // This is for derived classes to give us access to the resizer rect. |
| 250 // And to also expose it to the RenderWidgetHostView. | 257 // And to also expose it to the RenderWidgetHostView. |
| 251 virtual gfx::Rect GetRootWindowResizerRect() const; | 258 virtual gfx::Rect GetRootWindowResizerRect() const; |
| 252 | 259 |
| 253 protected: | 260 protected: |
| 254 // Internal implementation of the public Forward*Event() methods. | 261 // Internal implementation of the public Forward*Event() methods. |
| 255 void ForwardInputEvent( | 262 void ForwardInputEvent( |
| 256 const WebKit::WebInputEvent& input_event, int event_size); | 263 const WebKit::WebInputEvent& input_event, int event_size); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 403 |
| 397 // A queue of keyboard events. We can't trust data from the renderer so we | 404 // A queue of keyboard events. We can't trust data from the renderer so we |
| 398 // stuff key events into a queue and pop them out on ACK, feeding our copy | 405 // stuff key events into a queue and pop them out on ACK, feeding our copy |
| 399 // back to whatever unhandled handler instead of the returned version. | 406 // back to whatever unhandled handler instead of the returned version. |
| 400 KeyQueue key_queue_; | 407 KeyQueue key_queue_; |
| 401 | 408 |
| 402 // Set when we update the text direction of the selected input element. | 409 // Set when we update the text direction of the selected input element. |
| 403 bool text_direction_updated_; | 410 bool text_direction_updated_; |
| 404 WebTextDirection text_direction_; | 411 WebTextDirection text_direction_; |
| 405 | 412 |
| 413 // Set when we cancel updating the text direction. |
| 414 // This flag also ignores succeeding update requests until we call |
| 415 // NotifyTextDirection(). |
| 416 bool text_direction_canceled_; |
| 417 |
| 406 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); | 418 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); |
| 407 }; | 419 }; |
| 408 | 420 |
| 409 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 421 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
| OLD | NEW |