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_CONTENT_BROWSER_CLIENT_H_
6 #define CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/content_browser_client.h"
12 namespace chromecast
{
15 class CastBrowserMainParts
;
16 class URLRequestContextFactory
;
18 class CastContentBrowserClient
: public content::ContentBrowserClient
{
20 CastContentBrowserClient();
21 virtual ~CastContentBrowserClient();
23 // content::ContentBrowserClient implementation:
24 virtual content::BrowserMainParts
* CreateBrowserMainParts(
25 const content::MainFunctionParams
& parameters
) override
;
26 virtual void RenderProcessWillLaunch(
27 content::RenderProcessHost
* host
) override
;
28 virtual net::URLRequestContextGetter
* CreateRequestContext(
29 content::BrowserContext
* browser_context
,
30 content::ProtocolHandlerMap
* protocol_handlers
,
31 content::URLRequestInterceptorScopedVector request_interceptors
)
33 virtual bool IsHandledURL(const GURL
& url
) override
;
34 virtual void AppendExtraCommandLineSwitches(base::CommandLine
* command_line
,
35 int child_process_id
) override
;
36 virtual content::AccessTokenStore
* CreateAccessTokenStore() override
;
37 virtual void OverrideWebkitPrefs(content::RenderViewHost
* render_view_host
,
39 content::WebPreferences
* prefs
) override
;
40 virtual std::string
GetApplicationLocale() override
;
41 virtual void AllowCertificateError(
42 int render_process_id
,
45 const net::SSLInfo
& ssl_info
,
46 const GURL
& request_url
,
47 content::ResourceType resource_type
,
49 bool strict_enforcement
,
50 bool expired_previous_decision
,
51 const base::Callback
<void(bool)>& callback
,
52 content::CertificateRequestResultType
* result
) override
;
53 virtual void SelectClientCertificate(
54 int render_process_id
,
56 net::SSLCertRequestInfo
* cert_request_info
,
57 const base::Callback
<void(net::X509Certificate
*)>& callback
) override
;
58 virtual bool CanCreateWindow(
59 const GURL
& opener_url
,
60 const GURL
& opener_top_level_frame_url
,
61 const GURL
& source_origin
,
62 WindowContainerType container_type
,
63 const GURL
& target_url
,
64 const content::Referrer
& referrer
,
65 WindowOpenDisposition disposition
,
66 const blink::WebWindowFeatures
& features
,
68 bool opener_suppressed
,
69 content::ResourceContext
* context
,
70 int render_process_id
,
72 bool* no_javascript_access
) override
;
73 virtual content::DevToolsManagerDelegate
*
74 GetDevToolsManagerDelegate() override
;
75 virtual void GetAdditionalMappedFilesForChildProcess(
76 const base::CommandLine
& command_line
,
78 content::FileDescriptorInfo
* mappings
) override
;
79 #if defined(OS_ANDROID) && defined(VIDEO_HOLE)
80 virtual content::ExternalVideoSurfaceContainer
*
81 OverrideCreateExternalVideoSurfaceContainer(
82 content::WebContents
* web_contents
) override
;
83 #endif // defined(OS_ANDROID) && defined(VIDEO_HOLE)
86 net::X509Certificate
* SelectClientCertificateOnIOThread(
88 int render_process_id
);
90 scoped_ptr
<URLRequestContextFactory
> url_request_context_factory_
;
92 DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient
);
96 } // namespace chromecast
98 #endif // CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_