Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.cc

Issue 686343002: Add MaybeInterceptRedirect/Response to URLRequestInterceptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6ed8d4a4985368b092fa5ce624bb7b63a1089984
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.cc
@@ -0,0 +1,55 @@
+// Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h"
+
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_params.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
+#include "net/http/http_response_headers.h"
+#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_http_job.h"
+
+namespace data_reduction_proxy {
+
+DataReductionProxyInterceptor::DataReductionProxyInterceptor(
+ DataReductionProxyParams* params,
+ DataReductionProxyUsageStats* stats)
+ : params_(params),
+ usage_stats_(stats) {
+}
+
+DataReductionProxyInterceptor::~DataReductionProxyInterceptor() {
+}
+
+net::URLRequestJob* DataReductionProxyInterceptor::MaybeInterceptRequest(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ return NULL;
+}
+
+net::URLRequestJob* DataReductionProxyInterceptor::MaybeInterceptResponse(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ if (request->response_info().was_cached)
+ return NULL;
+ DataReductionProxyBypassType bypass_type;
+ if (!data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry(
+ params_, request, request->response_info().headers.get(), &bypass_type)) {
+ return NULL;
+ }
+ if (usage_stats_)
+ usage_stats_->SetBypassType(bypass_type);
+ return net::URLRequestHttpJob::Factory(request, network_delegate, "http");
+}
+
+net::URLRequestJob* DataReductionProxyInterceptor::MaybeInterceptRedirect(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const GURL& location) const {
+ return NULL;
+}
+
+} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698