1 // Copyright 2014 Samsung Electronics. 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 WEB_CONTENTS_DELEGATE_EFL_H_
6 #define WEB_CONTENTS_DELEGATE_EFL_H_
8 #include "content/public/browser/web_contents_delegate.h"
10 #include "private/ewk_manifest_private.h"
11 #include "public/ewk_view_internal.h"
12 #include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
14 class JavaScriptDialogManagerEfl;
18 class WebContentsObserverEfl;
20 class WebContentsDelegateEfl : public WebContentsDelegate {
22 WebContentsDelegateEfl(EWebView*);
23 ~WebContentsDelegateEfl();
25 WebContentsDelegateEfl(const WebContentsDelegateEfl&) = delete;
26 WebContentsDelegateEfl& operator=(const WebContentsDelegateEfl&) = delete;
28 // WebContentsDelegate overrides.
29 WebContents* OpenURLFromTab(WebContents* source,
30 const OpenURLParams& params) override;
31 void NavigationStateChanged(WebContents* source,
32 InvalidateTypes changed_flags) override;
34 void AddNewContents(WebContents* source,
35 std::unique_ptr<WebContents> new_contents,
36 const GURL& target_url,
37 WindowOpenDisposition disposition,
38 const blink::mojom::WindowFeatures& window_features,
40 bool* was_blocked) override;
41 bool ShouldCreateWebContents(
42 WebContents* web_contents,
43 RenderFrameHost* opener,
44 SiteInstance* source_site_instance,
45 mojom::WindowContainerType window_container_type,
46 const GURL& opener_url,
47 const std::string& frame_name,
48 const GURL& target_url,
49 const std::string& partition_id,
50 SessionStorageNamespace* session_storage_namespace);
52 void CloseContents(WebContents* source) override;
53 void EnterFullscreenModeForTab(
54 RenderFrameHost* requesting_frame,
55 const blink::mojom::FullscreenOptions& options) override;
56 void ExitFullscreenModeForTab(WebContents* web_contents) override;
57 bool IsFullscreenForTabOrPending(const WebContents* web_contents) override;
59 void FindReply(WebContents* web_contents,
61 int number_of_matches,
62 const gfx::Rect& selection_rect,
63 int active_match_ordinal,
64 bool final_update) override;
65 void DidRenderFrame() override;
66 void DidChangeInputType(bool is_password_input) override;
68 void OnGetMainFrameScrollbarVisible(int callback_id, bool visible) override;
69 void RequestCertificateConfirm(
70 WebContents* web_contents,
72 const net::SSLInfo& ssl_info,
74 bool is_main_frame_request,
75 bool strict_enforcement,
76 base::OnceCallback<void(CertificateRequestResultType)> callback);
78 JavaScriptDialogManager* GetJavaScriptDialogManager(
79 WebContents* source) override;
80 void ActivateContents(WebContents* contents) override;
81 void OnUpdateSettings(const Ewk_Settings* settings);
82 void SetContentSecurityPolicy(const std::string& policy,
83 Ewk_CSP_Header_Type header_type);
85 void BackgroundColorReceived(int callback_id, SkColor bg_color) override;
87 void DidFirstVisuallyNonEmptyPaint();
88 void DidStartLoading();
90 bool DidAddMessageToConsole(WebContents* source,
91 blink::mojom::ConsoleMessageLevel level,
92 const std::u16string& message,
94 const std::u16string& source_id) override;
95 void RunFileChooser(RenderFrameHost* render_frame_host,
96 scoped_refptr<FileSelectListener> listener,
97 const blink::mojom::FileChooserParams& params) override;
98 std::unique_ptr<ColorChooser> OpenColorChooser(
99 WebContents* web_contents,
101 const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions);
102 bool PreHandleGestureEvent(WebContents* source,
103 const blink::WebGestureEvent& event) override;
104 void VisibleSecurityStateChanged(WebContents* source) override;
105 EWebView* web_view() const { return web_view_; }
106 WebContents& web_contents() const { return web_contents_; }
108 void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
110 void OnAuthRequired(const std::string& realm,
112 LoginDelegateEfl* login_delegate);
114 #if defined(TIZEN_MULTIMEDIA)
115 bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host,
116 const GURL& security_origin,
117 blink::mojom::MediaStreamType type) override;
119 void RequestMediaAccessPermission(WebContents* web_contents,
120 const MediaStreamRequest& request,
121 MediaResponseCallback callback) override;
123 void RequestMediaAccessAllow(const MediaStreamRequest& request,
124 MediaResponseCallback callback);
126 void RequestMediaAccessDeny(const MediaStreamRequest& request,
127 MediaResponseCallback callback);
130 #if BUILDFLAG(IS_TIZEN_TV)
131 void UpdateTargetURL(WebContents* source, const GURL& url) override;
134 #if defined(TIZEN_AUTOFILL)
135 void UpdateAutofillIfRequired();
138 #if defined(TIZEN_AUTOFILL_FW)
139 void ResetLastInteractedElements();
143 void OnDidGetManifest(Ewk_View_Request_Manifest_Callback callback,
145 const GURL& manifest_url,
146 blink::mojom::ManifestPtr manifest);
147 void OnDidChangeFocusedNodeBounds(const gfx::RectF& focused_node_bounds);
150 WebContents& web_contents_;
151 #if BUILDFLAG(IS_TIZEN_TV)
152 std::string last_hovered_url_;
155 bool did_render_frame_ = false;
156 bool did_first_visually_non_empty_paint_ = false;
158 std::unique_ptr<WebContentsObserverEfl> contents_observer_;
159 void* ime_window_ = nullptr;
160 GURL last_visible_url_;
162 JavaScriptDialogManagerEfl* dialog_manager_ = nullptr;
164 std::unique_ptr<_Ewk_Certificate_Policy_Decision>
165 certificate_policy_decision_;
169 #endif // WEB_CONTENTS_DELEGATE_EFL_H_