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