OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/frame_host/render_widget_host_view_mus.h" | |
6 | |
7 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
8 | |
9 namespace blink { | |
10 struct WebScreenInfo; | |
11 } | |
12 | |
13 namespace content { | |
14 | |
15 RenderWidgetHostViewMus::RenderWidgetHostViewMus( | |
16 RenderWidgetHostImpl* host, | |
17 base::WeakPtr<RenderWidgetHostViewBase> platform_view) | |
18 : host_(host), platform_view_(platform_view) { | |
19 host_->SetView(this); | |
20 } | |
21 | |
22 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} | |
23 | |
24 void RenderWidgetHostViewMus::Show() { | |
25 // TODO(fsamuel): Update visibility in Mus. | |
26 // There is some interstitial complexity that we'll need to figure out here. | |
27 host_->WasShown(ui::LatencyInfo()); | |
28 } | |
29 | |
30 void RenderWidgetHostViewMus::Hide() { | |
31 host_->WasHidden(); | |
32 } | |
33 | |
34 bool RenderWidgetHostViewMus::IsShowing() { | |
35 return !host_->is_hidden(); | |
36 } | |
37 | |
38 void RenderWidgetHostViewMus::SetSize(const gfx::Size& size) { | |
39 size_ = size; | |
40 host_->WasResized(); | |
41 } | |
42 | |
43 void RenderWidgetHostViewMus::SetBounds(const gfx::Rect& rect) { | |
44 SetSize(rect.size()); | |
45 } | |
46 | |
47 void RenderWidgetHostViewMus::Focus() { | |
48 // TODO(fsamuel): Request focus for the associated Mus::Window | |
49 // We need to be careful how we propagate focus as we navigate to and | |
50 // from interstitials. | |
51 } | |
52 | |
53 bool RenderWidgetHostViewMus::HasFocus() const { | |
54 return true; | |
55 } | |
56 | |
57 bool RenderWidgetHostViewMus::IsSurfaceAvailableForCopy() const { | |
58 NOTIMPLEMENTED(); | |
59 return false; | |
60 } | |
61 | |
62 gfx::Rect RenderWidgetHostViewMus::GetViewBounds() const { | |
63 return gfx::Rect(size_); | |
64 } | |
65 | |
66 gfx::Vector2dF RenderWidgetHostViewMus::GetLastScrollOffset() const { | |
67 return gfx::Vector2dF(); | |
68 } | |
69 | |
70 void RenderWidgetHostViewMus::RenderProcessGone(base::TerminationStatus status, | |
71 int error_code) { | |
72 // TODO(fsamuel): Figure out the interstitial lifetime issues here. | |
73 platform_view_->Destroy(); | |
74 } | |
75 | |
76 void RenderWidgetHostViewMus::Destroy() { | |
77 if (platform_view_) // The platform view might have been destroyed already. | |
78 platform_view_->Destroy(); | |
79 } | |
80 | |
81 gfx::Size RenderWidgetHostViewMus::GetPhysicalBackingSize() const { | |
82 return RenderWidgetHostViewBase::GetPhysicalBackingSize(); | |
83 } | |
84 | |
85 base::string16 RenderWidgetHostViewMus::GetSelectedText() const { | |
86 return platform_view_->GetSelectedText(); | |
87 } | |
88 | |
89 void RenderWidgetHostViewMus::SetTooltipText( | |
90 const base::string16& tooltip_text) { | |
91 // TOOD(fsamuel): Ask window manager for tooltip? | |
92 } | |
93 | |
94 void RenderWidgetHostViewMus::InitAsChild(gfx::NativeView parent_view) { | |
95 platform_view_->InitAsChild(parent_view); | |
96 } | |
97 | |
98 RenderWidgetHost* RenderWidgetHostViewMus::GetRenderWidgetHost() const { | |
99 return host_; | |
100 } | |
101 | |
102 void RenderWidgetHostViewMus::InitAsPopup( | |
103 RenderWidgetHostView* parent_host_view, | |
104 const gfx::Rect& bounds) { | |
105 // TODO(fsamuel): Implement popups in Mus. | |
106 } | |
107 | |
108 void RenderWidgetHostViewMus::InitAsFullscreen( | |
109 RenderWidgetHostView* reference_host_view) { | |
110 // TODO(fsamuel): Implement full screen windows in Mus. | |
111 } | |
112 | |
113 gfx::NativeView RenderWidgetHostViewMus::GetNativeView() const { | |
114 return gfx::NativeView(); | |
115 } | |
116 | |
117 gfx::NativeViewId RenderWidgetHostViewMus::GetNativeViewId() const { | |
118 return gfx::NativeViewId(); | |
119 } | |
120 | |
121 gfx::NativeViewAccessible RenderWidgetHostViewMus::GetNativeViewAccessible() { | |
122 return gfx::NativeViewAccessible(); | |
123 } | |
124 | |
125 void RenderWidgetHostViewMus::MovePluginWindows( | |
126 const std::vector<WebPluginGeometry>& moves) { | |
127 platform_view_->MovePluginWindows(moves); | |
128 } | |
129 | |
130 void RenderWidgetHostViewMus::UpdateCursor(const WebCursor& cursor) { | |
131 // TODO(fsamuel): Implement cursors in Mus. | |
132 NOTIMPLEMENTED(); | |
133 } | |
134 | |
135 void RenderWidgetHostViewMus::SetIsLoading(bool is_loading) { | |
136 platform_view_->SetIsLoading(is_loading); | |
137 } | |
138 | |
139 void RenderWidgetHostViewMus::TextInputStateChanged( | |
140 const ViewHostMsg_TextInputState_Params& params) { | |
141 // TODO(fsamuel): Implement an IME mojo app. | |
142 } | |
143 | |
144 void RenderWidgetHostViewMus::ImeCancelComposition() { | |
145 // TODO(fsamuel): Implement an IME mojo app. | |
146 } | |
147 | |
148 void RenderWidgetHostViewMus::ImeCompositionRangeChanged( | |
149 const gfx::Range& range, | |
150 const std::vector<gfx::Rect>& character_bounds) { | |
151 // TODO(fsamuel): Implement IME. | |
152 } | |
153 | |
154 void RenderWidgetHostViewMus::SelectionChanged(const base::string16& text, | |
155 size_t offset, | |
156 const gfx::Range& range) { | |
157 platform_view_->SelectionChanged(text, offset, range); | |
158 } | |
159 | |
160 void RenderWidgetHostViewMus::SelectionBoundsChanged( | |
161 const ViewHostMsg_SelectionBounds_Params& params) { | |
162 // TODO(fsamuel): Implement selection. | |
163 } | |
164 | |
165 void RenderWidgetHostViewMus::SetBackgroundColor(SkColor color) { | |
166 // TODO(fsamuel): Implement background color and opacity. | |
167 } | |
168 | |
169 void RenderWidgetHostViewMus::CopyFromCompositingSurface( | |
170 const gfx::Rect& /* src_subrect */, | |
171 const gfx::Size& /* dst_size */, | |
172 const ReadbackRequestCallback& callback, | |
173 const SkColorType /* preferred_color_type */) { | |
174 NOTREACHED(); | |
175 callback.Run(SkBitmap(), READBACK_FAILED); | |
176 } | |
177 | |
178 void RenderWidgetHostViewMus::CopyFromCompositingSurfaceToVideoFrame( | |
179 const gfx::Rect& src_subrect, | |
180 const scoped_refptr<media::VideoFrame>& target, | |
181 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | |
182 NOTIMPLEMENTED(); | |
183 callback.Run(gfx::Rect(), false); | |
184 } | |
185 | |
186 bool RenderWidgetHostViewMus::CanCopyToVideoFrame() const { | |
187 return false; | |
188 } | |
189 | |
190 bool RenderWidgetHostViewMus::HasAcceleratedSurface( | |
191 const gfx::Size& desired_size) { | |
192 return false; | |
193 } | |
194 | |
195 bool RenderWidgetHostViewMus::LockMouse() { | |
196 // TODO(fsamuel): Implement mouse lock in Mus. | |
197 return false; | |
198 } | |
199 | |
200 void RenderWidgetHostViewMus::UnlockMouse() { | |
201 // TODO(fsamuel): Implement mouse lock in Mus. | |
202 } | |
203 | |
204 void RenderWidgetHostViewMus::GetScreenInfo(blink::WebScreenInfo* results) { | |
205 // TODO(fsamuel): Populate screen info from Mus. | |
206 } | |
207 | |
208 bool RenderWidgetHostViewMus::GetScreenColorProfile( | |
209 std::vector<char>* color_profile) { | |
210 // TODO(fsamuel): Implement color profile in Mus. | |
211 return false; | |
212 } | |
213 | |
214 gfx::Rect RenderWidgetHostViewMus::GetBoundsInRootWindow() { | |
215 return GetViewBounds(); | |
216 } | |
217 | |
218 #if defined(OS_MACOSX) | |
219 void RenderWidgetHostViewMus::SetActive(bool active) { | |
220 platform_view_->SetActive(active); | |
221 } | |
222 | |
223 void RenderWidgetHostViewMus::SetWindowVisibility(bool visible) { | |
224 // TODO(fsamuel): Propagate visibility to Mus? | |
225 platform_view_->SetWindowVisibility(visible); | |
226 } | |
227 | |
228 void RenderWidgetHostViewMus::WindowFrameChanged() { | |
229 platform_view_->WindowFrameChanged(); | |
230 } | |
231 | |
232 void RenderWidgetHostViewMus::ShowDefinitionForSelection() { | |
233 // TODO(fsamuel): Implement this on Mac. | |
234 } | |
235 | |
236 bool RenderWidgetHostViewMus::SupportsSpeech() const { | |
237 // TODO(fsamuel): Implement this on mac. | |
238 return false; | |
239 } | |
240 | |
241 void RenderWidgetHostViewMus::SpeakSelection() { | |
242 // TODO(fsamuel): Implement this on Mac. | |
243 } | |
244 | |
245 bool RenderWidgetHostViewMus::IsSpeaking() const { | |
246 // TODO(fsamuel): Implement this on Mac. | |
247 return false; | |
248 } | |
249 | |
250 void RenderWidgetHostViewMus::StopSpeaking() { | |
251 // TODO(fsamuel): Implement this on Mac. | |
252 } | |
253 | |
254 bool RenderWidgetHostViewMus::PostProcessEventForPluginIme( | |
255 const NativeWebKeyboardEvent& event) { | |
256 return false; | |
257 } | |
258 | |
259 #endif // defined(OS_MACOSX) | |
260 | |
261 void RenderWidgetHostViewMus::LockCompositingSurface() { | |
262 NOTIMPLEMENTED(); | |
263 } | |
264 | |
265 void RenderWidgetHostViewMus::UnlockCompositingSurface() { | |
266 NOTIMPLEMENTED(); | |
267 } | |
268 | |
269 #if defined(OS_WIN) | |
270 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( | |
271 gfx::NativeViewAccessible accessible_parent) {} | |
272 | |
273 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() | |
274 const { | |
275 return gfx::NativeViewId(); | |
276 } | |
277 #endif | |
278 | |
279 } // namespace content | |
OLD | NEW |