| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 // This is called for each ContentView. | 1581 // This is called for each ContentView. |
| 1582 jlong Init(JNIEnv* env, | 1582 jlong Init(JNIEnv* env, |
| 1583 const JavaParamRef<jobject>& obj, | 1583 const JavaParamRef<jobject>& obj, |
| 1584 const JavaParamRef<jobject>& jweb_contents, | 1584 const JavaParamRef<jobject>& jweb_contents, |
| 1585 const JavaParamRef<jobject>& jview_android_delegate, | 1585 const JavaParamRef<jobject>& jview_android_delegate, |
| 1586 jlong jwindow_android, | 1586 jlong jwindow_android, |
| 1587 jfloat dipScale, | 1587 jfloat dipScale, |
| 1588 const JavaParamRef<jobject>& retained_objects_set) { | 1588 const JavaParamRef<jobject>& retained_objects_set) { |
| 1589 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 1589 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 1590 WebContents::FromJavaWebContents(jweb_contents)); | 1590 WebContents::FromJavaWebContents(jweb_contents)); |
| 1591 CHECK(web_contents) << | 1591 // A ContentViewCoreImpl should be created with a valid WebContents. |
| 1592 "A ContentViewCoreImpl should be created with a valid WebContents."; | 1592 CHECK(web_contents); |
| 1593 ui::ViewAndroid* view_android = web_contents->GetView()->GetNativeView(); | 1593 ui::ViewAndroid* view_android = web_contents->GetView()->GetNativeView(); |
| 1594 view_android->SetDelegate(jview_android_delegate); | 1594 view_android->SetDelegate(jview_android_delegate); |
| 1595 | 1595 |
| 1596 ui::WindowAndroid* window_android = | 1596 ui::WindowAndroid* window_android = |
| 1597 reinterpret_cast<ui::WindowAndroid*>(jwindow_android); | 1597 reinterpret_cast<ui::WindowAndroid*>(jwindow_android); |
| 1598 DCHECK(window_android); | 1598 DCHECK(window_android); |
| 1599 window_android->AddChild(view_android); | 1599 window_android->AddChild(view_android); |
| 1600 | 1600 |
| 1601 // TODO: pass dipScale. | 1601 // TODO: pass dipScale. |
| 1602 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1602 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1617 return ScopedJavaLocalRef<jobject>(); | 1617 return ScopedJavaLocalRef<jobject>(); |
| 1618 | 1618 |
| 1619 return view->GetJavaObject(); | 1619 return view->GetJavaObject(); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 bool RegisterContentViewCore(JNIEnv* env) { | 1622 bool RegisterContentViewCore(JNIEnv* env) { |
| 1623 return RegisterNativesImpl(env); | 1623 return RegisterNativesImpl(env); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 } // namespace content | 1626 } // namespace content |
| OLD | NEW |