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_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_
6 #define CHROMECAST_SHELL_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 URLRequestContextFactory
;
18 // Chromecast does not currently support multiple profiles. So there is a
19 // single BrowserContext for all chromecast renderers.
20 // There is no support for PartitionStorage.
21 class CastBrowserContext
: public content::BrowserContext
{
23 explicit CastBrowserContext(
24 URLRequestContextFactory
* url_request_context_factory
);
25 virtual ~CastBrowserContext();
27 // BrowserContext implementation:
28 virtual base::FilePath
GetPath() const OVERRIDE
;
29 virtual bool IsOffTheRecord() const OVERRIDE
;
30 virtual net::URLRequestContextGetter
* GetRequestContext() OVERRIDE
;
31 virtual net::URLRequestContextGetter
* GetRequestContextForRenderProcess(
32 int renderer_child_id
) OVERRIDE
;
33 virtual net::URLRequestContextGetter
* GetMediaRequestContext() OVERRIDE
;
34 virtual net::URLRequestContextGetter
* GetMediaRequestContextForRenderProcess(
35 int renderer_child_id
) OVERRIDE
;
36 virtual net::URLRequestContextGetter
*
37 GetMediaRequestContextForStoragePartition(
38 const base::FilePath
& partition_path
,
39 bool in_memory
) OVERRIDE
;
40 virtual content::ResourceContext
* GetResourceContext() OVERRIDE
;
41 virtual content::DownloadManagerDelegate
*
42 GetDownloadManagerDelegate() OVERRIDE
;
43 virtual content::BrowserPluginGuestManager
* GetGuestManager() OVERRIDE
;
44 virtual storage::SpecialStoragePolicy
* GetSpecialStoragePolicy() OVERRIDE
;
45 virtual content::PushMessagingService
* GetPushMessagingService() OVERRIDE
;
46 virtual content::SSLHostStateDelegate
* GetSSLHostStateDelegate() OVERRIDE
;
49 class CastResourceContext
;
51 // Performs initialization of the CastBrowserContext while IO is still
52 // allowed on the current thread.
53 void InitWhileIOAllowed();
55 URLRequestContextFactory
* const url_request_context_factory_
;
57 scoped_ptr
<CastResourceContext
> resource_context_
;
59 DISALLOW_COPY_AND_ASSIGN(CastBrowserContext
);
63 } // namespace chromecast
65 #endif // CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_