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

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: Removed "is_android" guard on permission strings. Could have #defined out the function that uses th… Created 6 years, 2 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
105 void WebsiteSettingsPopupAndroid::Destroy(JNIEnv* env, jobject obj) { 106 void WebsiteSettingsPopupLegacyAndroid::Destroy(JNIEnv* env, jobject obj) {
106 delete this; 107 delete this;
107 } 108 }
108 109
109 void WebsiteSettingsPopupAndroid::ResetCertDecisions( 110 void WebsiteSettingsPopupLegacyAndroid::ResetCertDecisions(
110 JNIEnv* env, 111 JNIEnv* env,
111 jobject obj, 112 jobject obj,
112 jobject java_web_contents) { 113 jobject java_web_contents) {
113 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 114 presenter_->OnRevokeSSLErrorBypassButtonPressed();
114 } 115 }
115 116
116 void WebsiteSettingsPopupAndroid::SetIdentityInfo( 117 void WebsiteSettingsPopupLegacyAndroid::SetIdentityInfo(
117 const IdentityInfo& identity_info) { 118 const IdentityInfo& identity_info) {
118 JNIEnv* env = base::android::AttachCurrentThread(); 119 JNIEnv* env = base::android::AttachCurrentThread();
119 120
120 { 121 {
121 int icon_id = ResourceMapper::MapFromChromiumId( 122 int icon_id = ResourceMapper::MapFromChromiumId(
122 WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status)); 123 WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status));
123 124
124 // The headline and the certificate dialog link of the site's identity 125 // 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 126 // 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 127 // site's identity was verified, then the headline contains the organization
127 // name from the provided certificate. If the organization name is not 128 // name from the provided certificate. If the organization name is not
128 // available than the hostname of the site is used instead. 129 // available than the hostname of the site is used instead.
129 std::string headline; 130 std::string headline;
130 if (identity_info.cert_id) { 131 if (identity_info.cert_id) {
131 headline = identity_info.site_identity; 132 headline = identity_info.site_identity;
132 } 133 }
133 134
134 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( 135 ScopedJavaLocalRef<jstring> description =
135 env, identity_info.identity_status_description); 136 ConvertUTF8ToJavaString(env, identity_info.identity_status_description);
136 base::string16 certificate_label = 137 base::string16 certificate_label =
137 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); 138 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON);
138 Java_WebsiteSettingsPopup_addCertificateSection( 139 Java_WebsiteSettingsPopupLegacy_addCertificateSection(
139 env, 140 env,
140 popup_jobject_.obj(), 141 popup_jobject_.obj(),
141 icon_id, 142 icon_id,
142 ConvertUTF8ToJavaString(env, headline).obj(), 143 ConvertUTF8ToJavaString(env, headline).obj(),
143 description.obj(), 144 description.obj(),
144 ConvertUTF16ToJavaString(env, certificate_label).obj()); 145 ConvertUTF16ToJavaString(env, certificate_label).obj());
145 146
146 if (identity_info.show_ssl_decision_revoke_button) { 147 if (identity_info.show_ssl_decision_revoke_button) {
147 base::string16 reset_button_label = l10n_util::GetStringUTF16( 148 base::string16 reset_button_label = l10n_util::GetStringUTF16(
148 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); 149 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON);
149 Java_WebsiteSettingsPopup_addResetCertDecisionsButton( 150 Java_WebsiteSettingsPopupLegacy_addResetCertDecisionsButton(
150 env, 151 env,
151 popup_jobject_.obj(), 152 popup_jobject_.obj(),
152 ConvertUTF16ToJavaString(env, reset_button_label).obj()); 153 ConvertUTF16ToJavaString(env, reset_button_label).obj());
153 } 154 }
154 } 155 }
155 156
156 { 157 {
157 int icon_id = ResourceMapper::MapFromChromiumId( 158 int icon_id = ResourceMapper::MapFromChromiumId(
158 WebsiteSettingsUI::GetConnectionIconID( 159 WebsiteSettingsUI::GetConnectionIconID(
159 identity_info.connection_status)); 160 identity_info.connection_status));
160 161
161 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( 162 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString(
162 env, identity_info.connection_status_description); 163 env, identity_info.connection_status_description);
163 Java_WebsiteSettingsPopup_addDescriptionSection( 164 Java_WebsiteSettingsPopupLegacy_addDescriptionSection(
164 env, popup_jobject_.obj(), icon_id, NULL, description.obj()); 165 env, popup_jobject_.obj(), icon_id, NULL, description.obj());
165 } 166 }
166 167
167 Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(), 168 Java_WebsiteSettingsPopupLegacy_addMoreInfoLink(
169 env,
170 popup_jobject_.obj(),
168 ConvertUTF8ToJavaString( 171 ConvertUTF8ToJavaString(
169 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); 172 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj());
170 Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj()); 173 Java_WebsiteSettingsPopupLegacy_showDialog(env, popup_jobject_.obj());
171 } 174 }
172 175
173 void WebsiteSettingsPopupAndroid::SetCookieInfo( 176 void WebsiteSettingsPopupLegacyAndroid::SetCookieInfo(
174 const CookieInfoList& cookie_info_list) { 177 const CookieInfoList& cookie_info_list) {
175 NOTIMPLEMENTED(); 178 NOTIMPLEMENTED();
176 } 179 }
177 180
178 void WebsiteSettingsPopupAndroid::SetPermissionInfo( 181 void WebsiteSettingsPopupLegacyAndroid::SetPermissionInfo(
179 const PermissionInfoList& permission_info_list) { 182 const PermissionInfoList& permission_info_list) {
180 NOTIMPLEMENTED(); 183 NOTIMPLEMENTED();
181 } 184 }
182 185
183 void WebsiteSettingsPopupAndroid::SetSelectedTab( 186 void WebsiteSettingsPopupLegacyAndroid::SetSelectedTab(
184 WebsiteSettingsUI::TabId tab_id) { 187 WebsiteSettingsUI::TabId tab_id) {
185 // There's no tab UI on Android - only connection info is shown. 188 // There's no tab UI on Android - only connection info is shown.
186 NOTIMPLEMENTED(); 189 NOTIMPLEMENTED();
187 } 190 }
188 191
189 void WebsiteSettingsPopupAndroid::SetFirstVisit( 192 void WebsiteSettingsPopupLegacyAndroid::SetFirstVisit(
190 const base::string16& first_visit) { 193 const base::string16& first_visit) {
191 NOTIMPLEMENTED(); 194 NOTIMPLEMENTED();
192 } 195 }
193 196
194 // static 197 // static
195 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 198 bool
199 WebsiteSettingsPopupLegacyAndroid::RegisterWebsiteSettingsPopupLegacyAndroid(
196 JNIEnv* env) { 200 JNIEnv* env) {
197 return RegisterNativesImpl(env); 201 return RegisterNativesImpl(env);
198 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698