OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SHELL_BROWSER_CONTEXT_H_ | 5 #ifndef CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ |
6 #define CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ | 6 #define CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/resource_context.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class DownloadManagerDelegate; | 18 class DownloadManagerDelegate; |
18 class ResourceContext; | 19 class ResourceContext; |
19 class ShellDownloadManagerDelegate; | 20 class ShellDownloadManagerDelegate; |
| 21 class ShellResourceContext; |
| 22 class ShellURLRequestContextGetter; |
20 | 23 |
21 class ShellBrowserContext : public BrowserContext { | 24 class ShellBrowserContext : public BrowserContext { |
22 public: | 25 public: |
23 explicit ShellBrowserContext(bool off_the_record); | 26 explicit ShellBrowserContext(bool off_the_record); |
24 virtual ~ShellBrowserContext(); | 27 virtual ~ShellBrowserContext(); |
25 | 28 |
26 // BrowserContext implementation. | 29 // BrowserContext implementation. |
27 virtual FilePath GetPath() OVERRIDE; | 30 virtual FilePath GetPath() OVERRIDE; |
28 virtual bool IsOffTheRecord() const OVERRIDE; | 31 virtual bool IsOffTheRecord() const OVERRIDE; |
29 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; | 32 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; |
30 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 33 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
31 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 34 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
32 int renderer_child_id) OVERRIDE; | 35 int renderer_child_id) OVERRIDE; |
33 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 36 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; |
34 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 37 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
35 int renderer_child_id) OVERRIDE; | 38 int renderer_child_id) OVERRIDE; |
36 virtual net::URLRequestContextGetter* | 39 virtual net::URLRequestContextGetter* |
37 GetMediaRequestContextForStoragePartition( | 40 GetMediaRequestContextForStoragePartition( |
38 const FilePath& partition_path, | 41 const FilePath& partition_path, |
39 bool in_memory) OVERRIDE; | 42 bool in_memory) OVERRIDE; |
40 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( | 43 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
41 const FilePath& partition_path, | 44 const FilePath& partition_path, |
42 bool in_memory) OVERRIDE; | 45 bool in_memory, |
| 46 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 47 blob_protocol_handler, |
| 48 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 49 file_system_protocol_handler, |
| 50 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 51 developer_protocol_handler) OVERRIDE; |
43 virtual ResourceContext* GetResourceContext() OVERRIDE; | 52 virtual ResourceContext* GetResourceContext() OVERRIDE; |
| 53 virtual net::URLRequestContextGetter* CreateRequestContext( |
| 54 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 55 blob_protocol_handler, |
| 56 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 57 file_system_protocol_handler, |
| 58 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 59 developer_protocol_handler) OVERRIDE; |
44 virtual GeolocationPermissionContext* | 60 virtual GeolocationPermissionContext* |
45 GetGeolocationPermissionContext() OVERRIDE; | 61 GetGeolocationPermissionContext() OVERRIDE; |
46 virtual SpeechRecognitionPreferences* | 62 virtual SpeechRecognitionPreferences* |
47 GetSpeechRecognitionPreferences() OVERRIDE; | 63 GetSpeechRecognitionPreferences() OVERRIDE; |
48 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 64 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
49 | 65 |
50 private: | 66 private: |
51 // Performs initialization of the ShellBrowserContext while IO is still | 67 // Performs initialization of the ShellBrowserContext while IO is still |
52 // allowed on the current thread. | 68 // allowed on the current thread. |
53 void InitWhileIOAllowed(); | 69 void InitWhileIOAllowed(); |
54 | 70 |
55 bool off_the_record_; | 71 bool off_the_record_; |
56 bool ignore_certificate_errors_; | 72 bool ignore_certificate_errors_; |
57 base::ScopedTempDir testing_path_; | 73 base::ScopedTempDir testing_path_; |
58 FilePath path_; | 74 FilePath path_; |
59 scoped_ptr<ResourceContext> resource_context_; | 75 scoped_ptr<ShellResourceContext> resource_context_; |
60 scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_; | 76 scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_; |
61 scoped_refptr<net::URLRequestContextGetter> url_request_getter_; | 77 scoped_refptr<ShellURLRequestContextGetter> url_request_getter_; |
62 | 78 |
63 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); | 79 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); |
64 }; | 80 }; |
65 | 81 |
66 } // namespace content | 82 } // namespace content |
67 | 83 |
68 #endif // CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ | 84 #endif // CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ |
OLD | NEW |