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