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

Side by Side Diff: chrome/browser/page_info_model.cc

Issue 3033001: Add connection details to the page info dialog. (Closed)
Patch Set: ... Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/page_info_model.h" 5 #include "chrome/browser/page_info_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/cert_store.h" 13 #include "chrome/browser/cert_store.h"
14 #include "chrome/browser/pref_service.h" 14 #include "chrome/browser/pref_service.h"
15 #include "chrome/browser/profile.h" 15 #include "chrome/browser/profile.h"
16 #include "chrome/browser/ssl/ssl_manager.h" 16 #include "chrome/browser/ssl/ssl_manager.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "net/base/cert_status_flags.h" 19 #include "net/base/cert_status_flags.h"
20 #include "net/base/ssl_connection_status_flags.h"
21 #include "net/base/ssl_cipher_suite_names.h"
20 #include "net/base/x509_certificate.h" 22 #include "net/base/x509_certificate.h"
21 23
22 namespace { 24 namespace {
23 // Returns a name that can be used to represent the issuer. It tries in this 25 // Returns a name that can be used to represent the issuer. It tries in this
24 // order CN, O and OU and returns the first non-empty one found. 26 // order CN, O and OU and returns the first non-empty one found.
25 std::string GetIssuerName(const net::X509Certificate::Principal& issuer) { 27 std::string GetIssuerName(const net::X509Certificate::Principal& issuer) {
26 if (!issuer.common_name.empty()) 28 if (!issuer.common_name.empty())
27 return issuer.common_name; 29 return issuer.common_name;
28 if (!issuer.organization_names.empty()) 30 if (!issuer.organization_names.empty())
29 return issuer.organization_names[0]; 31 return issuer.organization_names[0];
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, 128 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
127 subject_name)); 129 subject_name));
128 } else if (ssl.security_bits() < 80) { 130 } else if (ssl.security_bits() < 80) {
129 state = false; 131 state = false;
130 description.assign(l10n_util::GetStringFUTF16( 132 description.assign(l10n_util::GetStringFUTF16(
131 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, 133 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
132 subject_name)); 134 subject_name));
133 } else { 135 } else {
134 description.assign(l10n_util::GetStringFUTF16( 136 description.assign(l10n_util::GetStringFUTF16(
135 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, 137 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
136 subject_name, 138 subject_name));
137 IntToString16(ssl.security_bits())));
138 if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) { 139 if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) {
139 state = false; 140 state = false;
140 description.assign(l10n_util::GetStringFUTF16( 141 description.assign(l10n_util::GetStringFUTF16(
141 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, 142 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
142 description, 143 description,
143 l10n_util::GetStringUTF16(ssl.ran_insecure_content() ? 144 l10n_util::GetStringUTF16(ssl.ran_insecure_content() ?
144 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : 145 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR :
145 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); 146 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)));
146 } 147 }
147 } 148 }
149
150 uint16_t cipher_suite =
wtc 2010/07/16 20:07:10 Question: are we supposed to use uint16_t instead
agl 2010/07/18 17:03:49 I haven't heard so. I tend to use _t because it's
151 ((ssl.connection_status() >> net::SSL_CONNECTION_CIPHERSUITE_SHIFT) &
152 net::SSL_CONNECTION_CIPHERSUITE_MASK);
153 if (ssl.security_bits() > 0 && cipher_suite) {
154 uint8_t compression_id =
155 ((ssl.connection_status() >> net::SSL_CONNECTION_COMPRESSION_SHIFT) &
156 net::SSL_CONNECTION_COMPRESSION_MASK);
157 bool did_fallback = ssl.connection_status() &
158 net::SSL_CONNECTION_SSL3_FALLBACK;
159 bool no_renegotiation = ssl.connection_status() &
160 net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION;
161 // For now, only SSLv3 fallback will trigger a warning icon here.
162 state = !did_fallback;
163 const char *key_exchange, *cipher, *mac, *compression;
164 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, cipher_suite);
165 net::SSLCompressionToString(&compression, compression_id);
166
167 description += ASCIIToUTF16("\n\n");
wtc 2010/07/16 20:07:10 Can we add "\n\n" here? Are there some languages
agl 2010/07/18 17:03:49 I wondered about that also, but I believe that we'
168 description += l10n_util::GetStringFUTF16(
169 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS,
170 ASCIIToUTF16(cipher), ASCIIToUTF16(mac), ASCIIToUTF16(key_exchange),
171 ASCIIToUTF16(compression));
172
173 if (did_fallback) {
174 description += ASCIIToUTF16("\n\n");
175 description += l10n_util::GetStringUTF16(
176 IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE);
177 }
178 if (no_renegotiation) {
179 description += ASCIIToUTF16("\n\n");
180 description += l10n_util::GetStringUTF16(
181 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE);
182 }
183 }
184
148 sections_.push_back(SectionInfo( 185 sections_.push_back(SectionInfo(
149 state, 186 state,
150 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), 187 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
151 head_line, 188 head_line,
152 description)); 189 description));
153 190
154 // Request the number of visits. 191 // Request the number of visits.
155 HistoryService* history = profile->GetHistoryService( 192 HistoryService* history = profile->GetHistoryService(
156 Profile::EXPLICIT_ACCESS); 193 Profile::EXPLICIT_ACCESS);
157 if (show_history && history) { 194 if (show_history && history) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, 242 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
206 WideToUTF16(base::TimeFormatShortDate(first_visit))))); 243 WideToUTF16(base::TimeFormatShortDate(first_visit)))));
207 } 244 }
208 observer_->ModelChanged(); 245 observer_->ModelChanged();
209 } 246 }
210 247
211 // static 248 // static
212 void PageInfoModel::RegisterPrefs(PrefService* prefs) { 249 void PageInfoModel::RegisterPrefs(PrefService* prefs) {
213 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement); 250 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement);
214 } 251 }
OLDNEW
« chrome/app/generated_resources.grd ('K') | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698