1 // Copyright (c) 2013 Intel Corporation. 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 XWALK_RUNTIME_BROWSER_XWALK_CONTENT_BROWSER_CLIENT_H_
6 #define XWALK_RUNTIME_BROWSER_XWALK_CONTENT_BROWSER_CLIENT_H_
11 #include "base/compiler_specific.h"
12 #include "content/public/browser/content_browser_client.h"
13 #include "content/public/common/main_function_params.h"
17 class ResourceContext;
18 class QuotaPermissionContext;
19 class SpeechRecognitionManagerDelegate;
21 class WebContentsViewDelegate;
25 class URLRequestContextGetter;
31 class XWalkBrowserMainParts;
34 class XWalkContentBrowserClient : public content::ContentBrowserClient {
36 static XWalkContentBrowserClient* Get();
38 explicit XWalkContentBrowserClient(XWalkRunner* xwalk_runner);
39 virtual ~XWalkContentBrowserClient();
41 // ContentBrowserClient overrides.
42 virtual content::BrowserMainParts* CreateBrowserMainParts(
43 const content::MainFunctionParams& parameters) OVERRIDE;
44 virtual net::URLRequestContextGetter* CreateRequestContext(
45 content::BrowserContext* browser_context,
46 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
47 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
48 content::BrowserContext* browser_context,
49 const base::FilePath& partition_path,
51 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
52 virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
53 int child_process_id) OVERRIDE;
54 virtual content::QuotaPermissionContext*
55 CreateQuotaPermissionContext() OVERRIDE;
56 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
57 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
58 content::WebContents* web_contents) OVERRIDE;
59 virtual void RenderProcessWillLaunch(
60 content::RenderProcessHost* host) OVERRIDE;
61 virtual content::MediaObserver* GetMediaObserver() OVERRIDE;
63 virtual bool AllowGetCookie(const GURL& url,
64 const GURL& first_party,
65 const net::CookieList& cookie_list,
66 content::ResourceContext* context,
67 int render_process_id,
68 int render_frame_id) OVERRIDE;
69 virtual bool AllowSetCookie(const GURL& url,
70 const GURL& first_party,
71 const std::string& cookie_line,
72 content::ResourceContext* context,
73 int render_process_id,
75 net::CookieOptions* options) OVERRIDE;
77 virtual void AllowCertificateError(
78 int render_process_id,
81 const net::SSLInfo& ssl_info,
82 const GURL& request_url,
83 ResourceType::Type resource_type,
85 bool strict_enforcement,
86 const base::Callback<void(bool)>& callback,
87 content::CertificateRequestResultType* result) OVERRIDE;
89 virtual content::SpeechRecognitionManagerDelegate*
90 GetSpeechRecognitionManagerDelegate() OVERRIDE;
92 virtual void RequestDesktopNotificationPermission(
93 const GURL& source_origin,
95 int render_process_id,
96 int render_view_id) OVERRIDE;
97 virtual blink::WebNotificationPresenter::Permission
98 CheckDesktopNotificationPermission(
99 const GURL& source_url,
100 content::ResourceContext* context,
101 int render_process_id) OVERRIDE;
102 virtual void ShowDesktopNotification(
103 const content::ShowDesktopNotificationHostMsgParams& params,
104 int render_process_id,
106 bool worker) OVERRIDE;
107 virtual void CancelDesktopNotification(
108 int render_process_id,
110 int notification_id) OVERRIDE;
111 #if defined(OS_TIZEN)
112 virtual bool CanCommitURL(
113 content::RenderProcessHost* process_host, const GURL& url) OVERRIDE;
116 #if defined(OS_ANDROID)
117 virtual void ResourceDispatcherHostCreated();
119 XWalkBrowserMainParts* main_parts() { return main_parts_; }
122 XWalkRunner* xwalk_runner_;
123 net::URLRequestContextGetter* url_request_context_getter_;
124 XWalkBrowserMainParts* main_parts_;
126 DISALLOW_COPY_AND_ASSIGN(XWalkContentBrowserClient);
131 #endif // XWALK_RUNTIME_BROWSER_XWALK_CONTENT_BROWSER_CLIENT_H_