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

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 826423009: Treat HSTS and HPKP state independently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi comments Created 5 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/webui/net_internals/net_internals_ui.h" 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 result->SetBoolean("has_static_pkp", 811 result->SetBoolean("has_static_pkp",
812 found_static && static_state.HasPublicKeyPins()); 812 found_static && static_state.HasPublicKeyPins());
813 result->SetBoolean("static_pkp_include_subdomains", 813 result->SetBoolean("static_pkp_include_subdomains",
814 static_state.pkp.include_subdomains); 814 static_state.pkp.include_subdomains);
815 result->SetDouble("static_pkp_observed", 815 result->SetDouble("static_pkp_observed",
816 static_state.pkp.last_observed.ToDoubleT()); 816 static_state.pkp.last_observed.ToDoubleT());
817 result->SetDouble("static_pkp_expiry", 817 result->SetDouble("static_pkp_expiry",
818 static_state.pkp.expiry.ToDoubleT()); 818 static_state.pkp.expiry.ToDoubleT());
819 result->SetString("static_spki_hashes", 819 result->SetString("static_spki_hashes",
820 HashesToBase64String(static_state.pkp.spki_hashes)); 820 HashesToBase64String(static_state.pkp.spki_hashes));
821 result->SetString("static_sts_domain", static_state.sts.domain);
822 result->SetString("static_pkp_domain", static_state.pkp.domain);
821 } 823 }
822 824
823 net::TransportSecurityState::DomainState dynamic_state; 825 net::TransportSecurityState::DomainState dynamic_state;
824 const bool found_dynamic = 826 const bool found_dynamic =
825 transport_security_state->GetDynamicDomainState(domain, 827 transport_security_state->GetDynamicDomainState(domain,
826 &dynamic_state); 828 &dynamic_state);
827 if (found_dynamic) { 829 if (found_dynamic) {
828 result->SetInteger("dynamic_upgrade_mode", 830 result->SetInteger("dynamic_upgrade_mode",
829 static_cast<int>(dynamic_state.sts.upgrade_mode)); 831 static_cast<int>(dynamic_state.sts.upgrade_mode));
830 result->SetBoolean("dynamic_sts_include_subdomains", 832 result->SetBoolean("dynamic_sts_include_subdomains",
831 dynamic_state.sts.include_subdomains); 833 dynamic_state.sts.include_subdomains);
832 result->SetBoolean("dynamic_pkp_include_subdomains", 834 result->SetBoolean("dynamic_pkp_include_subdomains",
833 dynamic_state.pkp.include_subdomains); 835 dynamic_state.pkp.include_subdomains);
834 result->SetDouble("dynamic_sts_observed", 836 result->SetDouble("dynamic_sts_observed",
835 dynamic_state.sts.last_observed.ToDoubleT()); 837 dynamic_state.sts.last_observed.ToDoubleT());
836 result->SetDouble("dynamic_pkp_observed", 838 result->SetDouble("dynamic_pkp_observed",
837 dynamic_state.pkp.last_observed.ToDoubleT()); 839 dynamic_state.pkp.last_observed.ToDoubleT());
838 result->SetDouble("dynamic_sts_expiry", 840 result->SetDouble("dynamic_sts_expiry",
839 dynamic_state.sts.expiry.ToDoubleT()); 841 dynamic_state.sts.expiry.ToDoubleT());
840 result->SetDouble("dynamic_pkp_expiry", 842 result->SetDouble("dynamic_pkp_expiry",
841 dynamic_state.pkp.expiry.ToDoubleT()); 843 dynamic_state.pkp.expiry.ToDoubleT());
842 result->SetString("dynamic_spki_hashes", 844 result->SetString("dynamic_spki_hashes",
843 HashesToBase64String(dynamic_state.pkp.spki_hashes)); 845 HashesToBase64String(dynamic_state.pkp.spki_hashes));
846 result->SetString("dynamic_sts_domain", dynamic_state.sts.domain);
847 result->SetString("dynamic_pkp_domain", dynamic_state.pkp.domain);
844 } 848 }
845 849
846 result->SetBoolean("result", found_static || found_dynamic); 850 result->SetBoolean("result", found_static || found_dynamic);
847 if (found_static) {
848 result->SetString("domain", static_state.domain);
849 } else if (found_dynamic) {
850 result->SetString("domain", dynamic_state.domain);
851 } else {
852 result->SetString("domain", domain);
853 }
854 } 851 }
855 } 852 }
856 853
857 SendJavascriptCommand("receivedHSTSResult", result); 854 SendJavascriptCommand("receivedHSTSResult", result);
858 } 855 }
859 856
860 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd( 857 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd(
861 const base::ListValue* list) { 858 const base::ListValue* list) {
862 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP 859 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP
863 // include subdomains>, <key pins>]. 860 // include subdomains>, <key pins>].
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 } 1275 }
1279 1276
1280 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1277 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1281 : WebUIController(web_ui) { 1278 : WebUIController(web_ui) {
1282 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1279 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1283 1280
1284 // Set up the chrome://net-internals/ source. 1281 // Set up the chrome://net-internals/ source.
1285 Profile* profile = Profile::FromWebUI(web_ui); 1282 Profile* profile = Profile::FromWebUI(web_ui);
1286 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1283 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1287 } 1284 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/hsts_view.js ('k') | chrome/test/data/webui/net_internals/hsts_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698