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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view.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: Fix test_shell_tests. 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_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include <OpenGL/OpenGL.h> 10 #include <OpenGL/OpenGL.h>
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // fade effect, pass a NULL value for |color|. In this case, |animate| is 306 // fade effect, pass a NULL value for |color|. In this case, |animate| is
307 // ignored. 307 // ignored.
308 virtual void SetVisuallyDeemphasized(const SkColor* color, bool animate) = 0; 308 virtual void SetVisuallyDeemphasized(const SkColor* color, bool animate) = 0;
309 309
310 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0; 310 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0;
311 311
312 virtual void SetHasHorizontalScrollbar(bool has_horizontal_scrollbar) = 0; 312 virtual void SetHasHorizontalScrollbar(bool has_horizontal_scrollbar) = 0;
313 virtual void SetScrollOffsetPinning( 313 virtual void SetScrollOffsetPinning(
314 bool is_pinned_to_left, bool is_pinned_to_right) = 0; 314 bool is_pinned_to_left, bool is_pinned_to_right) = 0;
315 315
316 // Return value indicates whether the mouse is locked successfully or not.
317 virtual bool LockMouse() = 0;
318 virtual void UnlockMouse() = 0;
319
316 void set_popup_type(WebKit::WebPopupType popup_type) { 320 void set_popup_type(WebKit::WebPopupType popup_type) {
317 popup_type_ = popup_type; 321 popup_type_ = popup_type;
318 } 322 }
319 WebKit::WebPopupType popup_type() const { return popup_type_; } 323 WebKit::WebPopupType popup_type() const { return popup_type_; }
320 324
321 // Subclasses should override this method to do what is appropriate to set 325 // Subclasses should override this method to do what is appropriate to set
322 // the custom background for their platform. 326 // the custom background for their platform.
323 CONTENT_EXPORT virtual void SetBackground(const SkBitmap& background); 327 CONTENT_EXPORT virtual void SetBackground(const SkBitmap& background);
324 const SkBitmap& background() const { return background_; } 328 const SkBitmap& background() const { return background_; }
325 329
326 virtual void OnAccessibilityNotifications( 330 virtual void OnAccessibilityNotifications(
327 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { 331 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) {
328 } 332 }
329 333
330 gfx::Rect reserved_contents_rect() const { 334 gfx::Rect reserved_contents_rect() const {
331 return reserved_rect_; 335 return reserved_rect_;
332 } 336 }
333 void set_reserved_contents_rect(const gfx::Rect& reserved_rect) { 337 void set_reserved_contents_rect(const gfx::Rect& reserved_rect) {
334 reserved_rect_ = reserved_rect; 338 reserved_rect_ = reserved_rect;
335 } 339 }
336 340
341 bool mouse_locked() const { return mouse_locked_; }
342
337 protected: 343 protected:
338 // Interface class only, do not construct. 344 // Interface class only, do not construct.
339 RenderWidgetHostView() : popup_type_(WebKit::WebPopupTypeNone) {} 345 RenderWidgetHostView() : popup_type_(WebKit::WebPopupTypeNone),
brettw 2011/09/20 05:02:41 Would you mind fixing the style here and moving th
346 mouse_locked_(false) {}
340 347
341 // Whether this view is a popup and what kind of popup it is (select, 348 // Whether this view is a popup and what kind of popup it is (select,
342 // autofill...). 349 // autofill...).
343 WebKit::WebPopupType popup_type_; 350 WebKit::WebPopupType popup_type_;
344 351
345 // A custom background to paint behind the web content. This will be tiled 352 // A custom background to paint behind the web content. This will be tiled
346 // horizontally. Can be null, in which case we fall back to painting white. 353 // horizontally. Can be null, in which case we fall back to painting white.
347 SkBitmap background_; 354 SkBitmap background_;
348 355
349 // The current reserved area in view coordinates where contents should not be 356 // The current reserved area in view coordinates where contents should not be
350 // rendered to draw the resize corner, sidebar mini tabs etc. 357 // rendered to draw the resize corner, sidebar mini tabs etc.
351 gfx::Rect reserved_rect_; 358 gfx::Rect reserved_rect_;
352 359
360 // While the mouse is locked, the cursor is hidden from the user. Mouse events
361 // are still generated. However, the position they report is the last known
362 // mouse position just as mouse lock was entered; the movement they report
363 // indicates what the change in position of the mouse would be had it not been
364 // locked.
365 bool mouse_locked_;
366
353 private: 367 private:
354 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); 368 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView);
355 }; 369 };
356 370
357 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ 371 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/browser/renderer_host/render_widget_host_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698