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 ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "android_webview/browser/aw_download_manager_delegate.h" | 10 #include "android_webview/browser/aw_download_manager_delegate.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 class AwURLRequestContextGetter; | 34 class AwURLRequestContextGetter; |
35 | 35 |
36 typedef content::GeolocationPermissionContext* GeolocationPermissionFactoryFn(); | 36 typedef content::GeolocationPermissionContext* GeolocationPermissionFactoryFn(); |
37 | 37 |
38 class AwBrowserContext : public content::BrowserContext, | 38 class AwBrowserContext : public content::BrowserContext, |
39 public components::VisitedLinkDelegate { | 39 public components::VisitedLinkDelegate { |
40 public: | 40 public: |
41 | 41 |
42 AwBrowserContext( | 42 AwBrowserContext( |
43 const FilePath path, | 43 const base::FilePath path, |
44 GeolocationPermissionFactoryFn* geolocation_permission_factory); | 44 GeolocationPermissionFactoryFn* geolocation_permission_factory); |
45 virtual ~AwBrowserContext(); | 45 virtual ~AwBrowserContext(); |
46 | 46 |
47 // Convenience method to returns the AwBrowserContext corresponding to the | 47 // Convenience method to returns the AwBrowserContext corresponding to the |
48 // given WebContents. | 48 // given WebContents. |
49 static AwBrowserContext* FromWebContents( | 49 static AwBrowserContext* FromWebContents( |
50 content::WebContents* web_contents); | 50 content::WebContents* web_contents); |
51 | 51 |
52 // Called before BrowserThreads are created. | 52 // Called before BrowserThreads are created. |
53 void InitializeBeforeThreadCreation(); | 53 void InitializeBeforeThreadCreation(); |
54 | 54 |
55 // Maps to BrowserMainParts::PreMainMessageLoopRun. | 55 // Maps to BrowserMainParts::PreMainMessageLoopRun. |
56 void PreMainMessageLoopRun(); | 56 void PreMainMessageLoopRun(); |
57 | 57 |
58 // These methods map to Add methods in components::VisitedLinkMaster. | 58 // These methods map to Add methods in components::VisitedLinkMaster. |
59 void AddVisitedURLs(const std::vector<GURL>& urls); | 59 void AddVisitedURLs(const std::vector<GURL>& urls); |
60 | 60 |
61 net::URLRequestContextGetter* CreateRequestContext( | 61 net::URLRequestContextGetter* CreateRequestContext( |
62 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 62 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
63 blob_protocol_handler, | 63 blob_protocol_handler, |
64 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 64 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
65 file_system_protocol_handler, | 65 file_system_protocol_handler, |
66 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 66 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
67 developer_protocol_handler, | 67 developer_protocol_handler, |
68 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 68 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
69 chrome_protocol_handler, | 69 chrome_protocol_handler, |
70 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 70 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
71 chrome_devtools_protocol_handler); | 71 chrome_devtools_protocol_handler); |
72 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 72 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
73 const FilePath& partition_path, | 73 const base::FilePath& partition_path, |
74 bool in_memory, | 74 bool in_memory, |
75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
76 blob_protocol_handler, | 76 blob_protocol_handler, |
77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
78 file_system_protocol_handler, | 78 file_system_protocol_handler, |
79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
80 developer_protocol_handler, | 80 developer_protocol_handler, |
81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
82 chrome_protocol_handler, | 82 chrome_protocol_handler, |
83 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 83 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
84 chrome_devtools_protocol_handler); | 84 chrome_devtools_protocol_handler); |
85 | 85 |
86 // content::BrowserContext implementation. | 86 // content::BrowserContext implementation. |
87 virtual FilePath GetPath() OVERRIDE; | 87 virtual base::FilePath GetPath() OVERRIDE; |
88 virtual bool IsOffTheRecord() const OVERRIDE; | 88 virtual bool IsOffTheRecord() const OVERRIDE; |
89 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 89 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
90 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 90 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
91 int renderer_child_id) OVERRIDE; | 91 int renderer_child_id) OVERRIDE; |
92 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 92 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; |
93 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 93 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
94 int renderer_child_id) OVERRIDE; | 94 int renderer_child_id) OVERRIDE; |
95 virtual net::URLRequestContextGetter* | 95 virtual net::URLRequestContextGetter* |
96 GetMediaRequestContextForStoragePartition( | 96 GetMediaRequestContextForStoragePartition( |
97 const FilePath& partition_path, bool in_memory) OVERRIDE; | 97 const base::FilePath& partition_path, bool in_memory) OVERRIDE; |
98 virtual content::ResourceContext* GetResourceContext() OVERRIDE; | 98 virtual content::ResourceContext* GetResourceContext() OVERRIDE; |
99 virtual content::DownloadManagerDelegate* | 99 virtual content::DownloadManagerDelegate* |
100 GetDownloadManagerDelegate() OVERRIDE; | 100 GetDownloadManagerDelegate() OVERRIDE; |
101 virtual content::GeolocationPermissionContext* | 101 virtual content::GeolocationPermissionContext* |
102 GetGeolocationPermissionContext() OVERRIDE; | 102 GetGeolocationPermissionContext() OVERRIDE; |
103 virtual content::SpeechRecognitionPreferences* | 103 virtual content::SpeechRecognitionPreferences* |
104 GetSpeechRecognitionPreferences() OVERRIDE; | 104 GetSpeechRecognitionPreferences() OVERRIDE; |
105 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 105 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
106 | 106 |
107 // components::VisitedLinkDelegate implementation. | 107 // components::VisitedLinkDelegate implementation. |
108 virtual void RebuildTable( | 108 virtual void RebuildTable( |
109 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; | 109 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; |
110 | 110 |
111 private: | 111 private: |
112 // The file path where data for this context is persisted. | 112 // The file path where data for this context is persisted. |
113 FilePath context_storage_path_; | 113 base::FilePath context_storage_path_; |
114 | 114 |
115 scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_; | 115 scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_; |
116 GeolocationPermissionFactoryFn* geolocation_permission_factory_; | 116 GeolocationPermissionFactoryFn* geolocation_permission_factory_; |
117 scoped_refptr<content::GeolocationPermissionContext> | 117 scoped_refptr<content::GeolocationPermissionContext> |
118 geolocation_permission_context_; | 118 geolocation_permission_context_; |
119 | 119 |
120 AwDownloadManagerDelegate download_manager_delegate_; | 120 AwDownloadManagerDelegate download_manager_delegate_; |
121 | 121 |
122 scoped_ptr<components::VisitedLinkMaster> visitedlink_master_; | 122 scoped_ptr<components::VisitedLinkMaster> visitedlink_master_; |
123 scoped_ptr<content::ResourceContext> resource_context_; | 123 scoped_ptr<content::ResourceContext> resource_context_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext); | 125 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace android_webview | 128 } // namespace android_webview |
129 | 129 |
130 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ | 130 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ |
OLD | NEW |