OLD | NEW |
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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } else { | 92 } else { |
93 // HTTP or bad HTTPS. | 93 // HTTP or bad HTTPS. |
94 description.assign(l10n_util::GetStringUTF16( | 94 description.assign(l10n_util::GetStringUTF16( |
95 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); | 95 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
96 state = false; | 96 state = false; |
97 } | 97 } |
98 sections_.push_back(SectionInfo( | 98 sections_.push_back(SectionInfo( |
99 state, | 99 state, |
100 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), | 100 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), |
101 head_line, | 101 head_line, |
102 description, | 102 description)); |
103 SECTION_INFO_IDENTITY)); | |
104 | 103 |
105 // Connection section. | 104 // Connection section. |
106 // We consider anything less than 80 bits encryption to be weak encryption. | 105 // We consider anything less than 80 bits encryption to be weak encryption. |
107 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and | 106 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and |
108 // weakly encrypted connections. | 107 // weakly encrypted connections. |
109 state = true; | 108 state = true; |
110 head_line.clear(); | 109 head_line.clear(); |
111 description.clear(); | 110 description.clear(); |
112 if (ssl.security_bits() <= 0) { | 111 if (ssl.security_bits() <= 0) { |
113 state = false; | 112 state = false; |
(...skipping 19 matching lines...) Expand all Loading... |
133 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : | 132 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : |
134 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); | 133 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); |
135 } | 134 } |
136 } | 135 } |
137 | 136 |
138 uint16 cipher_suite = | 137 uint16 cipher_suite = |
139 net::SSLConnectionStatusToCipherSuite(ssl.connection_status()); | 138 net::SSLConnectionStatusToCipherSuite(ssl.connection_status()); |
140 if (ssl.security_bits() > 0 && cipher_suite) { | 139 if (ssl.security_bits() > 0 && cipher_suite) { |
141 bool did_fallback = (ssl.connection_status() & | 140 bool did_fallback = (ssl.connection_status() & |
142 net::SSL_CONNECTION_SSL3_FALLBACK) != 0; | 141 net::SSL_CONNECTION_SSL3_FALLBACK) != 0; |
143 bool no_renegotiation = | 142 bool no_renegotiation = (ssl.connection_status() & |
144 (ssl.connection_status() & | 143 net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION) !=
0; |
145 net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION) != 0; | |
146 const char *key_exchange, *cipher, *mac; | 144 const char *key_exchange, *cipher, *mac; |
147 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, cipher_suite); | 145 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, cipher_suite); |
148 | 146 |
149 description += ASCIIToUTF16("\n\n"); | 147 description += ASCIIToUTF16("\n\n"); |
150 description += l10n_util::GetStringFUTF16( | 148 description += l10n_util::GetStringFUTF16( |
151 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS, | 149 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS, |
152 ASCIIToUTF16(cipher), ASCIIToUTF16(mac), ASCIIToUTF16(key_exchange)); | 150 ASCIIToUTF16(cipher), ASCIIToUTF16(mac), ASCIIToUTF16(key_exchange)); |
153 | 151 |
154 description += ASCIIToUTF16("\n\n"); | 152 description += ASCIIToUTF16("\n\n"); |
155 uint8 compression_id = | 153 uint8 compression_id = |
(...skipping 20 matching lines...) Expand all Loading... |
176 description += ASCIIToUTF16("\n\n"); | 174 description += ASCIIToUTF16("\n\n"); |
177 description += l10n_util::GetStringUTF16( | 175 description += l10n_util::GetStringUTF16( |
178 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); | 176 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); |
179 } | 177 } |
180 } | 178 } |
181 | 179 |
182 sections_.push_back(SectionInfo( | 180 sections_.push_back(SectionInfo( |
183 state, | 181 state, |
184 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), | 182 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), |
185 head_line, | 183 head_line, |
186 description, | 184 description)); |
187 SECTION_INFO_CONNECTION)); | |
188 | 185 |
189 // Request the number of visits. | 186 // Request the number of visits. |
190 HistoryService* history = profile->GetHistoryService( | 187 HistoryService* history = profile->GetHistoryService( |
191 Profile::EXPLICIT_ACCESS); | 188 Profile::EXPLICIT_ACCESS); |
192 if (show_history && history) { | 189 if (show_history && history) { |
193 history->GetVisitCountToHost( | 190 history->GetVisitCountToHost( |
194 url, | 191 url, |
195 &request_consumer_, | 192 &request_consumer_, |
196 NewCallback(this, &PageInfoModel::OnGotVisitCountToHost)); | 193 NewCallback(this, &PageInfoModel::OnGotVisitCountToHost)); |
197 } | 194 } |
(...skipping 24 matching lines...) Expand all Loading... |
222 visited_before_today = (first_visit_midnight < today); | 219 visited_before_today = (first_visit_midnight < today); |
223 } | 220 } |
224 | 221 |
225 if (!visited_before_today) { | 222 if (!visited_before_today) { |
226 sections_.push_back(SectionInfo( | 223 sections_.push_back(SectionInfo( |
227 false, | 224 false, |
228 l10n_util::GetStringUTF16( | 225 l10n_util::GetStringUTF16( |
229 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), | 226 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), |
230 string16(), | 227 string16(), |
231 l10n_util::GetStringUTF16( | 228 l10n_util::GetStringUTF16( |
232 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), | 229 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY))); |
233 SECTION_INFO_FIRST_VISIT)); | |
234 } else { | 230 } else { |
235 sections_.push_back(SectionInfo( | 231 sections_.push_back(SectionInfo( |
236 true, | 232 true, |
237 l10n_util::GetStringUTF16( | 233 l10n_util::GetStringUTF16( |
238 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), | 234 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), |
239 string16(), | 235 string16(), |
240 l10n_util::GetStringFUTF16( | 236 l10n_util::GetStringFUTF16( |
241 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 237 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
242 WideToUTF16(base::TimeFormatShortDate(first_visit))), | 238 WideToUTF16(base::TimeFormatShortDate(first_visit))))); |
243 SECTION_INFO_FIRST_VISIT)); | |
244 } | 239 } |
245 observer_->ModelChanged(); | 240 observer_->ModelChanged(); |
246 } | 241 } |
247 | 242 |
248 // static | 243 // static |
249 void PageInfoModel::RegisterPrefs(PrefService* prefs) { | 244 void PageInfoModel::RegisterPrefs(PrefService* prefs) { |
250 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement); | 245 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement); |
251 } | 246 } |
OLD | NEW |