| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
| 47 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
| 48 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
| 49 #include "content/public/common/menu_item.h" | 49 #include "content/public/common/menu_item.h" |
| 50 #include "content/public/common/user_agent.h" | 50 #include "content/public/common/user_agent.h" |
| 51 #include "jni/ContentViewCore_jni.h" | 51 #include "jni/ContentViewCore_jni.h" |
| 52 #include "third_party/WebKit/public/web/WebInputEvent.h" | 52 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 53 #include "ui/android/view_android.h" | 53 #include "ui/android/view_android.h" |
| 54 #include "ui/android/window_android.h" | 54 #include "ui/android/window_android.h" |
| 55 #include "ui/gfx/android/java_bitmap.h" | 55 #include "ui/gfx/android/java_bitmap.h" |
| 56 #include "ui/gfx/geometry/point_conversions.h" |
| 56 #include "ui/gfx/geometry/size_conversions.h" | 57 #include "ui/gfx/geometry/size_conversions.h" |
| 57 #include "ui/gfx/geometry/size_f.h" | 58 #include "ui/gfx/geometry/size_f.h" |
| 58 #include "ui/gfx/screen.h" | 59 #include "ui/gfx/screen.h" |
| 59 | 60 |
| 60 using base::android::AttachCurrentThread; | 61 using base::android::AttachCurrentThread; |
| 61 using base::android::ConvertJavaStringToUTF16; | 62 using base::android::ConvertJavaStringToUTF16; |
| 62 using base::android::ConvertJavaStringToUTF8; | 63 using base::android::ConvertJavaStringToUTF8; |
| 63 using base::android::ConvertUTF16ToJavaString; | 64 using base::android::ConvertUTF16ToJavaString; |
| 64 using base::android::ConvertUTF8ToJavaString; | 65 using base::android::ConvertUTF8ToJavaString; |
| 65 using base::android::ScopedJavaLocalRef; | 66 using base::android::ScopedJavaLocalRef; |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 layer->RemoveFromParent(); | 793 layer->RemoveFromParent(); |
| 793 | 794 |
| 794 if (!root_layer_->children().size()) | 795 if (!root_layer_->children().size()) |
| 795 root_layer_->SetIsDrawable(true); | 796 root_layer_->SetIsDrawable(true); |
| 796 } | 797 } |
| 797 | 798 |
| 798 void ContentViewCoreImpl::MoveRangeSelectionExtent(const gfx::PointF& extent) { | 799 void ContentViewCoreImpl::MoveRangeSelectionExtent(const gfx::PointF& extent) { |
| 799 if (!web_contents_) | 800 if (!web_contents_) |
| 800 return; | 801 return; |
| 801 | 802 |
| 802 web_contents_->MoveRangeSelectionExtent(gfx::Point(extent.x(), extent.y())); | 803 web_contents_->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent)); |
| 803 } | 804 } |
| 804 | 805 |
| 805 void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& base, | 806 void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& base, |
| 806 const gfx::PointF& extent) { | 807 const gfx::PointF& extent) { |
| 807 if (!web_contents_) | 808 if (!web_contents_) |
| 808 return; | 809 return; |
| 809 | 810 |
| 810 gfx::Point base_point = gfx::Point(base.x(), base.y()); | 811 gfx::Point base_point = gfx::ToRoundedPoint(base); |
| 811 gfx::Point extent_point = gfx::Point(extent.x(), extent.y()); | 812 gfx::Point extent_point = gfx::ToRoundedPoint(extent); |
| 812 if (base_point == extent_point) | 813 if (base_point == extent_point) |
| 813 return; | 814 return; |
| 814 | 815 |
| 815 web_contents_->SelectRange(base_point, extent_point); | 816 web_contents_->SelectRange(base_point, extent_point); |
| 816 } | 817 } |
| 817 | 818 |
| 818 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const { | 819 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const { |
| 819 return view_android_.get(); | 820 return view_android_.get(); |
| 820 } | 821 } |
| 821 | 822 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 return NULL; | 1461 return NULL; |
| 1461 | 1462 |
| 1462 return view->GetJavaObject().Release(); | 1463 return view->GetJavaObject().Release(); |
| 1463 } | 1464 } |
| 1464 | 1465 |
| 1465 bool RegisterContentViewCore(JNIEnv* env) { | 1466 bool RegisterContentViewCore(JNIEnv* env) { |
| 1466 return RegisterNativesImpl(env); | 1467 return RegisterNativesImpl(env); |
| 1467 } | 1468 } |
| 1468 | 1469 |
| 1469 } // namespace content | 1470 } // namespace content |
| OLD | NEW |