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 ShellURLRequestContextGetter; | |
20 | 22 |
21 class ShellBrowserContext : public BrowserContext { | 23 class ShellBrowserContext : public BrowserContext { |
22 public: | 24 public: |
23 explicit ShellBrowserContext(bool off_the_record); | 25 explicit ShellBrowserContext(bool off_the_record); |
24 virtual ~ShellBrowserContext(); | 26 virtual ~ShellBrowserContext(); |
25 | 27 |
26 // BrowserContext implementation. | 28 // BrowserContext implementation. |
27 virtual FilePath GetPath() OVERRIDE; | 29 virtual FilePath GetPath() OVERRIDE; |
28 virtual bool IsOffTheRecord() const OVERRIDE; | 30 virtual bool IsOffTheRecord() const OVERRIDE; |
29 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; | 31 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; |
30 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 32 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
31 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 33 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
32 int renderer_child_id) OVERRIDE; | 34 int renderer_child_id) OVERRIDE; |
33 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 35 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; |
34 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 36 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
35 int renderer_child_id) OVERRIDE; | 37 int renderer_child_id) OVERRIDE; |
36 virtual net::URLRequestContextGetter* | 38 virtual net::URLRequestContextGetter* |
37 GetMediaRequestContextForStoragePartition( | 39 GetMediaRequestContextForStoragePartition( |
38 const FilePath& partition_path, | 40 const FilePath& partition_path, |
39 bool in_memory) OVERRIDE; | 41 bool in_memory) OVERRIDE; |
40 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( | 42 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
41 const FilePath& partition_path, | 43 const FilePath& partition_path, |
42 bool in_memory) OVERRIDE; | 44 bool in_memory, |
45 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
46 blob_protocol_handler, | |
47 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
48 file_system_protocol_handler, | |
49 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
50 developer_protocol_handler) OVERRIDE; | |
43 virtual ResourceContext* GetResourceContext() OVERRIDE; | 51 virtual ResourceContext* GetResourceContext() OVERRIDE; |
52 virtual net::URLRequestContextGetter* CreateRequestContext( | |
53 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
54 blob_protocol_handler, | |
55 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
56 file_system_protocol_handler, | |
57 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
58 developer_protocol_handler) OVERRIDE; | |
44 virtual GeolocationPermissionContext* | 59 virtual GeolocationPermissionContext* |
45 GetGeolocationPermissionContext() OVERRIDE; | 60 GetGeolocationPermissionContext() OVERRIDE; |
46 virtual SpeechRecognitionPreferences* | 61 virtual SpeechRecognitionPreferences* |
47 GetSpeechRecognitionPreferences() OVERRIDE; | 62 GetSpeechRecognitionPreferences() OVERRIDE; |
48 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 63 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
49 | 64 |
50 private: | 65 private: |
66 class ShellResourceContext : public ResourceContext { | |
awong
2012/12/11 02:01:39
WHy did we make ShellRequestContext into a private
pauljensen
2012/12/11 02:30:35
I needed to make ShellResourceContext construction
pauljensen
2012/12/11 04:03:41
Hmm, actually ShellResourceContext doesn't need to
| |
67 public: | |
68 ShellResourceContext(); | |
69 virtual ~ShellResourceContext(); | |
70 | |
71 private: | |
72 friend class ShellBrowserContext; | |
73 | |
74 // ResourceContext implementation: | |
75 virtual net::HostResolver* GetHostResolver() OVERRIDE; | |
76 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; | |
77 | |
78 scoped_refptr<ShellURLRequestContextGetter> getter_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(ShellResourceContext); | |
81 }; | |
82 | |
51 // Performs initialization of the ShellBrowserContext while IO is still | 83 // Performs initialization of the ShellBrowserContext while IO is still |
52 // allowed on the current thread. | 84 // allowed on the current thread. |
53 void InitWhileIOAllowed(); | 85 void InitWhileIOAllowed(); |
54 | 86 |
55 bool off_the_record_; | 87 bool off_the_record_; |
56 bool ignore_certificate_errors_; | 88 bool ignore_certificate_errors_; |
57 base::ScopedTempDir testing_path_; | 89 base::ScopedTempDir testing_path_; |
58 FilePath path_; | 90 FilePath path_; |
59 scoped_ptr<ResourceContext> resource_context_; | 91 scoped_ptr<ShellResourceContext> resource_context_; |
60 scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_; | 92 scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_; |
61 scoped_refptr<net::URLRequestContextGetter> url_request_getter_; | 93 scoped_refptr<ShellURLRequestContextGetter> url_request_getter_; |
62 | 94 |
63 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); | 95 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); |
64 }; | 96 }; |
65 | 97 |
66 } // namespace content | 98 } // namespace content |
67 | 99 |
68 #endif // CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ | 100 #endif // CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_ |
OLD | NEW |