OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> |
12 | 13 |
13 #include "base/base_paths.h" | 14 #include "base/base_paths.h" |
14 #include "base/bind.h" | 15 #include "base/bind.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/location.h" | 17 #include "base/location.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
20 #include "base/process/process_info.h" | 21 #include "base/process/process_info.h" |
21 #include "base/profiler/scoped_tracker.h" | 22 #include "base/profiler/scoped_tracker.h" |
22 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
| 24 #include "base/strings/string16.h" |
23 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
25 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
26 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
27 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
28 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
29 #include "base/threading/thread_restrictions.h" | 31 #include "base/threading/thread_restrictions.h" |
30 #include "base/time/time.h" | 32 #include "base/time/time.h" |
31 #include "build/build_config.h" | 33 #include "build/build_config.h" |
32 #include "chrome/app/chrome_command_ids.h" | 34 #include "chrome/app/chrome_command_ids.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #include "content/public/common/webplugininfo.h" | 204 #include "content/public/common/webplugininfo.h" |
203 #include "extensions/browser/extension_prefs.h" | 205 #include "extensions/browser/extension_prefs.h" |
204 #include "extensions/browser/extension_registry.h" | 206 #include "extensions/browser/extension_registry.h" |
205 #include "extensions/browser/extension_system.h" | 207 #include "extensions/browser/extension_system.h" |
206 #include "extensions/common/constants.h" | 208 #include "extensions/common/constants.h" |
207 #include "extensions/common/extension.h" | 209 #include "extensions/common/extension.h" |
208 #include "extensions/common/manifest_handlers/background_info.h" | 210 #include "extensions/common/manifest_handlers/background_info.h" |
209 #include "net/base/filename_util.h" | 211 #include "net/base/filename_util.h" |
210 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 212 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
211 #include "net/cookies/cookie_monster.h" | 213 #include "net/cookies/cookie_monster.h" |
| 214 #include "net/ssl/ssl_cipher_suite_names.h" |
| 215 #include "net/ssl/ssl_connection_status_flags.h" |
212 #include "net/url_request/url_request_context.h" | 216 #include "net/url_request/url_request_context.h" |
213 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 217 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
214 #include "ui/base/l10n/l10n_util.h" | 218 #include "ui/base/l10n/l10n_util.h" |
215 #include "ui/base/window_open_disposition.h" | 219 #include "ui/base/window_open_disposition.h" |
216 #include "ui/gfx/geometry/point.h" | 220 #include "ui/gfx/geometry/point.h" |
217 #include "ui/shell_dialogs/selected_file_info.h" | 221 #include "ui/shell_dialogs/selected_file_info.h" |
218 | 222 |
219 #if defined(OS_WIN) | 223 #if defined(OS_WIN) |
220 #include <windows.h> | 224 #include <windows.h> |
221 #include <shellapi.h> | 225 #include <shellapi.h> |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 SecurityStateModel::NO_DEPRECATED_SHA1) { | 1400 SecurityStateModel::NO_DEPRECATED_SHA1) { |
1397 security_style_explanations->secure_explanations.push_back( | 1401 security_style_explanations->secure_explanations.push_back( |
1398 content::SecurityStyleExplanation( | 1402 content::SecurityStyleExplanation( |
1399 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), | 1403 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), |
1400 l10n_util::GetStringUTF8( | 1404 l10n_util::GetStringUTF8( |
1401 IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION), | 1405 IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION), |
1402 security_info.cert_id)); | 1406 security_info.cert_id)); |
1403 } | 1407 } |
1404 } | 1408 } |
1405 | 1409 |
1406 if (security_info.is_secure_protocol_and_ciphersuite) { | 1410 int ssl_version = |
| 1411 net::SSLConnectionStatusToVersion(security_info.connection_status); |
| 1412 const char* protocol; |
| 1413 net::SSLVersionToString(&protocol, ssl_version); |
| 1414 |
| 1415 const char* key_exchange; |
| 1416 const char* cipher; |
| 1417 const char* mac; |
| 1418 bool is_aead; |
| 1419 uint16_t cipher_suite = |
| 1420 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
| 1421 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
| 1422 cipher_suite); |
| 1423 |
| 1424 base::string16 protocol_name = base::ASCIIToUTF16(protocol); |
| 1425 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); |
| 1426 const base::string16 cipher_name = |
| 1427 (mac == NULL) ? base::ASCIIToUTF16(cipher) |
| 1428 : l10n_util::GetStringFUTF16(IDS_CIPHER_WITH_MAC, |
| 1429 base::ASCIIToUTF16(cipher), |
| 1430 base::ASCIIToUTF16(mac)); |
| 1431 |
| 1432 if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) { |
1407 security_style_explanations->secure_explanations.push_back( | 1433 security_style_explanations->secure_explanations.push_back( |
1408 content::SecurityStyleExplanation( | 1434 content::SecurityStyleExplanation( |
1409 l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE), | 1435 l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), |
1410 l10n_util::GetStringUTF8( | 1436 l10n_util::GetStringFUTF8(IDS_STRONG_SSL_DESCRIPTION, protocol_name, |
1411 IDS_SECURE_PROTOCOL_AND_CIPHERSUITE_DESCRIPTION))); | 1437 key_exchange_name, cipher_name))); |
| 1438 } else { |
| 1439 // We avoid trying to show TLS details when we couldn't even establish a TLS |
| 1440 // connection (e.g. for net errors). We check the cert_id to see if there |
| 1441 // was a connection. |
| 1442 if (security_info.cert_id != 0) { |
| 1443 std::vector<base::string16> description_replacements; |
| 1444 int status = security_info.obsolete_ssl_status; |
| 1445 int str_id; |
| 1446 |
| 1447 str_id = (status & net::OBSOLETE_SSL_MASK_PROTOCOL) |
| 1448 ? IDS_SSL_AN_OBSOLETE_PROTOCOL |
| 1449 : IDS_SSL_A_STRONG_PROTOCOL; |
| 1450 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); |
| 1451 description_replacements.push_back(protocol_name); |
| 1452 |
| 1453 str_id = (status & net::OBSOLETE_SSL_MASK_KEY_EXCHANGE) |
| 1454 ? IDS_SSL_AN_OBSOLETE_KEY_EXCHANGE |
| 1455 : IDS_SSL_A_STRONG_KEY_EXCHANGE; |
| 1456 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); |
| 1457 description_replacements.push_back(key_exchange_name); |
| 1458 |
| 1459 str_id = (status & net::OBSOLETE_SSL_MASK_CIPHER) |
| 1460 ? IDS_SSL_AN_OBSOLETE_CIPHER |
| 1461 : IDS_SSL_A_STRONG_CIPHER; |
| 1462 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); |
| 1463 description_replacements.push_back(cipher_name); |
| 1464 |
| 1465 security_style_explanations->info_explanations.push_back( |
| 1466 content::SecurityStyleExplanation( |
| 1467 l10n_util::GetStringUTF8(IDS_OBSOLETE_SSL_SUMMARY), |
| 1468 base::UTF16ToUTF8(l10n_util::GetStringFUTF16( |
| 1469 IDS_OBSOLETE_SSL_DESCRIPTION, description_replacements, |
| 1470 nullptr)))); |
| 1471 } |
1412 } | 1472 } |
1413 | 1473 |
1414 return security_style; | 1474 return security_style; |
1415 } | 1475 } |
1416 | 1476 |
1417 void Browser::ShowCertificateViewerInDevTools( | 1477 void Browser::ShowCertificateViewerInDevTools( |
1418 content::WebContents* web_contents, int cert_id) { | 1478 content::WebContents* web_contents, int cert_id) { |
1419 DevToolsWindow* devtools_window = | 1479 DevToolsWindow* devtools_window = |
1420 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); | 1480 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); |
1421 if (devtools_window) | 1481 if (devtools_window) |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 if (contents && !allow_js_access) { | 2805 if (contents && !allow_js_access) { |
2746 contents->web_contents()->GetController().LoadURL( | 2806 contents->web_contents()->GetController().LoadURL( |
2747 target_url, | 2807 target_url, |
2748 content::Referrer(), | 2808 content::Referrer(), |
2749 ui::PAGE_TRANSITION_LINK, | 2809 ui::PAGE_TRANSITION_LINK, |
2750 std::string()); // No extra headers. | 2810 std::string()); // No extra headers. |
2751 } | 2811 } |
2752 | 2812 |
2753 return contents != NULL; | 2813 return contents != NULL; |
2754 } | 2814 } |
OLD | NEW |