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

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

Issue 42495: A tricky fix for Issue 1845 (Take 2).... (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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // theme handles are invalid and the renderer must obtain new ones and 205 // theme handles are invalid and the renderer must obtain new ones and
205 // repaint. 206 // repaint.
206 void SystemThemeChanged(); 207 void SystemThemeChanged();
207 208
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
215 // Update the text direction of the focused input element and notify it to a
216 // renderer process.
217 // These functions have two usage scenarios: changing the text direction
218 // from a menu (as Safari does), and; changing the text direction when a user
219 // presses a set of keys (as IE and Firefox do).
220 // 1. Change the text direction from a menu.
221 // In this scenario, we receive a menu event only once and we should update
222 // the text direction immediately when a user chooses a menu item. So, we
223 // should call both functions at once as listed in the following snippet.
224 // void RenderViewHost::SetTextDirection(WebTextDirection direction) {
225 // UpdateTextDirection(direction);
226 // NotifyTextDirection();
227 // }
228 // 2. Change the text direction when pressing a set of keys.
229 // Becauses of auto-repeat, we may receive the same key-press event many
230 // times while we presses the keys and it is nonsense to send the same IPC
231 // messsage every time when we receive a key-press event.
232 // To suppress the number of IPC messages, we just update the text direction
233 // when receiving a key-press event and send an IPC message when we release
234 // the keys as listed in the following snippet.
235 // if (key_event.type == WebKeyboardEvent::KEY_DOWN) {
236 // if (key_event.windows_key_code == 'A' &&
237 // key_event.modifiers == WebKeyboardEvent::CTRL_KEY) {
238 // UpdateTextDirection(dir);
239 // }
240 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) {
241 // NotifyTextDirection();
242 // }
243 // Note: we cannot undo this change for compatibility with Firefox and IE.
244 void UpdateTextDirection(WebTextDirection direction);
245 void NotifyTextDirection();
246
214 // This is for derived classes to give us access to the resizer rect. 247 // This is for derived classes to give us access to the resizer rect.
215 // And to also expose it to the RenderWidgetHostView. 248 // And to also expose it to the RenderWidgetHostView.
216 virtual gfx::Rect GetRootWindowResizerRect() const; 249 virtual gfx::Rect GetRootWindowResizerRect() const;
217 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
(...skipping 132 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 update the text direction of the selected input element.
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