| 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
|
|
|