OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 bool RenderWidgetHostViewAndroid::LockMouse() { | 323 bool RenderWidgetHostViewAndroid::LockMouse() { |
324 NOTIMPLEMENTED(); | 324 NOTIMPLEMENTED(); |
325 return false; | 325 return false; |
326 } | 326 } |
327 | 327 |
328 void RenderWidgetHostViewAndroid::UnlockMouse() { | 328 void RenderWidgetHostViewAndroid::UnlockMouse() { |
329 NOTIMPLEMENTED(); | 329 NOTIMPLEMENTED(); |
330 } | 330 } |
331 | 331 |
| 332 // Methods called from the host to the render |
| 333 |
| 334 void RenderWidgetHostViewAndroid::TouchEvent( |
| 335 const WebKit::WebTouchEvent& event) { |
| 336 if (host_) |
| 337 host_->ForwardTouchEvent(event); |
| 338 } |
| 339 |
| 340 void RenderWidgetHostViewAndroid::GestureEvent( |
| 341 const WebKit::WebGestureEvent& event) { |
| 342 if (host_) |
| 343 host_->ForwardGestureEvent(event); |
| 344 } |
| 345 |
332 void RenderWidgetHostViewAndroid::SetContentViewCore( | 346 void RenderWidgetHostViewAndroid::SetContentViewCore( |
333 ContentViewCoreImpl* content_view_core) { | 347 ContentViewCoreImpl* content_view_core) { |
334 content_view_core_ = content_view_core; | 348 content_view_core_ = content_view_core; |
335 if (host_) { | 349 if (host_) { |
336 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 350 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
337 host_->surface_id(), content_view_core_ ? | 351 host_->surface_id(), content_view_core_ ? |
338 GetCompositingSurface() : gfx::GLSurfaceHandle()); | 352 GetCompositingSurface() : gfx::GLSurfaceHandle()); |
339 } | 353 } |
340 } | 354 } |
341 | 355 |
| 356 void RenderWidgetHostViewAndroid::DidSetNeedTouchEvents( |
| 357 bool need_touch_events) { |
| 358 if (content_view_core_) |
| 359 content_view_core_->DidSetNeedTouchEvents(need_touch_events); |
| 360 } |
| 361 |
342 // static | 362 // static |
343 void RenderWidgetHostViewPort::GetDefaultScreenInfo( | 363 void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
344 ::WebKit::WebScreenInfo* results) { | 364 ::WebKit::WebScreenInfo* results) { |
345 DeviceInfo info; | 365 DeviceInfo info; |
346 const int width = info.GetWidth(); | 366 const int width = info.GetWidth(); |
347 const int height = info.GetHeight(); | 367 const int height = info.GetHeight(); |
348 results->horizontalDPI = 160 * info.GetDPIScale(); | 368 results->horizontalDPI = 160 * info.GetDPIScale(); |
349 results->verticalDPI = 160 * info.GetDPIScale(); | 369 results->verticalDPI = 160 * info.GetDPIScale(); |
350 results->depth = info.GetBitsPerPixel(); | 370 results->depth = info.GetBitsPerPixel(); |
351 results->depthPerComponent = info.GetBitsPerComponent(); | 371 results->depthPerComponent = info.GetBitsPerComponent(); |
352 results->isMonochrome = (results->depthPerComponent == 0); | 372 results->isMonochrome = (results->depthPerComponent == 0); |
353 results->rect = ::WebKit::WebRect(0, 0, width, height); | 373 results->rect = ::WebKit::WebRect(0, 0, width, height); |
354 // TODO(husky): Remove any system controls from availableRect. | 374 // TODO(husky): Remove any system controls from availableRect. |
355 results->availableRect = ::WebKit::WebRect(0, 0, width, height); | 375 results->availableRect = ::WebKit::WebRect(0, 0, width, height); |
356 } | 376 } |
357 | 377 |
358 //////////////////////////////////////////////////////////////////////////////// | 378 //////////////////////////////////////////////////////////////////////////////// |
359 // RenderWidgetHostView, public: | 379 // RenderWidgetHostView, public: |
360 | 380 |
361 // static | 381 // static |
362 RenderWidgetHostView* | 382 RenderWidgetHostView* |
363 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 383 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
364 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 384 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
365 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 385 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
366 } | 386 } |
367 | 387 |
368 } // namespace content | 388 } // namespace content |
OLD | NEW |