Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_browser_context.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/content_browser_client.h"
14 #include "net/url_request/url_request_job_factory.h"
15
16 namespace net {
17 class NetLog;
18 }
19
20 namespace content {
21
22 class DownloadManagerDelegate;
23 class ResourceContext;
24 class ShellDownloadManagerDelegate;
25 class ShellURLRequestContextGetter;
26
27 class ShellBrowserContext : public BrowserContext {
28  public:
29   ShellBrowserContext(bool off_the_record, net::NetLog* net_log);
30   virtual ~ShellBrowserContext();
31
32   // BrowserContext implementation.
33   virtual base::FilePath GetPath() const OVERRIDE;
34   virtual bool IsOffTheRecord() const OVERRIDE;
35   virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
36   virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
37   virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
38       int renderer_child_id) OVERRIDE;
39   virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
40   virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
41       int renderer_child_id) OVERRIDE;
42   virtual net::URLRequestContextGetter*
43       GetMediaRequestContextForStoragePartition(
44           const base::FilePath& partition_path,
45           bool in_memory) OVERRIDE;
46   virtual void RequestMidiSysExPermission(
47       int render_process_id,
48       int render_view_id,
49       int bridge_id,
50       const GURL& requesting_frame,
51       const MidiSysExPermissionCallback& callback) OVERRIDE;
52   virtual void CancelMidiSysExPermissionRequest(
53       int render_process_id,
54       int render_view_id,
55       int bridge_id,
56       const GURL& requesting_frame) OVERRIDE;
57   virtual void RequestProtectedMediaIdentifierPermission(
58       int render_process_id,
59       int render_view_id,
60       int bridge_id,
61       int group_id,
62       const GURL& requesting_frame,
63       const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE;
64   virtual void CancelProtectedMediaIdentifierPermissionRequests(
65       int group_id) OVERRIDE;
66   virtual ResourceContext* GetResourceContext() OVERRIDE;
67   virtual GeolocationPermissionContext*
68       GetGeolocationPermissionContext() OVERRIDE;
69   virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
70
71   net::URLRequestContextGetter* CreateRequestContext(
72       ProtocolHandlerMap* protocol_handlers);
73   net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
74       const base::FilePath& partition_path,
75       bool in_memory,
76       ProtocolHandlerMap* protocol_handlers);
77
78  private:
79   class ShellResourceContext;
80
81   // Performs initialization of the ShellBrowserContext while IO is still
82   // allowed on the current thread.
83   void InitWhileIOAllowed();
84
85   bool off_the_record_;
86   net::NetLog* net_log_;
87   bool ignore_certificate_errors_;
88   base::FilePath path_;
89   scoped_ptr<ShellResourceContext> resource_context_;
90   scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_;
91   scoped_refptr<ShellURLRequestContextGetter> url_request_getter_;
92
93   DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext);
94 };
95
96 }  // namespace content
97
98 #endif  // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_