// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEB_CONTENTS_DELEGATE_EFL
-#define WEB_CONTENTS_DELEGATE_EFL
+#ifndef WEB_CONTENTS_DELEGATE_EFL_H_
+#define WEB_CONTENTS_DELEGATE_EFL_H_
-#include <deque>
-
-#include "base/memory/scoped_ptr.h"
-#include "content/public/browser/browser_context.h"
-#include "browser/javascript_dialog_manager_efl.h"
-#include "browser_context_efl.h"
-#include "eweb_view.h"
-#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
-#include "content/public/common/frame_navigate_params.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents_observer.h"
-#include "content/browser/web_contents/web_contents_impl.h"
-#include "url/gurl.h"
-#include "browser/favicon/favicon_downloader.h"
-#include "public/ewk_view.h"
-#include "ui/base/ime/text_input_type.h"
-
-class DidPrintPagesParams;
-class Ewk_Wrt_Message_Data;
+#include "eweb_view.h"
+#include "private/ewk_manifest_private.h"
+#include "public/ewk_view_internal.h"
+#include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
+
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "third_party/blink/public/common/mediastream/media_devices.h"
+#endif
+
class JavaScriptDialogManagerEfl;
namespace content {
-struct DateTimeSuggestion;
-class WebContentsDelegateEfl
- : public WebContentsDelegate,
- public WebContentsObserver {
+class WebContentsObserverEfl;
+
+class WebContentsDelegateEfl : public WebContentsDelegate {
public:
WebContentsDelegateEfl(EWebView*);
~WebContentsDelegateEfl();
- virtual WebContents* OpenURLFromTab(WebContents* source,
- const content::OpenURLParams& params) override;
- virtual void NavigationStateChanged(WebContents* source,
- InvalidateTypes changed_flags) override;
-
- virtual void LoadProgressChanged(WebContents* source, double progress) override;
- virtual void LoadingStateChanged(WebContents* source,
- bool to_different_document) override;
-
- virtual bool ShouldCreateWebContents(
- WebContents*,
- int route_id,
- int main_frame_route_id,
- WindowContainerType,
- const base::string16& frame_name,
+ WebContentsDelegateEfl(const WebContentsDelegateEfl&) = delete;
+ WebContentsDelegateEfl& operator=(const WebContentsDelegateEfl&) = delete;
+
+ // WebContentsDelegate overrides.
+ WebContents* OpenURLFromTab(WebContents* source,
+ const OpenURLParams& params) override;
+ void NavigationStateChanged(WebContents* source,
+ InvalidateTypes changed_flags) override;
+
+ void AddNewContents(WebContents* source,
+ std::unique_ptr<WebContents> new_contents,
+ const GURL& target_url,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& window_features,
+ bool user_gesture,
+ bool* was_blocked) override;
+ bool ShouldCreateWebContents(
+ WebContents* web_contents,
+ RenderFrameHost* opener,
+ SiteInstance* source_site_instance,
+ mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+ const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
- SessionStorageNamespace* session_storage_namespace) override;
-
- virtual void CloseContents(WebContents* source) override;
-
- void EnterFullscreenModeForTab(content::WebContents* web_contents,
- const GURL& origin,
- int display_id = 0) override;
- void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
-
- virtual bool IsFullscreenForTabOrPending(
- const WebContents* web_contents) const override;
-#if defined(TIZEN_MULTIMEDIA_SUPPORT)
- virtual bool CheckMediaAccessPermission(WebContents* web_contents,
- const GURL& security_origin,
- MediaStreamType type) override;
+ SessionStorageNamespace* session_storage_namespace);
- virtual void RequestMediaAccessPermission(
- WebContents* web_contents,
- const MediaStreamRequest& request,
- const MediaResponseCallback& callback) override;
-
- void RequestMediaAccessAllow(const MediaStreamRequest& request,
- const MediaResponseCallback& callback);
-
- void RequestMediaAccessDeny(const MediaStreamRequest& request,
- const MediaResponseCallback& callback);
-#endif
- void RegisterProtocolHandler(WebContents* web_contents,
- const std::string& protocol,
- const GURL& url,
- bool user_gesture) override;
+ void CloseContents(WebContents* source) override;
+ void EnterFullscreenModeForTab(
+ RenderFrameHost* requesting_frame,
+ const blink::mojom::FullscreenOptions& options) override;
+ void ExitFullscreenModeForTab(WebContents* web_contents) override;
+ bool IsFullscreenForTabOrPending(const WebContents* web_contents) override;
void FindReply(WebContents* web_contents,
int request_id,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) override;
+#if defined(TIZEN_TBM_SUPPORT)
+ void DidRenderOffscreenFrame(void* buffer) override;
+#endif
+ void DidRenderFrame() override;
+ void DidChangeInputType(bool is_password_input) override;
+
+ void OnGetMainFrameScrollbarVisible(int callback_id, bool visible) override;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ //Browser edge scroll
+ void DidEdgeScrollBy(const gfx::Point& offset, bool handled) override;
+ void MoveFocusToBrowser(int direction) override;
+ void NotifyDownloadableFontInfo(const std::string& scheme_id_uri,
+ const std::string& value,
+ const std::string& data,
+ int type) override;
+ void NotifyPlaybackState(int state,
+ int player_id,
+ const std::string& url,
+ const std::string& mime_type,
+ bool* media_resource_acquired,
+ std::string* translated_url,
+ std::string* drm_info) override;
+ void NotifyParentalRatingInfo(const std::string& info,
+ const std::string& url) override;
+ void NotifyAudioTracksCount(int player_id,
+ unsigned audio_tracks_count) override;
+ void WillDraw(int rotation, gfx::Size frame_data_output_size) override;
+#endif
+ void UpdateTooltipUnderCursor(const std::u16string& text) override;
- void RequestCertificateConfirm(WebContents* web_contents, int cert_error,
- const net::SSLInfo& ssl_info, const GURL& url, ResourceType resource_type,
- bool overridable,
+ void RequestCertificateConfirm(
+ WebContents* web_contents,
+ int cert_error,
+ const net::SSLInfo& ssl_info,
+ const GURL& url,
+ bool is_main_frame_request,
bool strict_enforcement,
- const base::Callback<void(bool)>& callback,
- CertificateRequestResultType* result);
-
+ base::OnceCallback<void(CertificateRequestResultType)> callback);
+
+ JavaScriptDialogManager* GetJavaScriptDialogManager(
+ WebContents* source) override;
+ void ActivateContents(WebContents* contents) override;
+ void OnUpdateSettings(const Ewk_Settings* settings);
+ void SetContentSecurityPolicy(const std::string& policy,
+ Ewk_CSP_Header_Type header_type);
+
+ void BackgroundColorReceived(int callback_id, SkColor bg_color) override;
+
+ void DidFirstVisuallyNonEmptyPaint();
+ void DidStartLoading();
+
+ bool DidAddMessageToConsole(WebContents* source,
+ blink::mojom::ConsoleMessageLevel level,
+ const std::u16string& message,
+ int32_t line_no,
+ const std::u16string& source_id) override;
+ void RunFileChooser(RenderFrameHost* render_frame_host,
+ scoped_refptr<FileSelectListener> listener,
+ const blink::mojom::FileChooserParams& params) override;
+ std::unique_ptr<ColorChooser> OpenColorChooser(
+ WebContents* web_contents,
+ SkColor color,
+ const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions);
+ bool PreHandleGestureEvent(WebContents* source,
+ const blink::WebGestureEvent& event) override;
+ void VisibleSecurityStateChanged(WebContents* source) override;
EWebView* web_view() const { return web_view_; }
WebContents& web_contents() const { return web_contents_; }
- virtual void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- bool is_error_page,
- bool is_iframe_srcdoc) override;
+ void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
+ void* user_data);
+ void OnAuthRequired(const std::string& realm,
+ const GURL& url,
+ LoginDelegateEfl* login_delegate);
- virtual void DidCommitProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) override;
+#if defined(TIZEN_MULTIMEDIA)
+ bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host,
+ const GURL& security_origin,
+ blink::mojom::MediaStreamType type) override;
- virtual void DidNavigateMainFrame(const LoadCommittedDetails& details,
- const FrameNavigateParams& params) override;
- virtual void DocumentOnLoadCompletedInMainFrame() override;
+ void RequestMediaAccessPermission(WebContents* web_contents,
+ const MediaStreamRequest& request,
+ MediaResponseCallback callback) override;
- virtual void DidNavigateAnyFrame(RenderFrameHost* render_frame_host,
- const LoadCommittedDetails& details,
- const FrameNavigateParams& params) override;
+ void RequestMediaAccessAllow(const MediaStreamRequest& request,
+ MediaResponseCallback callback);
- void OnAuthRequired(net::URLRequest* request,
- const std::string& realm,
- LoginDelegateEfl* login_delegate);
+ void RequestMediaAccessDeny(const MediaStreamRequest& request,
+ MediaResponseCallback callback);
+#endif
- virtual void DidFinishLoad(RenderFrameHost* render_frame_host,
- const GURL& validated_url) override;
-
- virtual void DidUpdateFaviconURL(const std::vector<FaviconURL>& candidates) override;
- virtual void DidDownloadFavicon(bool success, const GURL& icon_url, const SkBitmap& bitmap);
-
- void OnUpdateSettings(const Ewk_Settings *settings);
- void SetContentSecurityPolicy(const std::string& policy, Ewk_CSP_Header_Type header_type);
-
- JavaScriptDialogManager* GetJavaScriptDialogManager(WebContents* source) override;
-
- void DidFirstVisuallyNonEmptyPaint() override;
-
- bool OnMessageReceived(const IPC::Message& message) override;
- void OnPrintedMetafileReceived(const DidPrintPagesParams& params);
- void NavigationEntryCommitted(const LoadCommittedDetails& load_details) override;
- void RenderViewCreated(RenderViewHost* render_view_host) override;
- void RenderProcessGone(base::TerminationStatus status) override;
- bool AddMessageToConsole(WebContents* source,
- int32 level,
- const base::string16& message,
- int32 line_no,
- const base::string16& source_id) override;
- void RunFileChooser(WebContents* web_contents,
- const FileChooserParams& params) override;
- ColorChooser* OpenColorChooser(WebContents* web_contents, SkColor color,
- const std::vector<ColorSuggestion>& suggestions) override;
- void OpenDateTimeDialog(ui::TextInputType dialog_type,
- double dialog_value,
- double min,
- double max,
- double step,
- const std::vector<DateTimeSuggestion>& suggestions) override;
- bool PreHandleGestureEvent(WebContents* source,
- const blink::WebGestureEvent& event) override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void UpdateTargetURL(WebContents* source, const GURL& url) override;
+ void ShowInspectorPortInfo();
+ void NotifyFirstTimeStamp(unsigned long long timestamp,
+ int time_base_num,
+ int time_base_den) override;
+ void NotifyPESData(const std::string& buf,
+ unsigned int len,
+ int media_position) override;
+ void UpdateCurrentTime(double current_time) override;
+ void UpdateEventData(void* data) override;
+ void NotifySubtitleState(int state, double time_stamp) override;
+ void NotifySubtitlePlay(int active_track_id,
+ const std::string& url,
+ const std::string& lang) override;
+ void NotifySubtitleData(int track_id,
+ double time_stamp,
+ const std::string& data,
+ unsigned int size) override;
+ void NotifyMediaStateChanged(uint32_t type,
+ uint32_t previous,
+ uint32_t current) override;
+ bool IsHighBitRate() const override;
+ using MediaDeviceEnumeration =
+ std::array<blink::WebMediaDeviceInfoArray, NUM_MEDIA_DEVICE_TYPES>;
+ using EnumerationCallback =
+ base::OnceCallback<void(const MediaDeviceEnumeration&)>;
+ void GetMediaDeviceList(EnumerationCallback cb);
+ void VideoPlayingStatusReceived(bool is_playing, int callback_id) override;
+#endif
- private:
- void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
- void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data);
- void OnWrtPluginSyncMessage(const Ewk_Wrt_Message_Data& data,
- IPC::Message* reply);
+#if defined(TIZEN_AUTOFILL)
+ void UpdateAutofillIfRequired();
+#endif
+
+#if defined(TIZEN_AUTOFILL_FW)
+ void ResetLastInteractedElements();
+#endif
+ private:
+ void OnDidGetManifest(Ewk_View_Request_Manifest_Callback callback,
+ void* user_data,
+ const GURL& manifest_url,
+ blink::mojom::ManifestPtr manifest);
+#if BUILDFLAG(IS_TIZEN_TV)
+ void OnIsVideoPlayingGet(bool is_playing, int callback_id);
+#endif
+ void OnDidChangeFocusedNodeBounds(const gfx::RectF& focused_node_bounds);
EWebView* web_view_;
- bool is_fullscreen_;
+ bool is_fullscreen_ = false;
WebContents& web_contents_;
+#if BUILDFLAG(IS_TIZEN_TV)
+ std::string last_hovered_url_;
+#endif
- struct ContentSecurityPolicy {
- ContentSecurityPolicy(const std::string& p, Ewk_CSP_Header_Type type)
- : policy(p),
- header_type(type) {
- }
- std::string policy;
- Ewk_CSP_Header_Type header_type;
- };
-
- scoped_ptr<ContentSecurityPolicy> pending_content_security_policy_;
- bool document_created_;
- JavaScriptDialogManagerEfl* dialog_manager_;
- scoped_ptr<FaviconDownloader> favicon_downloader_;
- base::WeakPtrFactory<WebContentsDelegateEfl> weak_ptr_factory_;
- scoped_ptr<_Ewk_Certificate_Policy_Decision> certificate_policy_decision_;
-
- DISALLOW_COPY_AND_ASSIGN(WebContentsDelegateEfl);
-};
+ bool did_render_frame_ = false;
+ bool did_first_visually_non_empty_paint_ = false;
+
+ std::unique_ptr<WebContentsObserverEfl> contents_observer_;
+ void* ime_window_ = nullptr;
+ GURL last_visible_url_;
+ JavaScriptDialogManagerEfl* dialog_manager_ = nullptr;
+ int rotation_ = -1;
+ std::unique_ptr<_Ewk_Certificate_Policy_Decision>
+ certificate_policy_decision_;
+};
}
-#endif
+#endif // WEB_CONTENTS_DELEGATE_EFL_H_