OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "chrome/browser/ssl/ssl_error_classification.h" | 7 #include "chrome/browser/ssl/ssl_error_classification.h" |
8 | 8 |
9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (parent[i] == potential_subdomain[i + diff_size]) | 309 if (parent[i] == potential_subdomain[i + diff_size]) |
310 tokens_match++; | 310 tokens_match++; |
311 } | 311 } |
312 if (tokens_match == parent.size()) | 312 if (tokens_match == parent.size()) |
313 return diff_size; | 313 return diff_size; |
314 return 0; | 314 return 0; |
315 } | 315 } |
316 | 316 |
317 SSLErrorClassification::Tokens SSLErrorClassification:: | 317 SSLErrorClassification::Tokens SSLErrorClassification:: |
318 Tokenize(const std::string& name) { | 318 Tokenize(const std::string& name) { |
319 Tokens name_tokens; | 319 return base::SplitString( |
320 base::SplitStringDontTrim(name, '.', &name_tokens); | 320 name, ".", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); |
321 return name_tokens; | |
322 } | 321 } |
323 | 322 |
324 // We accept the inverse case for www for historical reasons. | 323 // We accept the inverse case for www for historical reasons. |
325 bool SSLErrorClassification::IsWWWSubDomainMatch() const { | 324 bool SSLErrorClassification::IsWWWSubDomainMatch() const { |
326 std::string host_name = request_url_.host(); | 325 std::string host_name = request_url_.host(); |
327 if (IsHostNameKnownTLD(host_name)) { | 326 if (IsHostNameKnownTLD(host_name)) { |
328 std::vector<std::string> dns_names; | 327 std::vector<std::string> dns_names; |
329 cert_.GetDNSNames(&dns_names); | 328 cert_.GetDNSNames(&dns_names); |
330 bool result = false; | 329 bool result = false; |
331 // Need to account for all possible domains given in the SSL certificate. | 330 // Need to account for all possible domains given in the SSL certificate. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // sure we don't clear the captive protal flag, since the interstitial was | 492 // sure we don't clear the captive protal flag, since the interstitial was |
494 // potentially caused by the captive portal. | 493 // potentially caused by the captive portal. |
495 captive_portal_detected_ = captive_portal_detected_ || | 494 captive_portal_detected_ = captive_portal_detected_ || |
496 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 495 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
497 // Also keep track of non-HTTP portals and error cases. | 496 // Also keep track of non-HTTP portals and error cases. |
498 captive_portal_no_response_ = captive_portal_no_response_ || | 497 captive_portal_no_response_ = captive_portal_no_response_ || |
499 (results->result == captive_portal::RESULT_NO_RESPONSE); | 498 (results->result == captive_portal::RESULT_NO_RESPONSE); |
500 } | 499 } |
501 #endif | 500 #endif |
502 } | 501 } |
OLD | NEW |