d7442053eb3d9a5666ebb062924d146927957a28
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / url_request_context_getter_efl.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Copyright 2014 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 _URL_REQUEST_CONTEXT_GETTER_EFL_H_
7 #define _URL_REQUEST_CONTEXT_GETTER_EFL_H_
8
9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/content_browser_client.h"
13 #include "net/base/network_delegate.h"
14 #include "net/proxy_resolution/proxy_config_service.h"
15 #include "net/url_request/url_request_context_getter.h"
16 #include "net/url_request/url_request_context_storage.h"
17 #include "net/url_request/url_request_job_factory_impl.h"
18 #include "public/ewk_cookie_manager.h"
19
20 namespace net {
21 class HostResolver;
22 class NetLog;
23 }
24
25 namespace content {
26
27 class URLRequestContextGetterEfl : public net::URLRequestContextGetter {
28  public:
29   URLRequestContextGetterEfl(
30       std::unique_ptr<net::NetworkDelegate> network_delegate =
31           std::unique_ptr<net::NetworkDelegate>(),
32       bool ignore_certificate_errors = false,
33       const base::FilePath& base_path = base::FilePath(),
34       const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner =
35           BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
36       const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner =
37           BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
38       ProtocolHandlerMap* protocol_handlers = NULL,
39       URLRequestInterceptorScopedVector request_interceptors =
40           URLRequestInterceptorScopedVector(),
41       net::NetLog* net_log = NULL);
42
43   // net::URLRequestContextGetter implementation.
44   virtual net::URLRequestContext* GetURLRequestContext() override;
45   virtual scoped_refptr<base::SingleThreadTaskRunner>
46       GetNetworkTaskRunner() const override;
47
48   net::HostResolver* host_resolver();
49
50   void SetCookieStoragePath(const base::FilePath& path,
51                             bool persist_session_cookies,
52                             Ewk_Cookie_Persistent_Storage file_storage);
53
54   base::WeakPtr<URLRequestContextGetterEfl> GetWeakPtr() {
55     return weak_ptr_factory_.GetWeakPtr();
56   }
57
58  protected:
59   virtual ~URLRequestContextGetterEfl();
60
61  private:
62   void CreateSQLitePersistentCookieStore(
63       const base::FilePath& path,
64       bool persist_session_cookies);
65   void CreatePersistentCookieStore(
66       const base::FilePath& path,
67       bool persist_session_cookies);
68
69   bool ignore_certificate_errors_;
70   base::FilePath base_path_;
71   const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner_;
72   const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner_;
73   net::NetLog* net_log_;
74
75   base::FilePath cookie_store_path_;
76   std::unique_ptr<net::CookieStore> cookie_store_;
77
78   std::unique_ptr<net::HttpNetworkSession> http_network_session_;
79   std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
80   std::unique_ptr<net::NetworkDelegate> network_delegate_;
81   std::unique_ptr<net::URLRequestContextStorage> storage_;
82   std::unique_ptr<net::URLRequestContext> url_request_context_;
83   ProtocolHandlerMap protocol_handlers_;
84   URLRequestInterceptorScopedVector request_interceptors_;
85   base::WeakPtrFactory<URLRequestContextGetterEfl> weak_ptr_factory_;
86
87   DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetterEfl);
88 };
89
90 }; // namespace content
91
92 #endif  // _URL_REQUEST_CONTEXT_GETTER_EFL_H_