OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // the relevant calls to the platform view. | 36 // the relevant calls to the platform view. |
37 class CONTENT_EXPORT RenderWidgetHostViewGuest | 37 class CONTENT_EXPORT RenderWidgetHostViewGuest |
38 : public RenderWidgetHostViewChildFrame, | 38 : public RenderWidgetHostViewChildFrame, |
39 public ui::GestureConsumer, | 39 public ui::GestureConsumer, |
40 public ui::GestureEventHelper { | 40 public ui::GestureEventHelper { |
41 public: | 41 public: |
42 RenderWidgetHostViewGuest( | 42 RenderWidgetHostViewGuest( |
43 RenderWidgetHost* widget, | 43 RenderWidgetHost* widget, |
44 BrowserPluginGuest* guest, | 44 BrowserPluginGuest* guest, |
45 base::WeakPtr<RenderWidgetHostViewBase> platform_view); | 45 base::WeakPtr<RenderWidgetHostViewBase> platform_view); |
46 virtual ~RenderWidgetHostViewGuest(); | 46 ~RenderWidgetHostViewGuest() override; |
47 | 47 |
48 bool OnMessageReceivedFromEmbedder(const IPC::Message& message, | 48 bool OnMessageReceivedFromEmbedder(const IPC::Message& message, |
49 RenderWidgetHostImpl* embedder); | 49 RenderWidgetHostImpl* embedder); |
50 | 50 |
51 // RenderWidgetHostView implementation. | 51 // RenderWidgetHostView implementation. |
52 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 52 bool OnMessageReceived(const IPC::Message& msg) override; |
53 virtual void InitAsChild(gfx::NativeView parent_view) override; | 53 void InitAsChild(gfx::NativeView parent_view) override; |
54 virtual void SetSize(const gfx::Size& size) override; | 54 void SetSize(const gfx::Size& size) override; |
55 virtual void SetBounds(const gfx::Rect& rect) override; | 55 void SetBounds(const gfx::Rect& rect) override; |
56 virtual void Focus() override; | 56 void Focus() override; |
57 virtual bool HasFocus() const override; | 57 bool HasFocus() const override; |
58 virtual gfx::NativeView GetNativeView() const override; | 58 gfx::NativeView GetNativeView() const override; |
59 virtual gfx::NativeViewId GetNativeViewId() const override; | 59 gfx::NativeViewId GetNativeViewId() const override; |
60 virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; | 60 gfx::NativeViewAccessible GetNativeViewAccessible() override; |
61 virtual gfx::Rect GetViewBounds() const override; | 61 gfx::Rect GetViewBounds() const override; |
62 virtual void SetBackgroundOpaque(bool opaque) override; | 62 void SetBackgroundOpaque(bool opaque) override; |
63 virtual gfx::Size GetPhysicalBackingSize() const override; | 63 gfx::Size GetPhysicalBackingSize() const override; |
64 virtual base::string16 GetSelectedText() const override; | 64 base::string16 GetSelectedText() const override; |
65 | 65 |
66 // RenderWidgetHostViewBase implementation. | 66 // RenderWidgetHostViewBase implementation. |
67 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 67 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
68 const gfx::Rect& pos) override; | 68 const gfx::Rect& pos) override; |
69 virtual void InitAsFullscreen( | 69 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
70 RenderWidgetHostView* reference_host_view) override; | 70 void WasShown() override; |
71 virtual void WasShown() override; | 71 void WasHidden() override; |
72 virtual void WasHidden() override; | 72 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override; |
73 virtual void MovePluginWindows( | 73 void UpdateCursor(const WebCursor& cursor) override; |
74 const std::vector<WebPluginGeometry>& moves) override; | 74 void SetIsLoading(bool is_loading) override; |
75 virtual void UpdateCursor(const WebCursor& cursor) override; | 75 void TextInputTypeChanged(ui::TextInputType type, |
76 virtual void SetIsLoading(bool is_loading) override; | 76 ui::TextInputMode input_mode, |
77 virtual void TextInputTypeChanged(ui::TextInputType type, | 77 bool can_compose_inline) override; |
78 ui::TextInputMode input_mode, | 78 void ImeCancelComposition() override; |
79 bool can_compose_inline) override; | |
80 virtual void ImeCancelComposition() override; | |
81 #if defined(OS_MACOSX) || defined(USE_AURA) | 79 #if defined(OS_MACOSX) || defined(USE_AURA) |
82 virtual void ImeCompositionRangeChanged( | 80 void ImeCompositionRangeChanged( |
83 const gfx::Range& range, | 81 const gfx::Range& range, |
84 const std::vector<gfx::Rect>& character_bounds) override; | 82 const std::vector<gfx::Rect>& character_bounds) override; |
85 #endif | 83 #endif |
86 virtual void RenderProcessGone(base::TerminationStatus status, | 84 void RenderProcessGone(base::TerminationStatus status, |
87 int error_code) override; | 85 int error_code) override; |
88 virtual void Destroy() override; | 86 void Destroy() override; |
89 virtual void SetTooltipText(const base::string16& tooltip_text) override; | 87 void SetTooltipText(const base::string16& tooltip_text) override; |
90 virtual void SelectionChanged(const base::string16& text, | 88 void SelectionChanged(const base::string16& text, |
91 size_t offset, | 89 size_t offset, |
92 const gfx::Range& range) override; | 90 const gfx::Range& range) override; |
93 virtual void SelectionBoundsChanged( | 91 void SelectionBoundsChanged( |
94 const ViewHostMsg_SelectionBounds_Params& params) override; | 92 const ViewHostMsg_SelectionBounds_Params& params) override; |
95 virtual void CopyFromCompositingSurface( | 93 void CopyFromCompositingSurface(const gfx::Rect& src_subrect, |
96 const gfx::Rect& src_subrect, | 94 const gfx::Size& dst_size, |
97 const gfx::Size& dst_size, | 95 CopyFromCompositingSurfaceCallback& callback, |
98 CopyFromCompositingSurfaceCallback& callback, | 96 const SkColorType color_type) override; |
99 const SkColorType color_type) override; | 97 void OnSwapCompositorFrame(uint32 output_surface_id, |
100 virtual void OnSwapCompositorFrame( | 98 scoped_ptr<cc::CompositorFrame> frame) override; |
101 uint32 output_surface_id, | |
102 scoped_ptr<cc::CompositorFrame> frame) override; | |
103 #if defined(USE_AURA) | 99 #if defined(USE_AURA) |
104 virtual void ProcessAckedTouchEvent( | 100 virtual void ProcessAckedTouchEvent( |
105 const TouchEventWithLatencyInfo& touch, | 101 const TouchEventWithLatencyInfo& touch, |
106 InputEventAckState ack_result) override; | 102 InputEventAckState ack_result) override; |
107 #endif | 103 #endif |
108 virtual bool LockMouse() override; | 104 bool LockMouse() override; |
109 virtual void UnlockMouse() override; | 105 void UnlockMouse() override; |
110 virtual void GetScreenInfo(blink::WebScreenInfo* results) override; | 106 void GetScreenInfo(blink::WebScreenInfo* results) override; |
111 | 107 |
112 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
113 // RenderWidgetHostView implementation. | 109 // RenderWidgetHostView implementation. |
114 virtual void SetActive(bool active) override; | 110 void SetActive(bool active) override; |
115 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) override; | 111 void SetTakesFocusOnlyOnMouseDown(bool flag) override; |
116 virtual void SetWindowVisibility(bool visible) override; | 112 void SetWindowVisibility(bool visible) override; |
117 virtual void WindowFrameChanged() override; | 113 void WindowFrameChanged() override; |
118 virtual void ShowDefinitionForSelection() override; | 114 void ShowDefinitionForSelection() override; |
119 virtual bool SupportsSpeech() const override; | 115 bool SupportsSpeech() const override; |
120 virtual void SpeakSelection() override; | 116 void SpeakSelection() override; |
121 virtual bool IsSpeaking() const override; | 117 bool IsSpeaking() const override; |
122 virtual void StopSpeaking() override; | 118 void StopSpeaking() override; |
123 | 119 |
124 // RenderWidgetHostViewBase implementation. | 120 // RenderWidgetHostViewBase implementation. |
125 virtual bool PostProcessEventForPluginIme( | 121 bool PostProcessEventForPluginIme( |
126 const NativeWebKeyboardEvent& event) override; | 122 const NativeWebKeyboardEvent& event) override; |
127 #endif // defined(OS_MACOSX) | 123 #endif // defined(OS_MACOSX) |
128 | 124 |
129 #if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) | 125 #if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) |
130 // RenderWidgetHostViewBase implementation. | 126 // RenderWidgetHostViewBase implementation. |
131 virtual void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, | 127 virtual void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, |
132 const SkBitmap& zoomed_bitmap) override; | 128 const SkBitmap& zoomed_bitmap) override; |
133 #endif // defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) | 129 #endif // defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) |
134 | 130 |
135 #if defined(OS_ANDROID) | 131 #if defined(OS_ANDROID) |
136 virtual void LockCompositingSurface() override; | 132 virtual void LockCompositingSurface() override; |
137 virtual void UnlockCompositingSurface() override; | 133 virtual void UnlockCompositingSurface() override; |
138 #endif // defined(OS_ANDROID) | 134 #endif // defined(OS_ANDROID) |
139 | 135 |
140 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
141 virtual void SetParentNativeViewAccessible( | 137 virtual void SetParentNativeViewAccessible( |
142 gfx::NativeViewAccessible accessible_parent) override; | 138 gfx::NativeViewAccessible accessible_parent) override; |
143 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override; | 139 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override; |
144 #endif | 140 #endif |
145 | 141 |
146 // Overridden from ui::GestureEventHelper. | 142 // Overridden from ui::GestureEventHelper. |
147 virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; | 143 bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; |
148 virtual void DispatchGestureEvent(ui::GestureEvent* event) override; | 144 void DispatchGestureEvent(ui::GestureEvent* event) override; |
149 virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) override; | 145 void DispatchCancelTouchEvent(ui::TouchEvent* event) override; |
150 | 146 |
151 virtual SkColorType PreferredReadbackFormat() override; | 147 SkColorType PreferredReadbackFormat() override; |
152 | 148 |
153 protected: | 149 protected: |
154 friend class RenderWidgetHostView; | 150 friend class RenderWidgetHostView; |
155 | 151 |
156 private: | 152 private: |
157 // Destroys this view without calling |Destroy| on |platform_view_|. | 153 // Destroys this view without calling |Destroy| on |platform_view_|. |
158 void DestroyGuestView(); | 154 void DestroyGuestView(); |
159 | 155 |
160 // Builds and forwards a WebKitGestureEvent to the renderer. | 156 // Builds and forwards a WebKitGestureEvent to the renderer. |
161 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); | 157 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); |
(...skipping 18 matching lines...) Expand all Loading... |
180 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; | 176 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; |
181 #if defined(USE_AURA) | 177 #if defined(USE_AURA) |
182 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | 178 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; |
183 #endif | 179 #endif |
184 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); | 180 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); |
185 }; | 181 }; |
186 | 182 |
187 } // namespace content | 183 } // namespace content |
188 | 184 |
189 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 185 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
OLD | NEW |