[M108 Migration] Segregate InputPicker into ewk independent base classes
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / web_contents_delegate_efl.h
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.
4
5 #ifndef WEB_CONTENTS_DELEGATE_EFL_H_
6 #define WEB_CONTENTS_DELEGATE_EFL_H_
7
8 #include "content/public/browser/web_contents_delegate.h"
9 #include "eweb_view.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
14 class JavaScriptDialogManagerEfl;
15
16 namespace content {
17
18 class WebContentsObserverEfl;
19
20 class WebContentsDelegateEfl : public WebContentsDelegate {
21  public:
22   WebContentsDelegateEfl(EWebView*);
23   ~WebContentsDelegateEfl();
24
25   WebContentsDelegateEfl(const WebContentsDelegateEfl&) = delete;
26   WebContentsDelegateEfl& operator=(const WebContentsDelegateEfl&) = delete;
27
28   // WebContentsDelegate overrides.
29   WebContents* OpenURLFromTab(WebContents* source,
30                               const OpenURLParams& params) override;
31   void NavigationStateChanged(WebContents* source,
32                               InvalidateTypes changed_flags) override;
33
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,
39                       bool user_gesture,
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);
51
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;
58
59   void FindReply(WebContents* web_contents,
60                  int request_id,
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;
67
68   void OnGetMainFrameScrollbarVisible(int callback_id, bool visible) override;
69   void RequestCertificateConfirm(
70       WebContents* web_contents,
71       int cert_error,
72       const net::SSLInfo& ssl_info,
73       const GURL& url,
74       bool is_main_frame_request,
75       bool strict_enforcement,
76       base::OnceCallback<void(CertificateRequestResultType)> callback);
77
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);
84
85   void BackgroundColorReceived(int callback_id, SkColor bg_color) override;
86
87   void DidFirstVisuallyNonEmptyPaint();
88   void DidStartLoading();
89
90   bool DidAddMessageToConsole(WebContents* source,
91                               blink::mojom::ConsoleMessageLevel level,
92                               const std::u16string& message,
93                               int32_t line_no,
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,
100       SkColor color,
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_; }
107
108   void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
109                            void* user_data);
110   void OnAuthRequired(const std::string& realm,
111                       const GURL& url,
112                       LoginDelegateEfl* login_delegate);
113
114 #if defined(TIZEN_MULTIMEDIA)
115   bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host,
116                                   const GURL& security_origin,
117                                   blink::mojom::MediaStreamType type) override;
118
119   void RequestMediaAccessPermission(WebContents* web_contents,
120                                     const MediaStreamRequest& request,
121                                     MediaResponseCallback callback) override;
122
123   void RequestMediaAccessAllow(const MediaStreamRequest& request,
124                                MediaResponseCallback callback);
125
126   void RequestMediaAccessDeny(const MediaStreamRequest& request,
127                               MediaResponseCallback callback);
128 #endif
129
130 #if BUILDFLAG(IS_TIZEN_TV)
131   void UpdateTargetURL(WebContents* source, const GURL& url) override;
132 #endif
133
134 #if defined(TIZEN_AUTOFILL)
135   void UpdateAutofillIfRequired();
136 #endif
137
138 #if defined(TIZEN_AUTOFILL_FW)
139   void ResetLastInteractedElements();
140 #endif
141
142  private:
143   void OnDidGetManifest(Ewk_View_Request_Manifest_Callback callback,
144                         void* user_data,
145                         const GURL& manifest_url,
146                         blink::mojom::ManifestPtr manifest);
147   void OnDidChangeFocusedNodeBounds(const gfx::RectF& focused_node_bounds);
148   EWebView* web_view_;
149   bool is_fullscreen_;
150   WebContents& web_contents_;
151 #if BUILDFLAG(IS_TIZEN_TV)
152   std::string last_hovered_url_;
153 #endif
154
155   bool did_render_frame_ = false;
156   bool did_first_visually_non_empty_paint_ = false;
157
158   std::unique_ptr<WebContentsObserverEfl> contents_observer_;
159   void* ime_window_ = nullptr;
160   GURL last_visible_url_;
161
162   JavaScriptDialogManagerEfl* dialog_manager_ = nullptr;
163   int rotation_ = -1;
164   std::unique_ptr<_Ewk_Certificate_Policy_Decision>
165       certificate_policy_decision_;
166 };
167 }
168
169 #endif  // WEB_CONTENTS_DELEGATE_EFL_H_