15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "net/url_request/url_request_interceptor.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GURL;
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequest;
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestContextGetter;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestJob;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NetworkDelegate;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace android_webview {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
226d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)class AwWebResourceResponse;
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This class allows the Java-side embedder to substitute the default
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// URLRequest of a given request for an alternative job that will read data
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// from a Java stream.
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class AwRequestInterceptor : public net::URLRequestInterceptor {
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  AwRequestInterceptor();
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~AwRequestInterceptor();
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // net::URLRequestInterceptor override --------------------------------------
33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual net::URLRequestJob* MaybeInterceptRequest(
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::URLRequest* request,
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::NetworkDelegate* network_delegate) const OVERRIDE;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
386d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  scoped_ptr<AwWebResourceResponse> QueryForAwWebResourceResponse(
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const GURL& location,
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::URLRequest* request) const;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(AwRequestInterceptor);
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace android_webview
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // ANDROID_WEBVIEW_BROWSER_AW_REQUEST_INTERCEPTOR_H_
48