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.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
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"
22 class DownloadManagerDelegate
;
23 class ResourceContext
;
24 class ShellDownloadManagerDelegate
;
25 class ShellURLRequestContextGetter
;
27 class ShellBrowserContext
: public BrowserContext
{
29 ShellBrowserContext(bool off_the_record
, net::NetLog
* net_log
);
30 virtual ~ShellBrowserContext();
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
,
49 const GURL
& requesting_frame
,
50 const MIDISysExPermissionCallback
& callback
) OVERRIDE
;
51 virtual ResourceContext
* GetResourceContext() OVERRIDE
;
52 virtual GeolocationPermissionContext
*
53 GetGeolocationPermissionContext() OVERRIDE
;
54 virtual quota::SpecialStoragePolicy
* GetSpecialStoragePolicy() OVERRIDE
;
56 net::URLRequestContextGetter
* CreateRequestContext(
57 ProtocolHandlerMap
* protocol_handlers
);
58 net::URLRequestContextGetter
* CreateRequestContextForStoragePartition(
59 const base::FilePath
& partition_path
,
61 ProtocolHandlerMap
* protocol_handlers
);
64 class ShellResourceContext
;
66 // Performs initialization of the ShellBrowserContext while IO is still
67 // allowed on the current thread.
68 void InitWhileIOAllowed();
71 net::NetLog
* net_log_
;
72 bool ignore_certificate_errors_
;
74 scoped_ptr
<ShellResourceContext
> resource_context_
;
75 scoped_refptr
<ShellDownloadManagerDelegate
> download_manager_delegate_
;
76 scoped_refptr
<ShellURLRequestContextGetter
> url_request_getter_
;
78 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext
);
81 } // namespace content
83 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_