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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.h

Issue 7863003: Mouse lock implementation, including the renderer side and the Windows version of the browser side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <atlbase.h> 9 #include <atlbase.h>
10 #include <atlapp.h> 10 #include <atlapp.h>
11 #include <atlcrack.h> 11 #include <atlcrack.h>
12 #include <atlmisc.h> 12 #include <atlmisc.h>
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/task.h" 19 #include "base/task.h"
20 #include "base/win/scoped_comptr.h" 20 #include "base/win/scoped_comptr.h"
21 #include "content/browser/accessibility/browser_accessibility_manager.h" 21 #include "content/browser/accessibility/browser_accessibility_manager.h"
22 #include "content/browser/renderer_host/render_widget_host_view.h" 22 #include "content/browser/renderer_host/render_widget_host_view.h"
23 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
24 #include "content/common/notification_observer.h" 24 #include "content/common/notification_observer.h"
25 #include "content/common/notification_registrar.h" 25 #include "content/common/notification_registrar.h"
26 #include "ui/base/win/ime_input.h" 26 #include "ui/base/win/ime_input.h"
27 #include "ui/gfx/native_widget_types.h" 27 #include "ui/gfx/native_widget_types.h"
28 #include "ui/gfx/point.h"
28 #include "webkit/glue/webcursor.h" 29 #include "webkit/glue/webcursor.h"
29 30
30 class BackingStore; 31 class BackingStore;
31 class RenderWidgetHost; 32 class RenderWidgetHost;
32 33
33 namespace gfx { 34 namespace gfx {
34 class Size; 35 class Size;
35 class Rect; 36 class Rect;
36 } 37 }
37 38
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const WebKit::WebMouseWheelEvent& event) OVERRIDE; 174 const WebKit::WebMouseWheelEvent& event) OVERRIDE;
174 virtual void SetHasHorizontalScrollbar( 175 virtual void SetHasHorizontalScrollbar(
175 bool has_horizontal_scrollbar) OVERRIDE; 176 bool has_horizontal_scrollbar) OVERRIDE;
176 virtual void SetScrollOffsetPinning( 177 virtual void SetScrollOffsetPinning(
177 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; 178 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
178 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; 179 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
179 virtual void ShowCompositorHostWindow(bool show) OVERRIDE; 180 virtual void ShowCompositorHostWindow(bool show) OVERRIDE;
180 virtual void OnAccessibilityNotifications( 181 virtual void OnAccessibilityNotifications(
181 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params 182 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params
182 ) OVERRIDE; 183 ) OVERRIDE;
184 virtual bool LockMouse() OVERRIDE;
185 virtual void UnlockMouse() OVERRIDE;
183 186
184 // Implementation of NotificationObserver: 187 // Implementation of NotificationObserver:
185 virtual void Observe(int type, 188 virtual void Observe(int type,
186 const NotificationSource& source, 189 const NotificationSource& source,
187 const NotificationDetails& details) OVERRIDE; 190 const NotificationDetails& details) OVERRIDE;
188 191
189 // Implementation of BrowserAccessibilityDelegate: 192 // Implementation of BrowserAccessibilityDelegate:
190 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE; 193 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE;
191 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; 194 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
192 195
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void CleanupCompositorWindow(); 286 void CleanupCompositorWindow();
284 287
285 // Whether the window should be activated. 288 // Whether the window should be activated.
286 bool IsActivatable() const; 289 bool IsActivatable() const;
287 290
288 // Do initialization needed by both InitAsPopup() and InitAsFullscreen(). 291 // Do initialization needed by both InitAsPopup() and InitAsFullscreen().
289 void DoPopupOrFullscreenInit(HWND parent_hwnd, 292 void DoPopupOrFullscreenInit(HWND parent_hwnd,
290 const gfx::Rect& pos, 293 const gfx::Rect& pos,
291 DWORD ex_style); 294 DWORD ex_style);
292 295
296 CPoint GetClientCenter() const;
297 void MoveCursorToCenter() const;
298
299 void HandleLockedMouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
300
293 // The associated Model. While |this| is being Destroyed, 301 // The associated Model. While |this| is being Destroyed,
294 // |render_widget_host_| is NULL and the Windows message loop is run one last 302 // |render_widget_host_| is NULL and the Windows message loop is run one last
295 // time. Message handlers must check for a NULL |render_widget_host_|. 303 // time. Message handlers must check for a NULL |render_widget_host_|.
296 RenderWidgetHost* render_widget_host_; 304 RenderWidgetHost* render_widget_host_;
297 305
298 // When we are doing accelerated compositing 306 // When we are doing accelerated compositing
299 HWND compositor_host_window_; 307 HWND compositor_host_window_;
300 308
301 // true if the compositor host window must be hidden after the 309 // true if the compositor host window must be hidden after the
302 // software renderered view is updated. 310 // software renderered view is updated.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 386
379 // Stores the current text input type received by ImeUpdateTextInputState() 387 // Stores the current text input type received by ImeUpdateTextInputState()
380 // method. 388 // method.
381 ui::TextInputType text_input_type_; 389 ui::TextInputType text_input_type_;
382 390
383 ScopedVector<ui::ViewProp> props_; 391 ScopedVector<ui::ViewProp> props_;
384 392
385 // Is the widget fullscreen? 393 // Is the widget fullscreen?
386 bool is_fullscreen_; 394 bool is_fullscreen_;
387 395
396 // Used to record the last position of the mouse.
397 // While the mouse is locked, they store the last known position just as mouse
398 // lock was entered.
399 // Relative to the upper-left corner of the view.
400 gfx::Point last_mouse_position_;
401 // Relative to the upper-left corner of the screen.
402 gfx::Point last_global_mouse_position_;
403
404 // In the case of the mouse being moved away from the view and then moved
405 // back, we regard the mouse movement as (0, 0).
406 bool ignore_mouse_movement_;
407
388 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); 408 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
389 }; 409 };
390 410
391 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ 411 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698