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

Side by Side Diff: chrome/browser/ui/android/website_settings_popup_android.cc

Issue 22831005: Use visible entry for website settings dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TabSpecificContentSettings Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/ui/android/website_settings_popup_android.h" 5 #include "chrome/browser/ui/android/website_settings_popup_android.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 "chrome/browser/android/resource_mapper.h" 10 #include "chrome/browser/android/resource_mapper.h"
(...skipping 18 matching lines...) Expand all
29 using base::android::ScopedJavaLocalRef; 29 using base::android::ScopedJavaLocalRef;
30 using content::CertStore; 30 using content::CertStore;
31 using content::WebContents; 31 using content::WebContents;
32 32
33 static jobjectArray GetCertificateChain(JNIEnv* env, 33 static jobjectArray GetCertificateChain(JNIEnv* env,
34 jobject obj, 34 jobject obj,
35 jobject view) { 35 jobject view) {
36 content::WebContents* contents = 36 content::WebContents* contents =
37 content::ContentViewCore::GetNativeContentViewCore(env, view)-> 37 content::ContentViewCore::GetNativeContentViewCore(env, view)->
38 GetWebContents(); 38 GetWebContents();
39 int cert_id = contents->GetController().GetActiveEntry()->GetSSL().cert_id; 39 int cert_id = contents->GetController().GetVisibleEntry()->GetSSL().cert_id;
40 scoped_refptr<net::X509Certificate> cert; 40 scoped_refptr<net::X509Certificate> cert;
41 bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert); 41 bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert);
42 CHECK(ok); 42 CHECK(ok);
43 43
44 std::vector<std::string> cert_chain; 44 std::vector<std::string> cert_chain;
45 net::X509Certificate::OSCertHandles cert_handles = 45 net::X509Certificate::OSCertHandles cert_handles =
46 cert->GetIntermediateCertificates(); 46 cert->GetIntermediateCertificates();
47 // Make sure the peer's own cert is the first in the chain, if it's not 47 // Make sure the peer's own cert is the first in the chain, if it's not
48 // already there. 48 // already there.
49 if (cert_handles.empty() || cert_handles[0] != cert->os_cert_handle()) 49 if (cert_handles.empty() || cert_handles[0] != cert->os_cert_handle())
(...skipping 20 matching lines...) Expand all
70 WebContents* web_contents) { 70 WebContents* web_contents) {
71 new WebsiteSettingsPopupAndroid(env, context, java_content_view, 71 new WebsiteSettingsPopupAndroid(env, context, java_content_view,
72 web_contents); 72 web_contents);
73 } 73 }
74 74
75 WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( 75 WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid(
76 JNIEnv* env, 76 JNIEnv* env,
77 jobject context, 77 jobject context,
78 jobject java_content_view, 78 jobject java_content_view,
79 WebContents* web_contents) { 79 WebContents* web_contents) {
80 if (web_contents->GetController().GetActiveEntry() == NULL) 80 // Important to use GetVisibleEntry to match what's showing in the omnibox.
81 content::NavigationEntry* nav_entry =
82 web_contents->GetController().GetVisibleEntry();
83 if (nav_entry == NULL)
81 return; 84 return;
82 85
83 popup_jobject_.Reset( 86 popup_jobject_.Reset(
84 Java_WebsiteSettingsPopup_create(env, context, java_content_view, 87 Java_WebsiteSettingsPopup_create(env, context, java_content_view,
85 reinterpret_cast<jint>(this))); 88 reinterpret_cast<jint>(this)));
86 89
87 presenter_.reset(new WebsiteSettings( 90 presenter_.reset(new WebsiteSettings(
88 this, 91 this,
89 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 92 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
90 TabSpecificContentSettings::FromWebContents(web_contents), 93 TabSpecificContentSettings::FromWebContents(web_contents),
91 InfoBarService::FromWebContents(web_contents), 94 InfoBarService::FromWebContents(web_contents),
92 web_contents->GetURL(), 95 nav_entry->GetURL(),
93 web_contents->GetController().GetActiveEntry()->GetSSL(), 96 nav_entry->GetSSL(),
94 content::CertStore::GetInstance())); 97 content::CertStore::GetInstance()));
95 } 98 }
96 99
97 WebsiteSettingsPopupAndroid::~WebsiteSettingsPopupAndroid() {} 100 WebsiteSettingsPopupAndroid::~WebsiteSettingsPopupAndroid() {}
98 101
99 void WebsiteSettingsPopupAndroid::Destroy(JNIEnv* env, jobject obj) { 102 void WebsiteSettingsPopupAndroid::Destroy(JNIEnv* env, jobject obj) {
100 delete this; 103 delete this;
101 } 104 }
102 105
103 void WebsiteSettingsPopupAndroid::SetIdentityInfo( 106 void WebsiteSettingsPopupAndroid::SetIdentityInfo(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void WebsiteSettingsPopupAndroid::SetFirstVisit( 174 void WebsiteSettingsPopupAndroid::SetFirstVisit(
172 const string16& first_visit) { 175 const string16& first_visit) {
173 NOTIMPLEMENTED(); 176 NOTIMPLEMENTED();
174 } 177 }
175 178
176 // static 179 // static
177 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 180 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid(
178 JNIEnv* env) { 181 JNIEnv* env) {
179 return RegisterNativesImpl(env); 182 return RegisterNativesImpl(env);
180 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698