forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheadless_content_browser_client.h
109 lines (90 loc) · 4.19 KB
/
headless_content_browser_client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef HEADLESS_LIB_BROWSER_HEADLESS_CONTENT_BROWSER_CLIENT_H_
#define HEADLESS_LIB_BROWSER_HEADLESS_CONTENT_BROWSER_CLIENT_H_
#include <memory>
#include <vector>
#include "build/build_config.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "headless/public/headless_browser.h"
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
namespace headless {
class HeadlessBrowserImpl;
class HeadlessContentBrowserClient : public content::ContentBrowserClient {
public:
explicit HeadlessContentBrowserClient(HeadlessBrowserImpl* browser);
~HeadlessContentBrowserClient() override;
// content::ContentBrowserClient implementation:
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams&) override;
void OverrideWebkitPrefs(content::WebContents* web_contents,
blink::web_pref::WebPreferences* prefs) override;
void RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
bool BindAssociatedReceiverFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle* handle) override;
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
override;
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
content::BrowserContext* context) override;
#if defined(OS_POSIX) && !defined(OS_MAC)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
content::PosixFileDescriptorInfo* mappings) override;
#endif
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
std::string GetApplicationLocale() override;
std::string GetAcceptLangs(content::BrowserContext* context) override;
void AllowCertificateError(
content::WebContents* web_contents,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
bool is_main_frame_request,
bool strict_enforcement,
base::OnceCallback<void(content::CertificateRequestResultType)> callback)
override;
base::OnceClosure SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
bool ShouldEnableStrictSiteIsolation() override;
void ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
::network::mojom::NetworkContextParams* network_context_params,
::cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) override;
std::string GetProduct() override;
std::string GetUserAgent() override;
bool CanAcceptUntrustedExchangesIfNeeded() override;
device::GeolocationManager* GetGeolocationManager() override;
#if defined(HEADLESS_USE_POLICY)
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(content::NavigationHandle* handle) override;
#endif
private:
class StubBadgeService;
void BindBadgeService(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
HeadlessBrowserImpl* browser_; // Not owned.
// We store the callback here because we may call it from the I/O thread.
HeadlessBrowser::Options::AppendCommandLineFlagsCallback
append_command_line_flags_callback_;
std::unique_ptr<StubBadgeService> stub_badge_service_;
DISALLOW_COPY_AND_ASSIGN(HeadlessContentBrowserClient);
};
} // namespace headless
#endif // HEADLESS_LIB_BROWSER_HEADLESS_CONTENT_BROWSER_CLIENT_H_