cast_content_browser_client.h revision 116680a4aac90f2aa7413d9095a592090648e557
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.
4
5#ifndef CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
6#define CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
7
8#include "base/macros.h"
9#include "content/public/browser/content_browser_client.h"
10
11namespace chromecast {
12namespace shell {
13
14class CastBrowserMainParts;
15class URLRequestContextFactory;
16
17class CastContentBrowserClient: public content::ContentBrowserClient {
18 public:
19  CastContentBrowserClient();
20  virtual ~CastContentBrowserClient();
21
22  // content::ContentBrowserClient implementation:
23  virtual content::BrowserMainParts* CreateBrowserMainParts(
24      const content::MainFunctionParams& parameters) OVERRIDE;
25  virtual void RenderProcessWillLaunch(
26      content::RenderProcessHost* host) OVERRIDE;
27  virtual net::URLRequestContextGetter* CreateRequestContext(
28      content::BrowserContext* browser_context,
29      content::ProtocolHandlerMap* protocol_handlers,
30      content::URLRequestInterceptorScopedVector request_interceptors)
31      OVERRIDE;
32  virtual bool IsHandledURL(const GURL& url) OVERRIDE;
33  virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
34                                              int child_process_id) OVERRIDE;
35  virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
36  virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
37                                   const GURL& url,
38                                   content::WebPreferences* prefs) OVERRIDE;
39  virtual std::string GetApplicationLocale() OVERRIDE;
40  virtual void AllowCertificateError(
41      int render_process_id,
42      int render_view_id,
43      int cert_error,
44      const net::SSLInfo& ssl_info,
45      const GURL& request_url,
46      content::ResourceType::Type resource_type,
47      bool overridable,
48      bool strict_enforcement,
49      const base::Callback<void(bool)>& callback,
50      content::CertificateRequestResultType* result) OVERRIDE;
51  virtual bool CanCreateWindow(
52      const GURL& opener_url,
53      const GURL& opener_top_level_frame_url,
54      const GURL& source_origin,
55      WindowContainerType container_type,
56      const GURL& target_url,
57      const content::Referrer& referrer,
58      WindowOpenDisposition disposition,
59      const blink::WebWindowFeatures& features,
60      bool user_gesture,
61      bool opener_suppressed,
62      content::ResourceContext* context,
63      int render_process_id,
64      int opener_id,
65      bool* no_javascript_access) OVERRIDE;
66  virtual void GetAdditionalMappedFilesForChildProcess(
67      const base::CommandLine& command_line,
68      int child_process_id,
69      std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
70
71 private:
72  scoped_ptr<CastBrowserMainParts> shell_browser_main_parts_;
73
74  scoped_ptr<URLRequestContextFactory> url_request_context_factory_;
75
76  DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient);
77};
78
79}  // namespace shell
80}  // namespace chromecast
81
82#endif  // CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
83