OLD | NEW |
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // site's identity was verified, then the headline contains the organization | 118 // site's identity was verified, then the headline contains the organization |
119 // name from the provided certificate. If the organization name is not | 119 // name from the provided certificate. If the organization name is not |
120 // available than the hostname of the site is used instead. | 120 // available than the hostname of the site is used instead. |
121 std::string headline; | 121 std::string headline; |
122 if (identity_info.cert_id) { | 122 if (identity_info.cert_id) { |
123 headline = identity_info.site_identity; | 123 headline = identity_info.site_identity; |
124 } | 124 } |
125 | 125 |
126 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( | 126 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( |
127 env, identity_info.identity_status_description); | 127 env, identity_info.identity_status_description); |
128 Java_WebsiteSettingsPopup_addSection(env, popup_jobject_.obj(), icon_id, | |
129 ConvertUTF8ToJavaString(env, headline).obj(), description.obj()); | |
130 | |
131 base::string16 certificate_label = | 128 base::string16 certificate_label = |
132 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); | 129 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); |
133 if (!certificate_label.empty()) { | 130 Java_WebsiteSettingsPopup_addCertificateSection( |
134 Java_WebsiteSettingsPopup_setCertificateViewer(env, popup_jobject_.obj(), | 131 env, |
135 ConvertUTF16ToJavaString(env, certificate_label).obj()); | 132 popup_jobject_.obj(), |
136 } | 133 icon_id, |
137 | 134 ConvertUTF8ToJavaString(env, headline).obj(), |
138 Java_WebsiteSettingsPopup_addDivider(env, popup_jobject_.obj()); | 135 description.obj(), |
| 136 ConvertUTF16ToJavaString(env, certificate_label).obj()); |
139 } | 137 } |
140 | 138 |
141 { | 139 { |
142 int icon_id = ResourceMapper::MapFromChromiumId( | 140 int icon_id = ResourceMapper::MapFromChromiumId( |
143 WebsiteSettingsUI::GetConnectionIconID( | 141 WebsiteSettingsUI::GetConnectionIconID( |
144 identity_info.connection_status)); | 142 identity_info.connection_status)); |
145 | 143 |
146 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( | 144 ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( |
147 env, identity_info.connection_status_description); | 145 env, identity_info.connection_status_description); |
148 Java_WebsiteSettingsPopup_addSection(env, popup_jobject_.obj(), icon_id, | 146 Java_WebsiteSettingsPopup_addDescriptionSection( |
149 NULL, description.obj()); | 147 env, popup_jobject_.obj(), icon_id, NULL, description.obj()); |
150 | |
151 Java_WebsiteSettingsPopup_addDivider(env, popup_jobject_.obj()); | |
152 } | 148 } |
153 | 149 |
154 Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(), | 150 Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(), |
155 ConvertUTF8ToJavaString( | 151 ConvertUTF8ToJavaString( |
156 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); | 152 env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); |
157 Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj()); | 153 Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj()); |
158 } | 154 } |
159 | 155 |
160 void WebsiteSettingsPopupAndroid::SetCookieInfo( | 156 void WebsiteSettingsPopupAndroid::SetCookieInfo( |
161 const CookieInfoList& cookie_info_list) { | 157 const CookieInfoList& cookie_info_list) { |
(...skipping 14 matching lines...) Expand all Loading... |
176 void WebsiteSettingsPopupAndroid::SetFirstVisit( | 172 void WebsiteSettingsPopupAndroid::SetFirstVisit( |
177 const base::string16& first_visit) { | 173 const base::string16& first_visit) { |
178 NOTIMPLEMENTED(); | 174 NOTIMPLEMENTED(); |
179 } | 175 } |
180 | 176 |
181 // static | 177 // static |
182 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( | 178 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( |
183 JNIEnv* env) { | 179 JNIEnv* env) { |
184 return RegisterNativesImpl(env); | 180 return RegisterNativesImpl(env); |
185 } | 181 } |
OLD | NEW |