| 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/safe_browsing/protocol_manager.h" | 5 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 GURL SafeBrowsingProtocolManager::GetHashUrl() const { | 743 GURL SafeBrowsingProtocolManager::GetHashUrl() const { |
| 744 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( | 744 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( |
| 745 url_prefix_, "gethash", client_name_, version_, additional_query_); | 745 url_prefix_, "gethash", client_name_, version_, additional_query_); |
| 746 return GURL(url); | 746 return GURL(url); |
| 747 } | 747 } |
| 748 | 748 |
| 749 GURL SafeBrowsingProtocolManager::NextChunkUrl(const std::string& url) const { | 749 GURL SafeBrowsingProtocolManager::NextChunkUrl(const std::string& url) const { |
| 750 DCHECK(CalledOnValidThread()); | 750 DCHECK(CalledOnValidThread()); |
| 751 std::string next_url; | 751 std::string next_url; |
| 752 if (!base::StartsWithASCII(url, "http://", false) && | 752 if (!base::StartsWith(url, "http://", |
| 753 !base::StartsWithASCII(url, "https://", false)) { | 753 base::CompareCase::INSENSITIVE_ASCII) && |
| 754 !base::StartsWith(url, "https://", |
| 755 base::CompareCase::INSENSITIVE_ASCII)) { |
| 754 // Use https if we updated via https, otherwise http (useful for testing). | 756 // Use https if we updated via https, otherwise http (useful for testing). |
| 755 if (base::StartsWithASCII(url_prefix_, "https://", false)) | 757 if (base::StartsWith(url_prefix_, "https://", |
| 758 base::CompareCase::INSENSITIVE_ASCII)) |
| 756 next_url.append("https://"); | 759 next_url.append("https://"); |
| 757 else | 760 else |
| 758 next_url.append("http://"); | 761 next_url.append("http://"); |
| 759 next_url.append(url); | 762 next_url.append(url); |
| 760 } else { | 763 } else { |
| 761 next_url = url; | 764 next_url = url; |
| 762 } | 765 } |
| 763 if (!additional_query_.empty()) { | 766 if (!additional_query_.empty()) { |
| 764 if (next_url.find("?") != std::string::npos) { | 767 if (next_url.find("?") != std::string::npos) { |
| 765 next_url.append("&"); | 768 next_url.append("&"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 780 FullHashCallback callback, bool is_download) | 783 FullHashCallback callback, bool is_download) |
| 781 : callback(callback), | 784 : callback(callback), |
| 782 is_download(is_download) { | 785 is_download(is_download) { |
| 783 } | 786 } |
| 784 | 787 |
| 785 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() { | 788 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() { |
| 786 } | 789 } |
| 787 | 790 |
| 788 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() { | 791 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() { |
| 789 } | 792 } |
| OLD | NEW |