| 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> |
| 9 |
| 8 #include "android_webview/browser/aw_download_manager_delegate.h" | 10 #include "android_webview/browser/aw_download_manager_delegate.h" |
| 9 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 11 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/geolocation_permission_context.h" | 15 #include "content/public/browser/geolocation_permission_context.h" |
| 13 | 16 |
| 17 class GURL; |
| 18 |
| 19 namespace components { |
| 20 class VisitedLinkMaster; |
| 21 } // namespace components |
| 22 |
| 23 namespace content { |
| 24 class WebContents; |
| 25 } // namespace content |
| 26 |
| 14 namespace android_webview { | 27 namespace android_webview { |
| 15 | 28 |
| 16 class AwURLRequestContextGetter; | 29 class AwURLRequestContextGetter; |
| 17 | 30 |
| 18 typedef content::GeolocationPermissionContext* GeolocationPermissionFactoryFn(); | 31 typedef content::GeolocationPermissionContext* GeolocationPermissionFactoryFn(); |
| 19 | 32 |
| 20 class AwBrowserContext : public content::BrowserContext { | 33 class AwBrowserContext : public content::BrowserContext, |
| 34 public components::VisitedLinkDelegate { |
| 21 public: | 35 public: |
| 36 |
| 22 AwBrowserContext( | 37 AwBrowserContext( |
| 23 const FilePath path, | 38 const FilePath path, |
| 24 GeolocationPermissionFactoryFn* geolocation_permission_factory); | 39 GeolocationPermissionFactoryFn* geolocation_permission_factory); |
| 25 virtual ~AwBrowserContext(); | 40 virtual ~AwBrowserContext(); |
| 26 | 41 |
| 42 // Convenience method to returns the AwBrowserContext corresponding to the |
| 43 // given WebContents. |
| 44 static AwBrowserContext* FromWebContents( |
| 45 content::WebContents* web_contents); |
| 46 |
| 27 // Called before BrowserThreads are created. | 47 // Called before BrowserThreads are created. |
| 28 void InitializeBeforeThreadCreation(); | 48 void InitializeBeforeThreadCreation(); |
| 29 | 49 |
| 50 // Maps to BrowserMainParts::PreMainMessageLoopRun. |
| 51 void PreMainMessageLoopRun(); |
| 52 |
| 53 // These methods map to Add methods in components::VisitedLinkMaster. |
| 54 void AddVisitedURL(const GURL& url); |
| 55 void AddVisitedURLs(const std::vector<GURL>& urls); |
| 56 |
| 30 // content::BrowserContext implementation. | 57 // content::BrowserContext implementation. |
| 31 virtual FilePath GetPath() OVERRIDE; | 58 virtual FilePath GetPath() OVERRIDE; |
| 32 virtual bool IsOffTheRecord() const OVERRIDE; | 59 virtual bool IsOffTheRecord() const OVERRIDE; |
| 33 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 60 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
| 34 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 61 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
| 35 int renderer_child_id) OVERRIDE; | 62 int renderer_child_id) OVERRIDE; |
| 36 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( | 63 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( |
| 37 const FilePath& partition_path, bool in_memory) OVERRIDE; | 64 const FilePath& partition_path, bool in_memory) OVERRIDE; |
| 38 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 65 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; |
| 39 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 66 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
| 40 int renderer_child_id) OVERRIDE; | 67 int renderer_child_id) OVERRIDE; |
| 41 virtual net::URLRequestContextGetter* | 68 virtual net::URLRequestContextGetter* |
| 42 GetMediaRequestContextForStoragePartition( | 69 GetMediaRequestContextForStoragePartition( |
| 43 const FilePath& partition_path, bool in_memory) OVERRIDE; | 70 const FilePath& partition_path, bool in_memory) OVERRIDE; |
| 44 virtual content::ResourceContext* GetResourceContext() OVERRIDE; | 71 virtual content::ResourceContext* GetResourceContext() OVERRIDE; |
| 45 virtual content::DownloadManagerDelegate* | 72 virtual content::DownloadManagerDelegate* |
| 46 GetDownloadManagerDelegate() OVERRIDE; | 73 GetDownloadManagerDelegate() OVERRIDE; |
| 47 virtual content::GeolocationPermissionContext* | 74 virtual content::GeolocationPermissionContext* |
| 48 GetGeolocationPermissionContext() OVERRIDE; | 75 GetGeolocationPermissionContext() OVERRIDE; |
| 49 virtual content::SpeechRecognitionPreferences* | 76 virtual content::SpeechRecognitionPreferences* |
| 50 GetSpeechRecognitionPreferences() OVERRIDE; | 77 GetSpeechRecognitionPreferences() OVERRIDE; |
| 51 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 78 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
| 52 | 79 |
| 80 // components::VisitedLinkDelegate implementation. |
| 81 virtual void RebuildTable( |
| 82 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; |
| 83 |
| 53 private: | 84 private: |
| 54 | 85 |
| 55 // The file path where data for this context is persisted. | 86 // The file path where data for this context is persisted. |
| 56 FilePath context_storage_path_; | 87 FilePath context_storage_path_; |
| 57 | 88 |
| 58 scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_; | 89 scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_; |
| 59 GeolocationPermissionFactoryFn* geolocation_permission_factory_; | 90 GeolocationPermissionFactoryFn* geolocation_permission_factory_; |
| 60 scoped_refptr<content::GeolocationPermissionContext> | 91 scoped_refptr<content::GeolocationPermissionContext> |
| 61 geolocation_permission_context_; | 92 geolocation_permission_context_; |
| 62 | 93 |
| 63 AwDownloadManagerDelegate download_manager_delegate_; | 94 AwDownloadManagerDelegate download_manager_delegate_; |
| 64 | 95 |
| 96 scoped_ptr<components::VisitedLinkMaster> visitedlink_master_; |
| 97 |
| 65 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext); | 98 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext); |
| 66 }; | 99 }; |
| 67 | 100 |
| 68 } // namespace android_webview | 101 } // namespace android_webview |
| 69 | 102 |
| 70 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ | 103 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_ |
| OLD | NEW |