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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host.h

Issue 39252: A tricky fix for Issue 1845.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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
11 #include "base/gfx/size.h" 11 #include "base/gfx/size.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/timer.h" 13 #include "base/timer.h"
14 #include "chrome/common/ipc_channel.h" 14 #include "chrome/common/ipc_channel.h"
15 #include "chrome/common/native_web_keyboard_event.h" 15 #include "chrome/common/native_web_keyboard_event.h"
16 #include "testing/gtest/include/gtest/gtest_prod.h" 16 #include "testing/gtest/include/gtest/gtest_prod.h"
17 #include "webkit/glue/webinputevent.h" 17 #include "webkit/glue/webinputevent.h"
18 #include "webkit/glue/webtextdirection.h"
18 19
19 namespace gfx { 20 namespace gfx {
20 class Rect; 21 class Rect;
21 } 22 }
22 23
23 class BackingStore; 24 class BackingStore;
24 class PaintObserver; 25 class PaintObserver;
25 class RenderProcessHost; 26 class RenderProcessHost;
26 class RenderWidgetHostView; 27 class RenderWidgetHostView;
27 class TransportDIB; 28 class TransportDIB;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Forwards the given message to the renderer. These are called by the view 209 // Forwards the given message to the renderer. These are called by the view
209 // when it has received a message. 210 // when it has received a message.
210 void ForwardMouseEvent(const WebMouseEvent& mouse_event); 211 void ForwardMouseEvent(const WebMouseEvent& mouse_event);
211 void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event); 212 void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event);
212 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event); 213 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event);
213 214
214 // This is for derived classes to give us access to the resizer rect. 215 // This is for derived classes to give us access to the resizer rect.
215 // And to also expose it to the RenderWidgetHostView. 216 // And to also expose it to the RenderWidgetHostView.
216 virtual gfx::Rect GetRootWindowResizerRect() const; 217 virtual gfx::Rect GetRootWindowResizerRect() const;
217 218
219 // Update the text direction of the focused input element and notify it to a
220 // renderer process.
221 // These functions have two usage scenarios: changing the text direction
222 // from a menu (as Safari does), and; changing the text direction when a user
223 // presses a set of keys (as IE and Firefox do).
224 // 1. Change the text direction from a menu.
225 // In this scenario, we receive a menu event only once and we should update
226 // the text direction immediately when a user chooses a menu item. So, we
227 // should call both functions at once as listed in the following snippet.
228 // void RenderViewHost::SetTextDirection(WebTextDirection direction) {
229 // UpdateTextDirectioN(direction);
230 // NotifyTextDirection();
231 // }
232 // 2. Change the text direction when pressing a set of keys.
233 // Becauses of auto-repeat, we may receive the same key-press event many
234 // times while we presses the keys and it is nonsense to send the same IPC
235 // messsage every time when we receive a key-press event.
236 // To suppress the number of IPC messages, we just update the text direction
237 // when receiving a key-press event and send an IPC message when we release
238 // the keys as listed in the following snippet.
239 // if (key_event.type == WebKeyboardEvent::KEY_DOWN) {
240 // if (key_event.windows_key_code == 'A' &&
241 // key_event.modifiers == WebKeyboardEvent::CTRL_KEY) {
242 // UpdateTextDirectioN(dir);
243 // }
244 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) {
245 // NotifyTextDirection();
246 // }
247 // Note: we cannot undo this change because either Firefox or IE cannot.
248 void UpdateTextDirection(WebTextDirection direction);
249 void NotifyTextDirection();
250
218 protected: 251 protected:
219 // Internal implementation of the public Forward*Event() methods. 252 // Internal implementation of the public Forward*Event() methods.
220 void ForwardInputEvent(const WebInputEvent& input_event, int event_size); 253 void ForwardInputEvent(const WebInputEvent& input_event, int event_size);
221 254
222 // Called when we receive a notification indicating that the renderer 255 // Called when we receive a notification indicating that the renderer
223 // process has gone. This will reset our state so that our state will be 256 // process has gone. This will reset our state so that our state will be
224 // consistent if a new renderer is created. 257 // consistent if a new renderer is created.
225 void RendererExited(); 258 void RendererExited();
226 259
227 // Called when we an InputEvent was not processed by the renderer. This is 260 // Called when we an InputEvent was not processed by the renderer. This is
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 base::TimeTicks repaint_start_time_; 389 base::TimeTicks repaint_start_time_;
357 390
358 // Queue of keyboard events that we need to track. 391 // Queue of keyboard events that we need to track.
359 typedef std::queue<NativeWebKeyboardEvent> KeyQueue; 392 typedef std::queue<NativeWebKeyboardEvent> KeyQueue;
360 393
361 // A queue of keyboard events. We can't trust data from the renderer so we 394 // A queue of keyboard events. We can't trust data from the renderer so we
362 // stuff key events into a queue and pop them out on ACK, feeding our copy 395 // stuff key events into a queue and pop them out on ACK, feeding our copy
363 // back to whatever unhandled handler instead of the returned version. 396 // back to whatever unhandled handler instead of the returned version.
364 KeyQueue key_queue_; 397 KeyQueue key_queue_;
365 398
399 // Set when we need to update the text direction.
400 bool text_direction_updated_;
401 WebTextDirection text_direction_;
402
366 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); 403 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost);
367 }; 404 };
368 405
369 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ 406 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698