| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/android/view_android.h" | 5 #include "ui/android/view_android.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (delegate.is_null()) | 136 if (delegate.is_null()) |
| 137 return ViewAndroid::ScopedAnchorView(); | 137 return ViewAndroid::ScopedAnchorView(); |
| 138 | 138 |
| 139 JNIEnv* env = base::android::AttachCurrentThread(); | 139 JNIEnv* env = base::android::AttachCurrentThread(); |
| 140 return ViewAndroid::ScopedAnchorView( | 140 return ViewAndroid::ScopedAnchorView( |
| 141 env, Java_ViewAndroidDelegate_acquireView(env, delegate), delegate); | 141 env, Java_ViewAndroidDelegate_acquireView(env, delegate), delegate); |
| 142 } | 142 } |
| 143 | 143 |
| 144 float ViewAndroid::GetDipScale() { | 144 float ViewAndroid::GetDipScale() { |
| 145 return display::Screen::GetScreen() | 145 return display::Screen::GetScreen() |
| 146 ->GetDisplayNearestWindow(this) | 146 ->GetDisplayNearestWindow(GetWindowAndroid()) |
| 147 .device_scale_factor(); | 147 .device_scale_factor(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ViewAndroid::SetAnchorRect(const JavaRef<jobject>& anchor, | 150 void ViewAndroid::SetAnchorRect(const JavaRef<jobject>& anchor, |
| 151 const gfx::RectF& bounds) { | 151 const gfx::RectF& bounds) { |
| 152 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); | 152 ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); |
| 153 if (delegate.is_null()) | 153 if (delegate.is_null()) |
| 154 return; | 154 return; |
| 155 | 155 |
| 156 float scale = GetDipScale(); | 156 float scale = GetDipScale(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 JNIEnv* env = base::android::AttachCurrentThread(); | 288 JNIEnv* env = base::android::AttachCurrentThread(); |
| 289 ScopedJavaLocalRef<jstring> jcontent_url = | 289 ScopedJavaLocalRef<jstring> jcontent_url = |
| 290 ConvertUTF8ToJavaString(env, content_url.spec()); | 290 ConvertUTF8ToJavaString(env, content_url.spec()); |
| 291 Java_ViewAndroidDelegate_onStartContentIntent(env, | 291 Java_ViewAndroidDelegate_onStartContentIntent(env, |
| 292 delegate, | 292 delegate, |
| 293 jcontent_url, | 293 jcontent_url, |
| 294 is_main_frame); | 294 is_main_frame); |
| 295 | 295 |
| 296 } | 296 } |
| 297 } // namespace ui | 297 } // namespace ui |
| OLD | NEW |