Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / chromecast / browser / cast_content_browser_client.h
blob41846746aeb61efbf18d9328305abcce09a05940
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 <map>
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/content_browser_client.h"
14 namespace breakpad {
15 class CrashHandlerHostLinux;
18 namespace content {
19 class BrowserMessageFilter;
22 namespace chromecast {
23 namespace shell {
25 class CastBrowserMainParts;
26 class URLRequestContextFactory;
28 class CastContentBrowserClient: public content::ContentBrowserClient {
29 public:
30 CastContentBrowserClient();
31 ~CastContentBrowserClient() override;
33 // Appends extra command line arguments before launching a new process.
34 void PlatformAppendExtraCommandLineSwitches(base::CommandLine* command_line);
36 // Returns any BrowserMessageFilters from the platform implementation that
37 // should be added when launching a new render process.
38 std::vector<scoped_refptr<content::BrowserMessageFilter>>
39 PlatformGetBrowserMessageFilters();
41 // content::ContentBrowserClient implementation:
42 content::BrowserMainParts* CreateBrowserMainParts(
43 const content::MainFunctionParams& parameters) override;
44 void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
45 net::URLRequestContextGetter* CreateRequestContext(
46 content::BrowserContext* browser_context,
47 content::ProtocolHandlerMap* protocol_handlers,
48 content::URLRequestInterceptorScopedVector request_interceptors)
49 override;
50 bool IsHandledURL(const GURL& url) override;
51 void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
52 int child_process_id) override;
53 content::AccessTokenStore* CreateAccessTokenStore() override;
54 void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
55 content::WebPreferences* prefs) override;
56 void ResourceDispatcherHostCreated() override;
57 std::string GetApplicationLocale() override;
58 void AllowCertificateError(
59 int render_process_id,
60 int render_view_id,
61 int cert_error,
62 const net::SSLInfo& ssl_info,
63 const GURL& request_url,
64 content::ResourceType resource_type,
65 bool overridable,
66 bool strict_enforcement,
67 bool expired_previous_decision,
68 const base::Callback<void(bool)>& callback,
69 content::CertificateRequestResultType* result) override;
70 void SelectClientCertificate(
71 content::WebContents* web_contents,
72 net::SSLCertRequestInfo* cert_request_info,
73 scoped_ptr<content::ClientCertificateDelegate> delegate) override;
74 bool CanCreateWindow(
75 const GURL& opener_url,
76 const GURL& opener_top_level_frame_url,
77 const GURL& source_origin,
78 WindowContainerType container_type,
79 const GURL& target_url,
80 const content::Referrer& referrer,
81 WindowOpenDisposition disposition,
82 const blink::WebWindowFeatures& features,
83 bool user_gesture,
84 bool opener_suppressed,
85 content::ResourceContext* context,
86 int render_process_id,
87 int opener_id,
88 bool* no_javascript_access) override;
89 content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
90 void GetAdditionalMappedFilesForChildProcess(
91 const base::CommandLine& command_line,
92 int child_process_id,
93 content::FileDescriptorInfo* mappings) override;
94 #if defined(OS_ANDROID) && defined(VIDEO_HOLE)
95 content::ExternalVideoSurfaceContainer*
96 OverrideCreateExternalVideoSurfaceContainer(
97 content::WebContents* web_contents) override;
98 #endif // defined(OS_ANDROID) && defined(VIDEO_HOLE)
100 private:
101 net::X509Certificate* SelectClientCertificateOnIOThread(
102 GURL requesting_url,
103 int render_process_id);
105 #if !defined(OS_ANDROID)
106 // Returns the crash signal FD corresponding to the current process type.
107 int GetCrashSignalFD(const base::CommandLine& command_line);
109 // Creates a CrashHandlerHost instance for the given process type.
110 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
111 const std::string& process_type);
113 // A static cache to hold crash_handlers for each process_type
114 std::map<std::string, breakpad::CrashHandlerHostLinux*> crash_handlers_;
115 #endif
117 scoped_ptr<URLRequestContextFactory> url_request_context_factory_;
119 DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient);
122 } // namespace shell
123 } // namespace chromecast
125 #endif // CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_