OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_ | 5 #ifndef CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_ |
6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_ | 6 #define CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | |
9 #include "base/files/file_path.h" | 8 #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" | 9 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
14 #include "net/url_request/url_request_job_factory.h" | |
15 | 11 |
16 namespace net { | 12 namespace chromecast { |
17 class NetLog; | 13 namespace shell { |
18 } | |
19 | 14 |
20 namespace content { | 15 class URLRequestContextFactory; |
21 | 16 |
22 class DownloadManagerDelegate; | 17 // Chromecast does not currently support multiple profiles. So there is a |
23 class ResourceContext; | 18 // single BrowserContext for all chromecast renderers. |
24 class ShellDownloadManagerDelegate; | 19 // There is no support for PartitionStorage. |
25 class ShellURLRequestContextGetter; | 20 class CastBrowserContext : public content::BrowserContext { |
26 | |
27 class ShellBrowserContext : public BrowserContext { | |
28 public: | 21 public: |
29 ShellBrowserContext(bool off_the_record, net::NetLog* net_log); | 22 explicit CastBrowserContext( |
30 virtual ~ShellBrowserContext(); | 23 URLRequestContextFactory* url_request_context_factory); |
| 24 virtual ~CastBrowserContext(); |
31 | 25 |
32 // BrowserContext implementation. | 26 // BrowserContext implementation. |
33 virtual base::FilePath GetPath() const OVERRIDE; | 27 virtual base::FilePath GetPath() const OVERRIDE; |
34 virtual bool IsOffTheRecord() const OVERRIDE; | 28 virtual bool IsOffTheRecord() const OVERRIDE; |
35 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; | |
36 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 29 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
37 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 30 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
38 int renderer_child_id) OVERRIDE; | 31 int renderer_child_id) OVERRIDE; |
39 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 32 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; |
40 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 33 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
41 int renderer_child_id) OVERRIDE; | 34 int renderer_child_id) OVERRIDE; |
42 virtual net::URLRequestContextGetter* | 35 virtual net::URLRequestContextGetter* |
43 GetMediaRequestContextForStoragePartition( | 36 GetMediaRequestContextForStoragePartition( |
44 const base::FilePath& partition_path, | 37 const base::FilePath& partition_path, |
45 bool in_memory) OVERRIDE; | 38 bool in_memory) OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
57 const GURL& requesting_frame) OVERRIDE; | 50 const GURL& requesting_frame) OVERRIDE; |
58 virtual void RequestProtectedMediaIdentifierPermission( | 51 virtual void RequestProtectedMediaIdentifierPermission( |
59 int render_process_id, | 52 int render_process_id, |
60 int render_view_id, | 53 int render_view_id, |
61 int bridge_id, | 54 int bridge_id, |
62 int group_id, | 55 int group_id, |
63 const GURL& requesting_frame, | 56 const GURL& requesting_frame, |
64 const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; | 57 const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; |
65 virtual void CancelProtectedMediaIdentifierPermissionRequests( | 58 virtual void CancelProtectedMediaIdentifierPermissionRequests( |
66 int group_id) OVERRIDE; | 59 int group_id) OVERRIDE; |
67 virtual ResourceContext* GetResourceContext() OVERRIDE; | 60 virtual content::ResourceContext* GetResourceContext() OVERRIDE; |
68 virtual GeolocationPermissionContext* | 61 virtual content::DownloadManagerDelegate* |
| 62 GetDownloadManagerDelegate() OVERRIDE; |
| 63 virtual content::GeolocationPermissionContext* |
69 GetGeolocationPermissionContext() OVERRIDE; | 64 GetGeolocationPermissionContext() OVERRIDE; |
70 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 65 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
71 | 66 |
72 net::URLRequestContextGetter* CreateRequestContext( | 67 private: |
73 ProtocolHandlerMap* protocol_handlers, | 68 class CastResourceContext; |
74 ProtocolHandlerScopedVector protocol_interceptors); | |
75 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | |
76 const base::FilePath& partition_path, | |
77 bool in_memory, | |
78 ProtocolHandlerMap* protocol_handlers, | |
79 ProtocolHandlerScopedVector protocol_interceptors); | |
80 | 69 |
81 private: | 70 // Performs initialization of the CastBrowserContext while IO is still |
82 class ShellResourceContext; | |
83 | |
84 // Performs initialization of the ShellBrowserContext while IO is still | |
85 // allowed on the current thread. | 71 // allowed on the current thread. |
86 void InitWhileIOAllowed(); | 72 void InitWhileIOAllowed(); |
87 | 73 |
88 bool off_the_record_; | 74 URLRequestContextFactory* const url_request_context_factory_; |
89 net::NetLog* net_log_; | |
90 bool ignore_certificate_errors_; | |
91 base::FilePath path_; | 75 base::FilePath path_; |
92 scoped_ptr<ShellResourceContext> resource_context_; | 76 scoped_ptr<CastResourceContext> resource_context_; |
93 scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_; | |
94 scoped_refptr<ShellURLRequestContextGetter> url_request_getter_; | |
95 | 77 |
96 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); | 78 DISALLOW_COPY_AND_ASSIGN(CastBrowserContext); |
97 }; | 79 }; |
98 | 80 |
99 } // namespace content | 81 } // namespace shell |
| 82 } // namespace chromecast |
100 | 83 |
101 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_ | 84 #endif // CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_ |
OLD | NEW |