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

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

Issue 516703002: Replaced the current WebsiteSettings dialog with a new PageInfo dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback & switched to new enum system Created 6 years, 3 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
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_legacy_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"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/website_settings/website_settings.h" 13 #include "chrome/browser/ui/website_settings/website_settings.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/cert_store.h" 16 #include "content/public/browser/cert_store.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/ssl_status.h" 20 #include "content/public/common/ssl_status.h"
21 #include "jni/WebsiteSettingsPopup_jni.h" 21 #include "jni/WebsiteSettingsPopupLegacy_jni.h"
22 #include "net/cert/x509_certificate.h" 22 #include "net/cert/x509_certificate.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 24
25 using base::android::CheckException; 25 using base::android::CheckException;
26 using base::android::ConvertUTF8ToJavaString; 26 using base::android::ConvertUTF8ToJavaString;
27 using base::android::ConvertUTF16ToJavaString; 27 using base::android::ConvertUTF16ToJavaString;
28 using base::android::GetClass; 28 using base::android::GetClass;
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;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // static 69 // static
70 static jlong Init(JNIEnv* env, 70 static jlong Init(JNIEnv* env,
71 jclass clazz, 71 jclass clazz,
72 jobject obj, 72 jobject obj,
73 jobject java_web_contents) { 73 jobject java_web_contents) {
74 content::WebContents* web_contents = 74 content::WebContents* web_contents =
75 content::WebContents::FromJavaWebContents(java_web_contents); 75 content::WebContents::FromJavaWebContents(java_web_contents);
76 76
77 return reinterpret_cast<intptr_t>( 77 return reinterpret_cast<intptr_t>(
78 new WebsiteSettingsPopupAndroid(env, obj, web_contents)); 78 new WebsiteSettingsPopupLegacyAndroid(env, obj, web_contents));
79 } 79 }
80 80
81 WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( 81 WebsiteSettingsPopupLegacyAndroid::WebsiteSettingsPopupLegacyAndroid(
82 JNIEnv* env, 82 JNIEnv* env,
83 jobject java_website_settings_pop, 83 jobject java_website_settings_pop,
84 WebContents* web_contents) { 84 WebContents* web_contents) {
85 // Important to use GetVisibleEntry to match what's showing in the omnibox. 85 // Important to use GetVisibleEntry to match what's showing in the omnibox.
86 content::NavigationEntry* nav_entry = 86 content::NavigationEntry* nav_entry =
87 web_contents->GetController().GetVisibleEntry(); 87 web_contents->GetController().GetVisibleEntry();
88 if (nav_entry == NULL) 88 if (nav_entry == NULL)
89 return; 89 return;
90 90
91 popup_jobject_.Reset(env, java_website_settings_pop); 91 popup_jobject_.Reset(env, java_website_settings_pop);
92 92
93 presenter_.reset(new WebsiteSettings( 93 presenter_.reset(new WebsiteSettings(
94 this, 94 this,
95 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 95 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
96 TabSpecificContentSettings::FromWebContents(web_contents), 96 TabSpecificContentSettings::FromWebContents(web_contents),
97 InfoBarService::FromWebContents(web_contents), 97 InfoBarService::FromWebContents(web_contents),
98 nav_entry->GetURL(), 98 nav_entry->GetURL(),
99 nav_entry->GetSSL(), 99 nav_entry->GetSSL(),
100 content::CertStore::GetInstance())); 100 content::CertStore::GetInstance()));
101 } 101 }
102 102
103 WebsiteSettingsPopupAndroid::~WebsiteSettingsPopupAndroid() {} 103 WebsiteSettingsPopupLegacyAndroid::~WebsiteSettingsPopupLegacyAndroid() {}
104 104
105 void WebsiteSettingsPopupAndroid::Destroy(JNIEnv* env, jobject obj) { 105 void WebsiteSettingsPopupLegacyAndroid::Destroy(JNIEnv* env, jobject obj) {
106 delete this; 106 delete this;
107 } 107 }
108 108
109 void WebsiteSettingsPopupAndroid::ResetCertDecisions( 109 void WebsiteSettingsPopupLegacyAndroid::ResetCertDecisions(
110 JNIEnv* env, 110 JNIEnv* env,
111 jobject obj, 111 jobject obj,
112 jobject java_web_contents) { 112 jobject java_web_contents) {
113 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 113 presenter_->OnRevokeSSLErrorBypassButtonPressed();
114 } 114 }
115 115
116 void WebsiteSettingsPopupAndroid::SetIdentityInfo( 116 void WebsiteSettingsPopupLegacyAndroid::SetIdentityInfo(
117 const IdentityInfo& identity_info) { 117 const IdentityInfo& identity_info) {
118 JNIEnv* env = base::android::AttachCurrentThread(); 118 JNIEnv* env = base::android::AttachCurrentThread();
119 119
120 { 120 {
121 int icon_id = ResourceMapper::MapFromChromiumId( 121 int icon_id = ResourceMapper::MapFromChromiumId(
122 WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status)); 122 WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status));
123 123
124 // The headline and the certificate dialog link of the site's identity 124 // The headline and the certificate dialog link of the site's identity
125 // section is only displayed if the site's identity was verified. If the 125 // section is only displayed if the site's identity was verified. If the
126 // site's identity was verified, then the headline contains the organization 126 // site's identity was verified, then the headline contains the organization
127 // name from the provided certificate. If the organization name is not 127 // name from the provided certificate. If the organization name is not
128 // available than the hostname of the site is used instead. 128 // available than the hostname of the site is used instead.
129 std::string headline; 129 std::string headline;
130 if (identity_info.cert_id) { 130 if (identity_info.cert_id) {
131 headline = identity_info.site_identity; 131 headline = identity_info.site_identity;
132 } 132 }
133 133
134 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( 134 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString(
135 env, identity_info.identity_status_description); 135 env, identity_info.identity_status_description);
136 base::string16 certificate_label = 136 base::string16 certificate_label =
137 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); 137 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON);
138 Java_WebsiteSettingsPopup_addCertificateSection( 138 Java_WebsiteSettingsPopupLegacy_addCertificateSection(
139 env, 139 env,
140 popup_jobject_.obj(), 140 popup_jobject_.obj(),
141 icon_id, 141 icon_id,
142 ConvertUTF8ToJavaString(env, headline).obj(), 142 ConvertUTF8ToJavaString(env, headline).obj(),
143 description.obj(), 143 description.obj(),
144 ConvertUTF16ToJavaString(env, certificate_label).obj()); 144 ConvertUTF16ToJavaString(env, certificate_label).obj());
145 145
146 if (identity_info.show_ssl_decision_revoke_button) { 146 if (identity_info.show_ssl_decision_revoke_button) {
147 base::string16 reset_button_label = l10n_util::GetStringUTF16( 147 base::string16 reset_button_label = l10n_util::GetStringUTF16(
148 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); 148 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON);
149 Java_WebsiteSettingsPopup_addResetCertDecisionsButton( 149 Java_WebsiteSettingsPopupLegacy_addResetCertDecisionsButton(
150 env, 150 env,
151 popup_jobject_.obj(), 151 popup_jobject_.obj(),
152 ConvertUTF16ToJavaString(env, reset_button_label).obj()); 152 ConvertUTF16ToJavaString(env, reset_button_label).obj());
153 } 153 }
154 } 154 }
155 155
156 { 156 {
157 int icon_id = ResourceMapper::MapFromChromiumId( 157 int icon_id = ResourceMapper::MapFromChromiumId(
158 WebsiteSettingsUI::GetConnectionIconID( 158 WebsiteSettingsUI::GetConnectionIconID(
159 identity_info.connection_status)); 159 identity_info.connection_status));
160 160
161 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( 161 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString(
162 env, identity_info.connection_status_description); 162 env, identity_info.connection_status_description);
163 Java_WebsiteSettingsPopup_addDescriptionSection( 163 Java_WebsiteSettingsPopupLegacy_addDescriptionSection(
164 env, popup_jobject_.obj(), icon_id, NULL, description.obj()); 164 env, popup_jobject_.obj(), icon_id, NULL, description.obj());
165 } 165 }
166 166
167 Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(), 167 Java_WebsiteSettingsPopupLegacy_addMoreInfoLink(env, popup_jobject_.obj(),
168 ConvertUTF8ToJavaString( 168 ConvertUTF8ToJavaString(
169 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); 169 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj());
170 Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj()); 170 Java_WebsiteSettingsPopupLegacy_showDialog(env, popup_jobject_.obj());
171 } 171 }
172 172
173 void WebsiteSettingsPopupAndroid::SetCookieInfo( 173 void WebsiteSettingsPopupLegacyAndroid::SetCookieInfo(
174 const CookieInfoList& cookie_info_list) { 174 const CookieInfoList& cookie_info_list) {
175 NOTIMPLEMENTED(); 175 NOTIMPLEMENTED();
176 } 176 }
177 177
178 void WebsiteSettingsPopupAndroid::SetPermissionInfo( 178 void WebsiteSettingsPopupLegacyAndroid::SetPermissionInfo(
179 const PermissionInfoList& permission_info_list) { 179 const PermissionInfoList& permission_info_list) {
180 NOTIMPLEMENTED(); 180 NOTIMPLEMENTED();
181 } 181 }
182 182
183 void WebsiteSettingsPopupAndroid::SetSelectedTab( 183 void WebsiteSettingsPopupLegacyAndroid::SetSelectedTab(
184 WebsiteSettingsUI::TabId tab_id) { 184 WebsiteSettingsUI::TabId tab_id) {
185 // There's no tab UI on Android - only connection info is shown. 185 // There's no tab UI on Android - only connection info is shown.
186 NOTIMPLEMENTED(); 186 NOTIMPLEMENTED();
187 } 187 }
188 188
189 void WebsiteSettingsPopupAndroid::SetFirstVisit( 189 void WebsiteSettingsPopupLegacyAndroid::SetFirstVisit(
190 const base::string16& first_visit) { 190 const base::string16& first_visit) {
191 NOTIMPLEMENTED(); 191 NOTIMPLEMENTED();
192 } 192 }
193 193
194 // static 194 // static
195 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 195 bool
196 WebsiteSettingsPopupLegacyAndroid::RegisterWebsiteSettingsPopupLegacyAndroid(
196 JNIEnv* env) { 197 JNIEnv* env) {
197 return RegisterNativesImpl(env); 198 return RegisterNativesImpl(env);
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698