Chromium Code Reviews| Index: chrome/browser/ui/android/website_settings_popup_android.cc |
| diff --git a/chrome/browser/ui/android/website_settings_popup_android.cc b/chrome/browser/ui/android/website_settings_popup_android.cc |
| index 9c1b161d387d38c7062ba5dfecac9ecb8a852b76..64f0a57923ac5c7db3aab41b2563712b751f5774 100644 |
| --- a/chrome/browser/ui/android/website_settings_popup_android.cc |
| +++ b/chrome/browser/ui/android/website_settings_popup_android.cc |
| @@ -11,7 +11,6 @@ |
| #include "chrome/browser/infobars/infobar_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/website_settings/website_settings.h" |
| -#include "content/public/browser/android/content_view_core.h" |
| #include "content/public/browser/cert_store.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_entry.h" |
| @@ -32,11 +31,14 @@ using content::WebContents; |
| static jobjectArray GetCertificateChain(JNIEnv* env, |
| jobject obj, |
| - jobject view) { |
| - content::WebContents* contents = |
| - content::ContentViewCore::GetNativeContentViewCore(env, view)-> |
| - GetWebContents(); |
| - int cert_id = contents->GetController().GetVisibleEntry()->GetSSL().cert_id; |
| + jobject java_web_contents) { |
| + content::WebContents* web_contents = |
| + content::WebContents::FromJavaWebContents(java_web_contents); |
| + if (!web_contents) { |
|
Ted C
2014/06/11 23:32:41
personally I would drop the braces.
Yaron
2014/06/12 01:04:28
Done.
|
| + return NULL; |
| + } |
| + int cert_id = |
| + web_contents->GetController().GetVisibleEntry()->GetSSL().cert_id; |
| scoped_refptr<net::X509Certificate> cert; |
| bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert); |
| CHECK(ok); |
| @@ -64,18 +66,20 @@ static jobjectArray GetCertificateChain(JNIEnv* env, |
| } |
| // static |
| -void WebsiteSettingsPopupAndroid::Show(JNIEnv* env, |
| - jobject context, |
| - jobject java_content_view, |
| - WebContents* web_contents) { |
| - new WebsiteSettingsPopupAndroid(env, context, java_content_view, |
| - web_contents); |
| +static jlong Init(JNIEnv* env, |
| + jclass clazz, |
| + jobject obj, |
| + jobject java_web_contents) { |
| + content::WebContents* web_contents = |
| + content::WebContents::FromJavaWebContents(java_web_contents); |
|
Ted C
2014/06/11 23:32:41
this is indented 5 instead of 4
Yaron
2014/06/12 01:04:28
Done.
|
| + |
| + return reinterpret_cast<intptr_t>( |
| + new WebsiteSettingsPopupAndroid(env, obj, web_contents)); |
| } |
| WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( |
| JNIEnv* env, |
| - jobject context, |
| - jobject java_content_view, |
| + jobject java_website_settings_pop, |
| WebContents* web_contents) { |
| // Important to use GetVisibleEntry to match what's showing in the omnibox. |
| content::NavigationEntry* nav_entry = |
| @@ -83,9 +87,7 @@ WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( |
| if (nav_entry == NULL) |
| return; |
| - popup_jobject_.Reset( |
| - Java_WebsiteSettingsPopup_create(env, context, java_content_view, |
| - reinterpret_cast<intptr_t>(this))); |
| + popup_jobject_.Reset(env, java_website_settings_pop); |
| presenter_.reset(new WebsiteSettings( |
| this, |