Support the new requirement of floating video window for WebBrowser.
- Provide an api of ewk_view_floating_window_state_changed.
Notify WebEngine the status that floating video window is on/off.
If floating video window existed, but not current webView,
For tabs switching case, in order to keep floating video window,
need to prevent media resume.
- Provide "notify,video,resized" for video rect notification.
WebEngine notify WebBrowser playing video dimension in normal webview
through which mini tab button is displayed at correct location on video.
- Appended the document url to the paramater of "video,playing,url".
In case video is playing inside an iframe, document URL provides
URL loaded in iFrame to identify which document is playing video.
- Allow to run the insecure content from localhost,
that are http://127.0.0.1 and http://localhost.
refs:
https://review.tizen.org/gerrit/283144/
Change-Id: I3c8c0f4c2279e4cadcba471250a2e6e1c67729c6
Signed-off-by: qiang.ji <qiang.ji@samsung.com>
void RenderWidgetHostImpl::ResetLastInteractedElements() {
blink_widget_->ResetLastInteractedElements();
}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void RenderWidgetHostImpl::SetFloatVideoWindowState(bool enabled) {
+ blink_widget_->SetFloatVideoWindowState(enabled);
+}
+#endif
#endif
blink::VisualProperties RenderWidgetHostImpl::GetInitialVisualProperties() {
void RequestSelectionRect();
void OnGetSelectionRect(const gfx::Rect& rect);
void ResetLastInteractedElements();
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetFloatVideoWindowState(bool enabled);
+#endif
#endif
// Returns true if the RenderWidget is hidden.
blink::WebNavigationPolicy default_policy,
bool is_redirect);
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual bool HasFloatingVideoWindowOn() const { return false; }
+#endif
// Notifies the embedder that the given frame is requesting the resource at
// |url|. If the function returns a valid |new_url|, the request must be
[EnableIf=is_efl]
RequestSelectionRect() => (gfx.mojom.Rect rect);
+ [EnableIf=is_tizen_tv]
+ SetFloatVideoWindowState(bool enabled);
+
// Informs the widget that it was hidden. This allows it to reduce its
// resource utilization, and will cancel any pending
// RecordContentToVisibleTimeRequest that was set with WasShown or
virtual gfx::Rect CurrentSelectionRect() const = 0;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void SetFloatVideoWindowState(bool enable) = 0;
+#endif
+
protected:
~WebView() = default;
};
// the layers.
virtual void InvalidateContainer() {}
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Floating Video Window
+ virtual bool HasFloatingVideoWindowOn() const { return false; }
+#endif
+
// UI ------------------------------------------------------------------
// Called when the View has changed size as a result of an auto-resize.
observers_.RemoveObserver(observer);
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebViewImpl::SetFloatVideoWindowState(bool enable) {
+ if (!GetPage())
+ return;
+
+ LOG(INFO) << __FUNCTION__ << " enable : " << enable;
+ GetPage()->SetFloatVideoWindowState(enable);
+}
+#endif
+
void WebViewImpl::SetIsActive(bool active) {
if (GetPage())
GetPage()->GetFocusController().SetActive(active);
void AddObserver(WebViewObserver* observer);
void RemoveObserver(WebViewObserver* observer);
+#if defined(OS_TIZEN_TV_PRODUCT)
+ void SetFloatVideoWindowState(bool) override;
+#endif // OS_TIZEN_TV_PRODUCT
+
// `BaseBackgroundColor()` affects how the document is rendered.
// `BackgroundColor()` is what the document computes as its background color
// (with `BaseBackgroundColor()` as an input), or `BaseBackgroundColor()` if
local_frame->HasVerticalScrollbar();
return true;
}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebFrameWidgetImpl::SetFloatVideoWindowState(bool enabled) {
+ View()->SetFloatVideoWindowState(enabled);
+}
+#endif
#endif
#if BUILDFLAG(IS_TIZEN)
void SelectClosestWord(uint32_t x, uint32_t y) override;
void SelectFocusedLink() override;
gfx::Rect RequestSelectionRect() override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetFloatVideoWindowState(bool enabled) override;
+#endif
#endif
void OrientationChanged() override;
tracks_are_ready_(true),
processing_preference_change_(false),
was_always_muted_(true),
+#if BUILDFLAG(IS_TIZEN_TV)
+ is_deactivate_(false),
+#endif
#if defined(TIZEN_MULTIMEDIA)
suspended_by_player_(false),
#endif
absl::optional<DOMExceptionCode> exception_code =
autoplay_policy_->RequestPlay();
+#if BUILDFLAG(IS_TIZEN_TV)
+ is_deactivate_ = false;
+#endif
if (exception_code == DOMExceptionCode::kNotAllowedError) {
// If we're already playing, then this play would do nothing anyway.
element_->AttachToNewFrame();
}
+#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+void HTMLMediaElement::MediaPlayerHidden() {
+ LOG(INFO) << "Media player hidden: " << this;
+ // TODO(m.debski): It should store periodic timers and restore on shown.
+ // Currently they will still fire, but will return immediately.
+ suppress_events_ = true;
+}
+
+void HTMLMediaElement::MediaPlayerShown() {
+ LOG(INFO) << "Media player shown: " << this;
+ suppress_events_ = false;
+}
+
+void HTMLMediaElement::Suspend() {
+ LOG(INFO) << "Suspend(" << (void*)this << ")";
+ if (!GetWebMediaPlayer())
+ return;
+
+#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+ if (media_source_attachment_) {
+ // Send suspend event to the source before WebMediaPlayer suspends backend.
+ media_source_attachment_->OnSuspend(media_source_tracer_);
+ }
+#endif // SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE
+
+ GetWebMediaPlayer()->Suspend();
+}
+
+void HTMLMediaElement::Resume() {
+ LOG(INFO) << "Resume(" << (void*)this << ")";
+ if (!GetWebMediaPlayer())
+ return;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ // IsViewResumedByTabSwitching, return true on the tab which has no
+ // floatwindow, otherwise it is false
+ if (GetDocument().GetPage() &&
+ GetDocument().GetPage()->IsViewResumedByTabSwitching()) {
+ GetWebMediaPlayer()->Deactivate();
+ LOG(INFO) << "is_deactivate_ TRUE";
+ is_deactivate_ = true;
+ } else if (is_deactivate_) {
+ GetWebMediaPlayer()->Activate();
+ LOG(INFO) << "is_deactivate_ FALSE";
+ is_deactivate_ = false;
+ }
+#endif
+
+ GetWebMediaPlayer()->Resume();
+
+#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+ if (media_source_attachment_) {
+ // Send suspend event to the source after WebMediaPlayer resumes backend.
+ media_source_attachment_->OnResume(media_source_tracer_);
+ }
+#endif // SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE
+}
+
+void HTMLMediaElement::ActivatePlayer() {
+ if (!GetWebMediaPlayer())
+ return;
+
+ GetWebMediaPlayer()->Activate();
+}
+#endif
+
STATIC_ASSERT_ENUM(WebMediaPlayer::kReadyStateHaveNothing,
HTMLMediaElement::kHaveNothing);
STATIC_ASSERT_ENUM(WebMediaPlayer::kReadyStateHaveMetadata,
void SetAudioSinkId(const String&) override;
void SuspendForFrameClosed() override;
+#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+ void MediaPlayerHidden() final;
+ void MediaPlayerShown() final;
+ void Suspend();
+ void Resume();
+ void NotifyPlayingUrl();
+#endif
+
void LoadTimerFired(TimerBase*);
void ProgressEventTimerFired();
void PlaybackProgressTimerFired();
// playback raters other than 1.0.
bool preserves_pitch_ = true;
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool is_deactivate_ : 1;
+#endif
+
+#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+ // This is to suppress stuff set to JS. Do not use it for other purposes.
+ bool suppress_events_ : 1;
+#endif
+
#if defined(TIZEN_MULTIMEDIA)
bool suspended_by_player_ : 1;
#endif
// with the 'persisted' property set to 'true'.
bool DispatchedPagehidePersistedAndStillHidden();
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Floating Video Window: record the page that has floating video window.
+ void SetFloatVideoWindowState(bool enable) { is_floating_page_ = enable; }
+ bool HasFloatingVideoWindowOn() const { return is_floating_page_; }
+#endif
+
static void PrepareForLeakDetection();
// Fully invalidate paint of all local frames in this page.
bool is_painting_ = false;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool is_floating_page_ = false;
+#endif
+
int subframe_count_;
HeapHashSet<WeakMember<PluginsChangedObserver>> plugins_changed_observers_;
}
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+void WidgetBase::SetFloatVideoWindowState(bool enabled) {
+ client_->SetFloatVideoWindowState(enabled);
+}
+#endif // IS_TIZEN_TV
+
void WidgetBase::WasHidden() {
// A provisional frame widget will never be hidden since that would require it
// to be shown first. A frame must be attached to the frame tree before
void SetMainFrameScrollbarVisible(bool visible) override;
void RequestMainFrameScrollbarVisible(
RequestMainFrameScrollbarVisibleCallback callback) override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetFloatVideoWindowState(bool enabled) override;
+#endif // IS_TIZEN_TV
void QueryInputType(QueryInputTypeCallback) override;
void SelectClosestWord(uint32_t x, uint32_t y) override;
void SelectFocusedLink() override;
virtual void SelectFocusedLink() {}
virtual gfx::Rect RequestSelectionRect() { return gfx::Rect(); }
virtual void ResetLastInteractedElements() {}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual bool IsHitScrollbar() { return false; }
+ virtual bool IsMouseDownEventSwallowed() { return false; }
+ virtual void SuspendNetworkLoading() {}
+ virtual void ResumeNetworkLoading() {}
+ virtual void SetFloatVideoWindowState(bool enabled) {};
+#endif // IS_TIZEN_TV
+
#endif
// Convert screen coordinates to device emulated coordinates (scaled
#endif
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void EWebView::SetFloatVideoWindowState(bool enabled) {
+ RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
+ web_contents_->GetRenderViewHost()->GetWidget());
+
+ rwhi->SetFloatVideoWindowState(enabled);
+}
+#endif // IS_TIZEN_TV
+
double EWebView::GetTextZoomFactor() const {
if (text_zoom_factor_ < 0.0)
return -1.0;
void Suspend();
void Resume();
void Stop();
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetFloatVideoWindowState(bool enabled);
+#endif // IS_TIZEN_TV
void SetSessionTimeout(uint64_t timeout);
double GetTextZoomFactor() const;
void SetTextZoomFactor(double text_zoom_factor);
#endif
}
-void ewk_view_floating_window_state_changed(const Evas_Object *o, Eina_Bool status)
+void ewk_view_floating_window_state_changed(const Evas_Object *view, Eina_Bool status)
{
#if BUILDFLAG(IS_TIZEN_TV)
- EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
+ EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
+ LOG(INFO) << __FUNCTION__ << ", view: "<< view << ", status: " << status;
+ impl->SetFloatVideoWindowState(status);
#else
LOG_EWK_API_MOCKUP();
#endif
blink::WebNavigationPolicy default_policy,
bool is_redirect) override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Floating Video Window
+ void SetFloatVideoWindowState(bool enable) {
+ floating_video_window_on_ = enable;
+ }
+ bool HasFloatingVideoWindowOn() const override {
+ return floating_video_window_on_;
+ }
+#endif
+
void DidCreateScriptContext(content::RenderFrame* render_frame,
v8::Handle<v8::Context> context,
int world_id);
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_reader_;
bool javascript_can_open_windows_ = true;
bool shutting_down_ = false;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool floating_video_window_on_ = false;
+#endif
};
#endif // CONTENT_RENDERER_CLIENT_EFL_H