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