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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 bool Base64StringToHashes(const std::string& hashes_str, | 126 bool Base64StringToHashes(const std::string& hashes_str, |
127 net::HashValueVector* hashes) { | 127 net::HashValueVector* hashes) { |
128 hashes->clear(); | 128 hashes->clear(); |
129 std::vector<std::string> vector_hash_str; | 129 std::vector<std::string> vector_hash_str; |
130 base::SplitString(hashes_str, ',', &vector_hash_str); | 130 base::SplitString(hashes_str, ',', &vector_hash_str); |
131 | 131 |
132 for (size_t i = 0; i != vector_hash_str.size(); ++i) { | 132 for (size_t i = 0; i != vector_hash_str.size(); ++i) { |
133 std::string hash_str; | 133 std::string hash_str; |
134 RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); | 134 base::RemoveChars(vector_hash_str[i], " \t\r\n", &hash_str); |
135 net::HashValue hash; | 135 net::HashValue hash; |
136 // Skip past unrecognized hash algos | 136 // Skip past unrecognized hash algos |
137 // But return false on malformatted input | 137 // But return false on malformatted input |
138 if (hash_str.empty()) | 138 if (hash_str.empty()) |
139 return false; | 139 return false; |
140 if (hash_str.compare(0, 5, "sha1/") != 0 && | 140 if (hash_str.compare(0, 5, "sha1/") != 0 && |
141 hash_str.compare(0, 7, "sha256/") != 0) { | 141 hash_str.compare(0, 7, "sha256/") != 0) { |
142 continue; | 142 continue; |
143 } | 143 } |
144 if (!hash.FromString(hash_str)) | 144 if (!hash.FromString(hash_str)) |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 } | 1879 } |
1880 | 1880 |
1881 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1881 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1882 : WebUIController(web_ui) { | 1882 : WebUIController(web_ui) { |
1883 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1883 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1884 | 1884 |
1885 // Set up the chrome://net-internals/ source. | 1885 // Set up the chrome://net-internals/ source. |
1886 Profile* profile = Profile::FromWebUI(web_ui); | 1886 Profile* profile = Profile::FromWebUI(web_ui); |
1887 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1887 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1888 } | 1888 } |
OLD | NEW |