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/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "content/browser/android/interstitial_page_delegate_android.h" | 17 #include "content/browser/android/interstitial_page_delegate_android.h" |
18 #include "content/browser/android/load_url_params.h" | 18 #include "content/browser/android/load_url_params.h" |
19 #include "content/browser/android/media_player_manager_impl.h" | 19 #include "content/browser/android/media_player_manager_impl.h" |
20 #include "content/browser/android/sync_input_event_filter.h" | |
21 #include "content/browser/android/touch_point.h" | 20 #include "content/browser/android/touch_point.h" |
22 #include "content/browser/renderer_host/compositor_impl_android.h" | 21 #include "content/browser/renderer_host/compositor_impl_android.h" |
23 #include "content/browser/renderer_host/java/java_bound_object.h" | 22 #include "content/browser/renderer_host/java/java_bound_object.h" |
24 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 23 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
25 #include "content/browser/renderer_host/render_view_host_impl.h" | 24 #include "content/browser/renderer_host/render_view_host_impl.h" |
26 #include "content/browser/renderer_host/render_widget_host_impl.h" | 25 #include "content/browser/renderer_host/render_widget_host_impl.h" |
27 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 26 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
28 #include "content/browser/ssl/ssl_host_state.h" | 27 #include "content/browser/ssl/ssl_host_state.h" |
29 #include "content/browser/web_contents/interstitial_page_impl.h" | 28 #include "content/browser/web_contents/interstitial_page_impl.h" |
30 #include "content/browser/web_contents/navigation_controller_impl.h" | 29 #include "content/browser/web_contents/navigation_controller_impl.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 unsigned int ContentViewCoreImpl::GetScaledContentTexture( | 532 unsigned int ContentViewCoreImpl::GetScaledContentTexture( |
534 float scale, | 533 float scale, |
535 gfx::Size* out_size) { | 534 gfx::Size* out_size) { |
536 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 535 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
537 if (!view) | 536 if (!view) |
538 return 0; | 537 return 0; |
539 | 538 |
540 return view->GetScaledContentTexture(scale, out_size); | 539 return view->GetScaledContentTexture(scale, out_size); |
541 } | 540 } |
542 | 541 |
| 542 void ContentViewCoreImpl::SetInputEventFilterCallback( |
| 543 const InputEventFilterCallback& callback) { |
| 544 input_event_filter_callback_ = callback; |
| 545 } |
| 546 |
543 void ContentViewCoreImpl::AddFrameInfoCallback( | 547 void ContentViewCoreImpl::AddFrameInfoCallback( |
544 const UpdateFrameInfoCallback& callback) { | 548 const UpdateFrameInfoCallback& callback) { |
545 update_frame_info_callbacks_.push_back(callback); | 549 update_frame_info_callbacks_.push_back(callback); |
546 } | 550 } |
547 | 551 |
548 void ContentViewCoreImpl::RemoveFrameInfoCallback( | 552 void ContentViewCoreImpl::RemoveFrameInfoCallback( |
549 const UpdateFrameInfoCallback& callback) { | 553 const UpdateFrameInfoCallback& callback) { |
550 for (size_t i = 0; i < update_frame_info_callbacks_.size(); ++i) { | 554 for (size_t i = 0; i < update_frame_info_callbacks_.size(); ++i) { |
551 if (update_frame_info_callbacks_[i].Equals(callback)) { | 555 if (update_frame_info_callbacks_[i].Equals(callback)) { |
552 update_frame_info_callbacks_.erase( | 556 update_frame_info_callbacks_.erase( |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 JNIEnv* env = AttachCurrentThread(); | 667 JNIEnv* env = AttachCurrentThread(); |
664 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 668 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
665 if (j_obj.is_null()) | 669 if (j_obj.is_null()) |
666 return 0.f; | 670 return 0.f; |
667 return Java_ContentViewCore_getOverdrawBottomHeightPix(env, j_obj.obj()) | 671 return Java_ContentViewCore_getOverdrawBottomHeightPix(env, j_obj.obj()) |
668 / GetDpiScale(); | 672 / GetDpiScale(); |
669 } | 673 } |
670 | 674 |
671 InputEventAckState ContentViewCoreImpl::FilterInputEvent( | 675 InputEventAckState ContentViewCoreImpl::FilterInputEvent( |
672 const WebKit::WebInputEvent& input_event) { | 676 const WebKit::WebInputEvent& input_event) { |
673 if (!input_event_filter_) | 677 if (!input_event_filter_callback_.is_null()) |
674 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 678 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
675 | 679 |
676 return input_event_filter_->HandleInputEvent(input_event); | 680 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 681 return input_event_filter_callback_.Run(host->GetRoutingID(), input_event); |
677 } | 682 } |
678 | 683 |
679 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { | 684 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { |
680 root_layer_->AddChild(layer); | 685 root_layer_->AddChild(layer); |
681 } | 686 } |
682 | 687 |
683 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { | 688 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { |
684 layer->RemoveFromParent(); | 689 layer->RemoveFromParent(); |
685 } | 690 } |
686 | 691 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1560 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1556 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1561 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1557 return reinterpret_cast<jint>(view); | 1562 return reinterpret_cast<jint>(view); |
1558 } | 1563 } |
1559 | 1564 |
1560 bool RegisterContentViewCore(JNIEnv* env) { | 1565 bool RegisterContentViewCore(JNIEnv* env) { |
1561 return RegisterNativesImpl(env); | 1566 return RegisterNativesImpl(env); |
1562 } | 1567 } |
1563 | 1568 |
1564 } // namespace content | 1569 } // namespace content |
OLD | NEW |