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"
13 #include "ui/base/ime/text_input_type.h"
15 class JavaScriptDialogManagerEfl;
19 class WebContentsObserverEfl;
21 class WebContentsDelegateEfl : public WebContentsDelegate {
23 WebContentsDelegateEfl(EWebView*);
24 ~WebContentsDelegateEfl();
26 WebContentsDelegateEfl(const WebContentsDelegateEfl&) = delete;
27 WebContentsDelegateEfl& operator=(const WebContentsDelegateEfl&) = delete;
29 // WebContentsDelegate overrides.
30 WebContents* OpenURLFromTab(WebContents* source,
31 const OpenURLParams& params) override;
32 void NavigationStateChanged(WebContents* source,
33 InvalidateTypes changed_flags) override;
35 void AddNewContents(WebContents* source,
36 std::unique_ptr<WebContents> new_contents,
37 const GURL& target_url,
38 WindowOpenDisposition disposition,
39 const blink::mojom::WindowFeatures& window_features,
41 bool* was_blocked) override;
42 bool ShouldCreateWebContents(
43 WebContents* web_contents,
44 RenderFrameHost* opener,
45 SiteInstance* source_site_instance,
46 mojom::WindowContainerType window_container_type,
47 const GURL& opener_url,
48 const std::string& frame_name,
49 const GURL& target_url,
50 const std::string& partition_id,
51 SessionStorageNamespace* session_storage_namespace);
53 void CloseContents(WebContents* source) override;
54 void EnterFullscreenModeForTab(
55 RenderFrameHost* requesting_frame,
56 const blink::mojom::FullscreenOptions& options) override;
57 void ExitFullscreenModeForTab(WebContents* web_contents) override;
58 bool IsFullscreenForTabOrPending(const WebContents* web_contents) override;
60 void FindReply(WebContents* web_contents,
62 int number_of_matches,
63 const gfx::Rect& selection_rect,
64 int active_match_ordinal,
65 bool final_update) override;
66 void DidRenderFrame() override;
67 void DidChangeInputType(bool is_password_input) override;
69 void OnGetMainFrameScrollbarVisible(int callback_id, bool visible) override;
70 void RequestCertificateConfirm(
71 WebContents* web_contents,
73 const net::SSLInfo& ssl_info,
75 bool is_main_frame_request,
76 bool strict_enforcement,
77 base::OnceCallback<void(CertificateRequestResultType)> callback);
79 JavaScriptDialogManager* GetJavaScriptDialogManager(
80 WebContents* source) override;
81 void ActivateContents(WebContents* contents) override;
82 void OnUpdateSettings(const Ewk_Settings* settings);
83 void SetContentSecurityPolicy(const std::string& policy,
84 Ewk_CSP_Header_Type header_type);
86 void BackgroundColorReceived(int callback_id, SkColor bg_color) override;
88 void DidFirstVisuallyNonEmptyPaint();
89 void DidStartLoading();
91 bool DidAddMessageToConsole(WebContents* source,
92 blink::mojom::ConsoleMessageLevel level,
93 const std::u16string& message,
95 const std::u16string& source_id) override;
96 void RunFileChooser(RenderFrameHost* render_frame_host,
97 scoped_refptr<FileSelectListener> listener,
98 const blink::mojom::FileChooserParams& params) override;
99 std::unique_ptr<ColorChooser> OpenColorChooser(
100 WebContents* web_contents,
102 const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions);
103 #if !defined(EWK_BRINGUP) // FIXME: m76 bringup
104 void OpenDateTimeDialog(ui::TextInputType dialog_type,
109 const std::vector<DateTimeSuggestion>& suggestions);
111 bool PreHandleGestureEvent(WebContents* source,
112 const blink::WebGestureEvent& event) override;
113 void VisibleSecurityStateChanged(WebContents* source) override;
114 EWebView* web_view() const { return web_view_; }
115 WebContents& web_contents() const { return web_contents_; }
117 void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
119 void OnAuthRequired(const std::string& realm,
121 LoginDelegateEfl* login_delegate);
123 #if defined(TIZEN_MULTIMEDIA)
124 bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host,
125 const GURL& security_origin,
126 blink::mojom::MediaStreamType type) override;
128 void RequestMediaAccessPermission(WebContents* web_contents,
129 const MediaStreamRequest& request,
130 MediaResponseCallback callback) override;
132 void RequestMediaAccessAllow(const MediaStreamRequest& request,
133 MediaResponseCallback callback);
135 void RequestMediaAccessDeny(const MediaStreamRequest& request,
136 MediaResponseCallback callback);
139 #if BUILDFLAG(IS_TIZEN_TV)
140 void UpdateTargetURL(WebContents* source, const GURL& url) override;
143 #if defined(TIZEN_AUTOFILL)
144 void UpdateAutofillIfRequired();
147 #if defined(TIZEN_AUTOFILL_FW)
148 void ResetLastInteractedElements();
152 void OnDidGetManifest(Ewk_View_Request_Manifest_Callback callback,
154 const GURL& manifest_url,
155 blink::mojom::ManifestPtr manifest);
156 void OnDidChangeFocusedNodeBounds(const gfx::RectF& focused_node_bounds);
159 WebContents& web_contents_;
160 #if BUILDFLAG(IS_TIZEN_TV)
161 std::string last_hovered_url_;
164 bool did_render_frame_ = false;
165 bool did_first_visually_non_empty_paint_ = false;
167 std::unique_ptr<WebContentsObserverEfl> contents_observer_;
168 void* ime_window_ = nullptr;
169 GURL last_visible_url_;
171 JavaScriptDialogManagerEfl* dialog_manager_ = nullptr;
173 std::unique_ptr<_Ewk_Certificate_Policy_Decision>
174 certificate_policy_decision_;
178 #endif // WEB_CONTENTS_DELEGATE_EFL_H_