Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: chrome/browser/ui/android/website_settings_popup_android.cc

Issue 330583002: Plausible fix for crash in GetCertificateChain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/android/website_settings_popup_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1c0aabb861159c1090f0125fae56ff2fd5730b1c 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)
+ 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);
+
+ 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,
@@ -152,7 +154,7 @@ void WebsiteSettingsPopupAndroid::SetIdentityInfo(
Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(),
ConvertUTF8ToJavaString(
env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj());
- Java_WebsiteSettingsPopup_show(env, popup_jobject_.obj());
+ Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj());
}
void WebsiteSettingsPopupAndroid::SetCookieInfo(
« no previous file with comments | « chrome/browser/ui/android/website_settings_popup_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698