Index: chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.cc |
diff --git a/chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.cc b/chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d5d323f17ac45c8d945a59cff4745f41b7cd6be |
--- /dev/null |
+++ b/chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.cc |
@@ -0,0 +1,40 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.h" |
+ |
+#include "net/http/http_response_headers.h" |
+#include "url/gurl.h" |
+ |
+namespace data_reduction_proxy_throttling_utils { |
+ |
+const char kUnsafeUrlProceedHeader[] = "X-Unsafe-Url-Proceed"; |
+ |
+bool CanCreateThrottle(bool is_incognito, |
+ bool is_data_reduction_proxy_available, |
+ const GURL& url) { |
+ if (is_incognito || !is_data_reduction_proxy_available || |
+ url.SchemeIsCryptographic()) { |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+safe_browsing::SBThreatType CheckHeaders( |
+ const net::HttpResponseHeaders* headers) { |
+ safe_browsing::SBThreatType result = safe_browsing::SB_THREAT_TYPE_SAFE; |
+ |
+ // TODO(sgurun) Check for spdy proxy origin. |
+ if (headers == NULL) |
+ return result; |
+ |
+ if (headers->HasHeader("X-Phishing-Url")) |
+ result = safe_browsing::SB_THREAT_TYPE_URL_PHISHING; |
+ else if (headers->HasHeader("X-Malware-Url")) |
+ result = safe_browsing::SB_THREAT_TYPE_URL_MALWARE; |
+ |
+ return result; |
+} |
+ |
+} // namespace data_reduction_proxy_throttling_utils |