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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_
8 #include "android_webview/browser/aw_download_manager_delegate.h"
9 #include "base/file_path.h"
10 #include "base/memory/ref_counted.h"
11 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/geolocation_permission_context.h"
14 namespace android_webview
{
16 class AwURLRequestContextGetter
;
18 typedef content::GeolocationPermissionContext
* GeolocationPermissionFactoryFn();
20 class AwBrowserContext
: public content::BrowserContext
{
24 GeolocationPermissionFactoryFn
* geolocation_permission_factory
);
25 virtual ~AwBrowserContext();
27 // Called before BrowserThreads are created.
28 void InitializeBeforeThreadCreation();
30 // content::BrowserContext implementation.
31 virtual FilePath
GetPath() OVERRIDE
;
32 virtual bool IsOffTheRecord() const OVERRIDE
;
33 virtual net::URLRequestContextGetter
* GetRequestContext() OVERRIDE
;
34 virtual net::URLRequestContextGetter
* GetRequestContextForRenderProcess(
35 int renderer_child_id
) OVERRIDE
;
36 virtual net::URLRequestContextGetter
* GetRequestContextForStoragePartition(
37 const FilePath
& partition_path
, bool in_memory
) OVERRIDE
;
38 virtual net::URLRequestContextGetter
* GetMediaRequestContext() OVERRIDE
;
39 virtual net::URLRequestContextGetter
* GetMediaRequestContextForRenderProcess(
40 int renderer_child_id
) OVERRIDE
;
41 virtual net::URLRequestContextGetter
*
42 GetMediaRequestContextForStoragePartition(
43 const FilePath
& partition_path
, bool in_memory
) OVERRIDE
;
44 virtual content::ResourceContext
* GetResourceContext() OVERRIDE
;
45 virtual content::DownloadManagerDelegate
*
46 GetDownloadManagerDelegate() OVERRIDE
;
47 virtual content::GeolocationPermissionContext
*
48 GetGeolocationPermissionContext() OVERRIDE
;
49 virtual content::SpeechRecognitionPreferences
*
50 GetSpeechRecognitionPreferences() OVERRIDE
;
51 virtual quota::SpecialStoragePolicy
* GetSpecialStoragePolicy() OVERRIDE
;
55 // The file path where data for this context is persisted.
56 FilePath context_storage_path_
;
58 scoped_refptr
<AwURLRequestContextGetter
> url_request_context_getter_
;
59 GeolocationPermissionFactoryFn
* geolocation_permission_factory_
;
60 scoped_refptr
<content::GeolocationPermissionContext
>
61 geolocation_permission_context_
;
63 AwDownloadManagerDelegate download_manager_delegate_
;
65 DISALLOW_COPY_AND_ASSIGN(AwBrowserContext
);
68 } // namespace android_webview
70 #endif // ANDROID_WEBVIEW_BROWSER_AW_BROWSER_CONTEXT_H_