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

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

Issue 40065: RenderWidgetHost now stores both the WebKeyboardEvent and the native (Closed)
Patch Set: Redesign 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
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/timer.h" 12 #include "base/timer.h"
13 #include "chrome/common/ipc_channel.h" 13 #include "chrome/common/ipc_channel.h"
14 #include "chrome/common/native_web_keyboard_event.h"
14 #include "testing/gtest/include/gtest/gtest_prod.h" 15 #include "testing/gtest/include/gtest/gtest_prod.h"
15 #include "webkit/glue/webinputevent.h" 16 #include "webkit/glue/webinputevent.h"
16 17
17 namespace gfx { 18 namespace gfx {
18 class Rect; 19 class Rect;
19 } 20 }
20 21
21 class BackingStore; 22 class BackingStore;
22 class PaintObserver; 23 class PaintObserver;
23 class RenderProcessHost; 24 class RenderProcessHost;
24 class RenderWidgetHostView; 25 class RenderWidgetHostView;
25 class TransportDIB; 26 class TransportDIB;
26 class WebInputEvent; 27 class WebInputEvent;
27 class WebKeyboardEvent;
28 class WebMouseEvent; 28 class WebMouseEvent;
29 class WebMouseWheelEvent; 29 class WebMouseWheelEvent;
30 class WebCursor; 30 class WebCursor;
31 struct ViewHostMsg_PaintRect_Params; 31 struct ViewHostMsg_PaintRect_Params;
32 struct ViewHostMsg_ScrollRect_Params; 32 struct ViewHostMsg_ScrollRect_Params;
33 33
34 // This class manages the browser side of a browser<->renderer HWND connection. 34 // This class manages the browser side of a browser<->renderer HWND connection.
35 // The HWND lives in the browser process, and windows events are sent over 35 // The HWND lives in the browser process, and windows events are sent over
36 // IPC to the corresponding object in the renderer. The renderer paints into 36 // IPC to the corresponding object in the renderer. The renderer paints into
37 // shared memory, which we transfer to a backing store and blit to the screen 37 // shared memory, which we transfer to a backing store and blit to the screen
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // Called when the system theme changes. At this time all existing native 202 // Called when the system theme changes. At this time all existing native
203 // theme handles are invalid and the renderer must obtain new ones and 203 // theme handles are invalid and the renderer must obtain new ones and
204 // repaint. 204 // repaint.
205 void SystemThemeChanged(); 205 void SystemThemeChanged();
206 206
207 // Forwards the given message to the renderer. These are called by the view 207 // Forwards the given message to the renderer. These are called by the view
208 // when it has received a message. 208 // when it has received a message.
209 void ForwardMouseEvent(const WebMouseEvent& mouse_event); 209 void ForwardMouseEvent(const WebMouseEvent& mouse_event);
210 void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event); 210 void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event);
211 void ForwardKeyboardEvent(const WebKeyboardEvent& key_event); 211 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event);
212 void ForwardInputEvent(const WebInputEvent& input_event, int event_size);
213 212
214 // This is for derived classes to give us access to the resizer rect. 213 // This is for derived classes to give us access to the resizer rect.
215 // And to also expose it to the RenderWidgetHostView. 214 // And to also expose it to the RenderWidgetHostView.
216 virtual gfx::Rect GetRootWindowResizerRect() const; 215 virtual gfx::Rect GetRootWindowResizerRect() const;
217 216
218 protected: 217 protected:
218 // Internal implementation of the public Forward*Event() methods.
219 void ForwardInputEvent(const WebInputEvent& input_event, int event_size);
220
219 // Called when we receive a notification indicating that the renderer 221 // Called when we receive a notification indicating that the renderer
220 // process has gone. This will reset our state so that our state will be 222 // process has gone. This will reset our state so that our state will be
221 // consistent if a new renderer is created. 223 // consistent if a new renderer is created.
222 void RendererExited(); 224 void RendererExited();
223 225
224 // Called when we an InputEvent was not processed by the renderer. This is 226 // Called when we an InputEvent was not processed by the renderer. This is
225 // overridden by RenderView to send upwards to its delegate. 227 // overridden by RenderView to send upwards to its delegate.
226 virtual void UnhandledKeyboardEvent(const WebKeyboardEvent& event) {} 228 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {}
227 229
228 // Notification that the user pressed the enter key or the spacebar. The 230 // Notification that the user pressed the enter key or the spacebar. The
229 // render view host overrides this to forward the information to its delegate 231 // render view host overrides this to forward the information to its delegate
230 // (see corresponding function in RenderViewHostDelegate). 232 // (see corresponding function in RenderViewHostDelegate).
231 virtual void OnEnterOrSpace() {} 233 virtual void OnEnterOrSpace() {}
232 234
233 // Callbacks for notification when the renderer becomes unresponsive to user 235 // Callbacks for notification when the renderer becomes unresponsive to user
234 // input events, and subsequently responsive again. RenderViewHost overrides 236 // input events, and subsequently responsive again. RenderViewHost overrides
235 // these to tell its delegate to show the user a warning. 237 // these to tell its delegate to show the user a warning.
236 virtual void NotifyRendererUnresponsive() {} 238 virtual void NotifyRendererUnresponsive() {}
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 scoped_ptr<PaintObserver> paint_observer_; 348 scoped_ptr<PaintObserver> paint_observer_;
347 349
348 // Set when we call DidPaintRect/DidScrollRect on the view. 350 // Set when we call DidPaintRect/DidScrollRect on the view.
349 bool view_being_painted_; 351 bool view_being_painted_;
350 352
351 // Used for UMA histogram logging to measure the time for a repaint view 353 // Used for UMA histogram logging to measure the time for a repaint view
352 // operation to finish. 354 // operation to finish.
353 base::TimeTicks repaint_start_time_; 355 base::TimeTicks repaint_start_time_;
354 356
355 // Queue of keyboard events that we need to track. 357 // Queue of keyboard events that we need to track.
356 typedef std::queue<WebKeyboardEvent> KeyQueue; 358 typedef std::queue<NativeWebKeyboardEvent> KeyQueue;
357 359
358 // A queue of keyboard events. We can't trust data from the renderer so we 360 // A queue of keyboard events. We can't trust data from the renderer so we
359 // stuff key events into a queue and pop them out on ACK, feeding our copy 361 // stuff key events into a queue and pop them out on ACK, feeding our copy
360 // back to whatever unhandled handler instead of the returned version. 362 // back to whatever unhandled handler instead of the returned version.
361 KeyQueue key_queue_; 363 KeyQueue key_queue_;
362 364
363 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); 365 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost);
364 }; 366 };
365 367
366 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ 368 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698