summaryrefslogtreecommitdiffstats
path: root/lib/render_widget_host_view_qt.h
blob: 84bcfdf8184ff398298494e990991fa82a888af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_QT_H_
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_QT_H_

#include "content/browser/renderer_host/render_widget_host_view_base.h"

class QEvent;
class QMouseEvent;
class QKeyEvent;
class RasterWindow;

class RenderWidgetHostView
    : public content::RenderWidgetHostViewBase
{
public:
    RenderWidgetHostView(content::RenderWidgetHost* widget);

    bool handleEvent(QEvent* event);

    virtual content::BackingStore *AllocBackingStore(const gfx::Size &size);
    static RenderWidgetHostView* CreateViewForWidget(content::RenderWidgetHost* widget);

    virtual void InitAsChild(gfx::NativeView parent_view);
    virtual void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&);
    virtual void InitAsFullscreen(content::RenderWidgetHostView*);
    virtual content::RenderWidgetHost* GetRenderWidgetHost() const;
    virtual void SetSize(const gfx::Size& size);
    virtual void SetBounds(const gfx::Rect& rect);
    virtual gfx::NativeView GetNativeView() const;
    virtual QWindow* GetNativeViewQt() const OVERRIDE;
    virtual gfx::NativeViewId GetNativeViewId() const;
    virtual gfx::NativeViewAccessible GetNativeViewAccessible();
    virtual void Focus();
    virtual bool HasFocus() const;
    virtual bool IsSurfaceAvailableForCopy() const;
    virtual void Show();
    virtual void Hide();
    virtual bool IsShowing();
    virtual gfx::Rect GetViewBounds() const;
    virtual void SetBackground(const SkBitmap& background);
    virtual bool LockMouse();
    virtual void UnlockMouse();
    virtual bool IsMouseLocked();
#if defined(TOOLKIT_GTK)
    virtual GdkEventButton* GetLastMouseDown();
    virtual gfx::NativeView BuildInputMethodsGtkMenu();
#endif  // defined(TOOLKIT_GTK)
    virtual void WasShown();
    virtual void WasHidden();
    virtual void MovePluginWindows(const gfx::Vector2d&, const std::vector<webkit::npapi::WebPluginGeometry>&);
    virtual void Blur();
    virtual void UpdateCursor(const WebCursor&);
    virtual void SetIsLoading(bool);
    virtual void TextInputStateChanged(const ViewHostMsg_TextInputState_Params&);
    virtual void ImeCancelComposition();
    virtual void ImeCompositionRangeChanged(const ui::Range&, const std::vector<gfx::Rect>&);
    virtual void DidUpdateBackingStore(const gfx::Rect& scroll_rect, const gfx::Vector2d& scroll_delta, const std::vector<gfx::Rect>& copy_rects);
    virtual void RenderViewGone(base::TerminationStatus, int);
    virtual void Destroy();
    virtual void SetTooltipText(const string16&);
    virtual void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params&);
    virtual void ScrollOffsetChanged();
    virtual void CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, const base::Callback<void(bool, const SkBitmap&)>& callback);
    virtual void CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(bool)>& callback);
    virtual bool CanCopyToVideoFrame() const;
    virtual void OnAcceleratedCompositingStateChange();
    virtual void AcceleratedSurfaceBuffersSwapped(const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id);
    virtual void AcceleratedSurfacePostSubBuffer(const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, int gpu_host_id);
    virtual void AcceleratedSurfaceSuspend();
    virtual void AcceleratedSurfaceRelease();
    virtual bool HasAcceleratedSurface(const gfx::Size&);
    virtual void GetScreenInfo(WebKit::WebScreenInfo* results);
    virtual gfx::Rect GetBoundsInRootWindow();
    virtual gfx::GLSurfaceHandle GetCompositingSurface();
    virtual void SetHasHorizontalScrollbar(bool);
    virtual void SetScrollOffsetPinning(bool, bool);
    virtual void OnAccessibilityNotifications(const std::vector<AccessibilityHostMsg_NotificationParams>&);

private:
    void Paint(const gfx::Rect& scroll_rect);

    bool IsPopup() const;
    void handleMouseEvent(QMouseEvent*);
    void handleKeyEvent(QKeyEvent*);

    content::RenderWidgetHostImpl *m_host;
    RasterWindow *m_view;
    gfx::Size m_requestedSize;
};

#endif