forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell_content_browser_client.h
121 lines (107 loc) · 4.59 KB
/
shell_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
110
111
112
113
114
115
116
117
118
119
120
121
// 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 "content/public/browser/web_contents_view.h"
namespace printing {
class PrintJobManager;
}
namespace content {
class ShellBrowserContext;
class ShellBrowserMainParts;
class ShellResourceDispatcherHostDelegate;
class RenderProcessHost;
class ShellContentBrowserClient : public ContentBrowserClient {
public:
ShellContentBrowserClient();
virtual ~ShellContentBrowserClient();
// ContentBrowserClient overrides.
virtual BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters) OVERRIDE;
virtual WebContentsViewPort* OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view,
const WebContents::CreateParams& params) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) OVERRIDE;
virtual void ResourceDispatcherHostCreated() OVERRIDE;
virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
virtual void OverrideWebkitPrefs(
RenderViewHost* render_view_host,
const GURL& url,
WebPreferences* prefs) OVERRIDE;
virtual std::string GetDefaultDownloadName() OVERRIDE;
virtual MediaObserver* GetMediaObserver() OVERRIDE;
virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) OVERRIDE;
virtual bool IsHandledURL(const GURL& url) OVERRIDE;
virtual bool ShouldTryToUseExistingProcessHost(
BrowserContext* browser_context, const GURL& url) OVERRIDE;
virtual 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_;
}
virtual printing::PrintJobManager* print_job_manager();
virtual void RenderProcessWillLaunch(RenderProcessHost* host) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContext(
BrowserContext* browser_context,
ProtocolHandlerMap* protocol_handlers, ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
BrowserContext* browser_context,
const base::FilePath& partition_path,
bool in_memory,
ProtocolHandlerMap* protocol_handlers,
ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
virtual void AllowCertificateError(
int render_process_id,
int render_view_id,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
ResourceType::Type resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) OVERRIDE;
virtual void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
virtual void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
#endif
virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE;
//Notification
virtual void ShowDesktopNotification(
const ShowDesktopNotificationHostMsgParams& params,
int render_process_id,
int render_view_id,
bool worker) OVERRIDE;
virtual void CancelDesktopNotification(
int render_process_id,
int render_view_id,
int notification_id) OVERRIDE;
private:
ShellBrowserContext* ShellBrowserContextForBrowserContext(
BrowserContext* content_browser_context);
bool GetUserAgentManifest(std::string* agent);
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_