OLD | NEW |
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 Loading... |
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(); |
340 | 346 |
341 // Whether this view is a popup and what kind of popup it is (select, | 347 // Whether this view is a popup and what kind of popup it is (select, |
342 // autofill...). | 348 // autofill...). |
343 WebKit::WebPopupType popup_type_; | 349 WebKit::WebPopupType popup_type_; |
344 | 350 |
345 // A custom background to paint behind the web content. This will be tiled | 351 // 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. | 352 // horizontally. Can be null, in which case we fall back to painting white. |
347 SkBitmap background_; | 353 SkBitmap background_; |
348 | 354 |
349 // The current reserved area in view coordinates where contents should not be | 355 // The current reserved area in view coordinates where contents should not be |
350 // rendered to draw the resize corner, sidebar mini tabs etc. | 356 // rendered to draw the resize corner, sidebar mini tabs etc. |
351 gfx::Rect reserved_rect_; | 357 gfx::Rect reserved_rect_; |
352 | 358 |
| 359 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
| 360 // are still generated. However, the position they report is the last known |
| 361 // mouse position just as mouse lock was entered; the movement they report |
| 362 // indicates what the change in position of the mouse would be had it not been |
| 363 // locked. |
| 364 bool mouse_locked_; |
| 365 |
353 private: | 366 private: |
354 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); | 367 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); |
355 }; | 368 }; |
356 | 369 |
357 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ | 370 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ |
OLD | NEW |