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

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

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 connection_tester_->RunAllTests(url); 1213 connection_tester_->RunAllTests(url);
1214 } 1214 }
1215 1215
1216 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( 1216 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery(
1217 const base::ListValue* list) { 1217 const base::ListValue* list) {
1218 // |list| should be: [<domain to query>]. 1218 // |list| should be: [<domain to query>].
1219 std::string domain; 1219 std::string domain;
1220 CHECK(list->GetString(0, &domain)); 1220 CHECK(list->GetString(0, &domain));
1221 base::DictionaryValue* result = new base::DictionaryValue(); 1221 base::DictionaryValue* result = new base::DictionaryValue();
1222 1222
1223 if (!IsStringASCII(domain)) { 1223 if (!base::IsStringASCII(domain)) {
1224 result->SetString("error", "non-ASCII domain name"); 1224 result->SetString("error", "non-ASCII domain name");
1225 } else { 1225 } else {
1226 net::TransportSecurityState* transport_security_state = 1226 net::TransportSecurityState* transport_security_state =
1227 GetMainContext()->transport_security_state(); 1227 GetMainContext()->transport_security_state();
1228 if (!transport_security_state) { 1228 if (!transport_security_state) {
1229 result->SetString("error", "no TransportSecurityState active"); 1229 result->SetString("error", "no TransportSecurityState active");
1230 } else { 1230 } else {
1231 net::TransportSecurityState::DomainState state; 1231 net::TransportSecurityState::DomainState state;
1232 const bool found = transport_security_state->GetDomainState( 1232 const bool found = transport_security_state->GetDomainState(
1233 domain, true, &state); 1233 domain, true, &state);
(...skipping 20 matching lines...) Expand all
1254 1254
1255 SendJavascriptCommand("receivedHSTSResult", result); 1255 SendJavascriptCommand("receivedHSTSResult", result);
1256 } 1256 }
1257 1257
1258 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd( 1258 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd(
1259 const base::ListValue* list) { 1259 const base::ListValue* list) {
1260 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP 1260 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP
1261 // include subdomains>, <key pins>]. 1261 // include subdomains>, <key pins>].
1262 std::string domain; 1262 std::string domain;
1263 CHECK(list->GetString(0, &domain)); 1263 CHECK(list->GetString(0, &domain));
1264 if (!IsStringASCII(domain)) { 1264 if (!base::IsStringASCII(domain)) {
1265 // Silently fail. The user will get a helpful error if they query for the 1265 // Silently fail. The user will get a helpful error if they query for the
1266 // name. 1266 // name.
1267 return; 1267 return;
1268 } 1268 }
1269 bool sts_include_subdomains; 1269 bool sts_include_subdomains;
1270 CHECK(list->GetBoolean(1, &sts_include_subdomains)); 1270 CHECK(list->GetBoolean(1, &sts_include_subdomains));
1271 bool pkp_include_subdomains; 1271 bool pkp_include_subdomains;
1272 CHECK(list->GetBoolean(2, &pkp_include_subdomains)); 1272 CHECK(list->GetBoolean(2, &pkp_include_subdomains));
1273 std::string hashes_str; 1273 std::string hashes_str;
1274 CHECK(list->GetString(3, &hashes_str)); 1274 CHECK(list->GetString(3, &hashes_str));
(...skipping 13 matching lines...) Expand all
1288 transport_security_state->AddHSTS(domain, expiry, sts_include_subdomains); 1288 transport_security_state->AddHSTS(domain, expiry, sts_include_subdomains);
1289 transport_security_state->AddHPKP(domain, expiry, pkp_include_subdomains, 1289 transport_security_state->AddHPKP(domain, expiry, pkp_include_subdomains,
1290 hashes); 1290 hashes);
1291 } 1291 }
1292 1292
1293 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSDelete( 1293 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSDelete(
1294 const base::ListValue* list) { 1294 const base::ListValue* list) {
1295 // |list| should be: [<domain to query>]. 1295 // |list| should be: [<domain to query>].
1296 std::string domain; 1296 std::string domain;
1297 CHECK(list->GetString(0, &domain)); 1297 CHECK(list->GetString(0, &domain));
1298 if (!IsStringASCII(domain)) { 1298 if (!base::IsStringASCII(domain)) {
1299 // There cannot be a unicode entry in the HSTS set. 1299 // There cannot be a unicode entry in the HSTS set.
1300 return; 1300 return;
1301 } 1301 }
1302 net::TransportSecurityState* transport_security_state = 1302 net::TransportSecurityState* transport_security_state =
1303 GetMainContext()->transport_security_state(); 1303 GetMainContext()->transport_security_state();
1304 if (!transport_security_state) 1304 if (!transport_security_state)
1305 return; 1305 return;
1306 1306
1307 transport_security_state->DeleteDynamicDataForHost(domain); 1307 transport_security_state->DeleteDynamicDataForHost(domain);
1308 } 1308 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1869 }
1870 1870
1871 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1871 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1872 : WebUIController(web_ui) { 1872 : WebUIController(web_ui) {
1873 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1873 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1874 1874
1875 // Set up the chrome://net-internals/ source. 1875 // Set up the chrome://net-internals/ source.
1876 Profile* profile = Profile::FromWebUI(web_ui); 1876 Profile* profile = Profile::FromWebUI(web_ui);
1877 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1877 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1878 } 1878 }
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend_v1/api_util.cc ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698