9d7d9b72ebbf62e5a68d951c19b7748d1c477691
[platform/framework/web/crosswalk-tizen.git] /
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Copyright 2016 Samsung Electronics. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef EWK_EFL_INTEGRATION_URL_REQUEST_INTERCEPTOR_EFL_H_
7 #define EWK_EFL_INTEGRATION_URL_REQUEST_INTERCEPTOR_EFL_H_
8
9 #include "net/url_request/url_request_interceptor.h"
10 #include "public/ewk_context.h"
11
12 namespace net {
13 class URLRequest;
14 class URLRequestJob;
15 class NetworkDelegate;
16 }
17
18 struct _Ewk_Intercept_Request;
19
20 namespace content {
21
22 class URLRequestInterceptorEFL : public net::URLRequestInterceptor {
23  public:
24   struct InterceptRequestCallbackWithData {
25     Ewk_Context* context;
26     Ewk_Context_Intercept_Request_Callback callback;
27     void* user_data;
28
29     void Run(_Ewk_Intercept_Request* intercept_request) const {
30       callback(context, intercept_request, user_data);
31     }
32   };
33
34   URLRequestInterceptorEFL(
35       InterceptRequestCallbackWithData intercept_request_callback_with_data);
36   ~URLRequestInterceptorEFL() override;
37
38   net::URLRequestJob* MaybeInterceptRequest(
39       net::URLRequest* request,
40       net::NetworkDelegate* network_delegate) const override;
41
42   void SetInterceptRequestCallback(
43       InterceptRequestCallbackWithData intercept_request_callback_with_data);
44
45  private:
46   InterceptRequestCallbackWithData intercept_request_callback_with_data_;
47
48   DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptorEFL);
49 };
50
51 }  // namespace content
52
53 #endif  // EWK_EFL_INTEGRATION_URL_REQUEST_INTERCEPTOR_EFL_H_