OLD | NEW |
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (i != 0) | 123 if (i != 0) |
124 str += ","; | 124 str += ","; |
125 str += hashes[i].ToString(); | 125 str += hashes[i].ToString(); |
126 } | 126 } |
127 return str; | 127 return str; |
128 } | 128 } |
129 | 129 |
130 bool Base64StringToHashes(const std::string& hashes_str, | 130 bool Base64StringToHashes(const std::string& hashes_str, |
131 net::HashValueVector* hashes) { | 131 net::HashValueVector* hashes) { |
132 hashes->clear(); | 132 hashes->clear(); |
133 std::vector<std::string> vector_hash_str; | 133 std::vector<std::string> vector_hash_str = base::SplitString( |
134 base::SplitString(hashes_str, ',', &vector_hash_str); | 134 hashes_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
135 | 135 |
136 for (size_t i = 0; i != vector_hash_str.size(); ++i) { | 136 for (size_t i = 0; i != vector_hash_str.size(); ++i) { |
137 std::string hash_str; | 137 std::string hash_str; |
138 base::RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); | 138 base::RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); |
139 net::HashValue hash; | 139 net::HashValue hash; |
140 // Skip past unrecognized hash algos | 140 // Skip past unrecognized hash algos |
141 // But return false on malformatted input | 141 // But return false on malformatted input |
142 if (hash_str.empty()) | 142 if (hash_str.empty()) |
143 return false; | 143 return false; |
144 if (hash_str.compare(0, 5, "sha1/") != 0 && | 144 if (hash_str.compare(0, 5, "sha1/") != 0 && |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 } | 1196 } |
1197 | 1197 |
1198 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1198 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1199 : WebUIController(web_ui) { | 1199 : WebUIController(web_ui) { |
1200 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1200 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1201 | 1201 |
1202 // Set up the chrome://net-internals/ source. | 1202 // Set up the chrome://net-internals/ source. |
1203 Profile* profile = Profile::FromWebUI(web_ui); | 1203 Profile* profile = Profile::FromWebUI(web_ui); |
1204 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1204 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1205 } | 1205 } |
OLD | NEW |