1 // Copyright 2014 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 CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_
6 #define CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_
8 #include "base/files/file_path.h"
9 #include "base/macros.h"
10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/content_browser_client.h"
13 namespace chromecast
{
16 class CastDownloadManagerDelegate
;
17 class URLRequestContextFactory
;
19 // Chromecast does not currently support multiple profiles. So there is a
20 // single BrowserContext for all chromecast renderers.
21 // There is no support for PartitionStorage.
22 class CastBrowserContext
: public content::BrowserContext
{
24 explicit CastBrowserContext(
25 URLRequestContextFactory
* url_request_context_factory
);
26 ~CastBrowserContext() override
;
28 // BrowserContext implementation:
29 scoped_ptr
<content::ZoomLevelDelegate
> CreateZoomLevelDelegate(
30 const base::FilePath
& partition_path
) override
;
31 base::FilePath
GetPath() const override
;
32 bool IsOffTheRecord() const override
;
33 net::URLRequestContextGetter
* GetRequestContext() override
;
34 net::URLRequestContextGetter
* GetRequestContextForRenderProcess(
35 int renderer_child_id
) override
;
36 net::URLRequestContextGetter
* GetMediaRequestContext() override
;
37 net::URLRequestContextGetter
* GetMediaRequestContextForRenderProcess(
38 int renderer_child_id
) override
;
39 net::URLRequestContextGetter
* GetMediaRequestContextForStoragePartition(
40 const base::FilePath
& partition_path
,
41 bool in_memory
) override
;
42 content::ResourceContext
* GetResourceContext() override
;
43 content::DownloadManagerDelegate
* GetDownloadManagerDelegate() override
;
44 content::BrowserPluginGuestManager
* GetGuestManager() override
;
45 storage::SpecialStoragePolicy
* GetSpecialStoragePolicy() override
;
46 content::PushMessagingService
* GetPushMessagingService() override
;
47 content::SSLHostStateDelegate
* GetSSLHostStateDelegate() override
;
48 content::PermissionManager
* GetPermissionManager() override
;
50 net::URLRequestContextGetter
* GetSystemRequestContext();
53 class CastResourceContext
;
55 // Performs initialization of the CastBrowserContext while IO is still
56 // allowed on the current thread.
57 void InitWhileIOAllowed();
59 URLRequestContextFactory
* const url_request_context_factory_
;
61 scoped_ptr
<CastResourceContext
> resource_context_
;
62 scoped_ptr
<CastDownloadManagerDelegate
> download_manager_delegate_
;
63 scoped_ptr
<content::PermissionManager
> permission_manager_
;
65 DISALLOW_COPY_AND_ASSIGN(CastBrowserContext
);
69 } // namespace chromecast
71 #endif // CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_