forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_content_browser_client.h
More file actions
134 lines (117 loc) · 5.45 KB
/
shell_content_browser_client.h
File metadata and controls
134 lines (117 loc) · 5.45 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Copyright (c) 2012 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 CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
#define CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_
#include <string>
#include <map>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
#include "third_party/WebKit/public/platform/WebNotificationPermission.h"
namespace printing {
class PrintJobManager;
}
namespace extensions {
class Extension;
}
namespace content {
class ShellBrowserContext;
class ShellBrowserMainParts;
class ShellResourceDispatcherHostDelegate;
class RenderProcessHost;
class ShellContentBrowserClient : public ContentBrowserClient {
public:
ShellContentBrowserClient();
~ShellContentBrowserClient() final;
// ContentBrowserClient overrides.
BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters) override;
void OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view,
const WebContents::CreateParams& params) override;
std::string GetApplicationLocale() override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
void ResourceDispatcherHostCreated() override;
AccessTokenStore* CreateAccessTokenStore() override;
void OverrideWebkitPrefs(
RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) override;
std::string GetDefaultDownloadName() override;
#if 0
MediaObserver* GetMediaObserver() override;
#endif
bool CheckMediaAccessPermission(BrowserContext* browser_context,
const GURL& security_origin,
MediaStreamType type) override;
void BrowserURLHandlerCreated(BrowserURLHandler* handler) override;
bool IsHandledURL(const GURL& url) override;
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
bool ShouldTryToUseExistingProcessHost(
BrowserContext* browser_context, const GURL& url) override;
bool IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) override;
ShellBrowserContext* browser_context();
ShellBrowserContext* off_the_record_browser_context();
ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() {
return resource_dispatcher_host_delegate_.get();
}
ShellBrowserMainParts* shell_browser_main_parts() {
return shell_browser_main_parts_;
}
printing::PrintJobManager* print_job_manager();
void RenderProcessWillLaunch(RenderProcessHost* host) override;
net::URLRequestContextGetter* CreateRequestContext(
BrowserContext* browser_context,
ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors) override;
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
BrowserContext* browser_context,
const base::FilePath& partition_path,
bool in_memory,
ProtocolHandlerMap* protocol_handlers,
URLRequestInterceptorScopedVector request_interceptors) override;
void AllowCertificateError(int render_process_id,
int render_frame_id,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
ResourceType resource_type,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
CertificateRequestResultType* result) override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) override;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
FileDescriptorInfo* mappings) override;
#endif
QuotaPermissionContext* CreateQuotaPermissionContext() override;
DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
bool ShouldUseProcessPerSite(
content::BrowserContext* browser_context,
const GURL& effective_url) override;
PlatformNotificationService* GetPlatformNotificationService() override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
private:
ShellBrowserContext* ShellBrowserContextForBrowserContext(
BrowserContext* content_browser_context);
bool GetUserAgentManifest(std::string* agent);
// Returns the extension or app associated with |site_instance| or NULL.
const extensions::Extension* GetExtension(content::SiteInstance* site_instance);
scoped_ptr<ShellResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
ShellBrowserMainParts* shell_browser_main_parts_;
content::RenderProcessHost* master_rph_;
};
} // namespace content
#endif // CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_