#endif
#if BUILDFLAG(IS_TIZEN_TV)
+void RenderWidgetHostImpl::RequestVideoPlaying(int callback_id) {
+ if (!blink_widget_){
+ LOG(ERROR) << "blink_widget_ is null";
+ return;
+ }
+ blink_widget_->IsVideoPlaying(
+ base::BindOnce(&RenderWidgetHostImpl::OnGetVideoPlayingStatus,
+ weak_factory_.GetWeakPtr(), callback_id));
+}
+
+void RenderWidgetHostImpl::OnGetVideoPlayingStatus(int callback_id,
+ bool is_playing) {
+ if (!view_){
+ LOG(ERROR) << "view_ is null";
+ return;
+ }
+ view_->VideoPlayingStatusReceived(is_playing, callback_id);
+}
+
void RenderWidgetHostImpl::SetParentalRatingResult(const std::string& url,
bool is_pass) {
if (!blink_widget_){
void SetView(RenderWidgetHostViewBase* view);
#if BUILDFLAG(IS_TIZEN_TV)
+ void RequestVideoPlaying(int callback_id);
+ void OnGetVideoPlayingStatus(int callback_id, bool is_playing);
void SetTranslatedURL(const std::string& url);
void SetParentalRatingResult(const std::string& url, bool is_pass);
#endif
#endif
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void RenderWidgetHostViewAura::VideoPlayingStatusReceived(bool is_playing,
+ int callback_id) {
+ if (aura_efl_helper())
+ aura_efl_helper()->VideoPlayingStatusReceived(is_playing, callback_id);
+ else
+ LOG(ERROR) << "aura_efl_helper() is false";
+}
+#endif
+
void RenderWidgetHostViewAura::Hide() {
window_->Hide();
visibility_ = Visibility::HIDDEN;
bool GetIsMouseLockedUnadjustedMovementForTesting() override;
bool LockKeyboard(absl::optional<base::flat_set<ui::DomCode>> codes) override;
void UnlockKeyboard() override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ // notify web browser video playing status
+ void VideoPlayingStatusReceived(bool is_playing, int callback_id) override;
+#endif
bool IsKeyboardLocked() override;
base::flat_map<std::string, std::string> GetKeyboardLayoutMap() override;
void InvalidateLocalSurfaceIdAndAllocationGroup() override;
#if BUILDFLAG(IS_TIZEN_TV)
//Browser edge scroll
virtual void DidEdgeScrollBy(const gfx::Point& offset, bool handled) {}
+ // notify web browser video playing status
+ virtual void VideoPlayingStatusReceived(bool is_playing, int callback_id) {}
#endif
// Calls UpdateTooltip if the view is under the cursor.
virtual void ExitPictureInPicture() {}
#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void VideoPlayingStatusReceived(bool is_playing, int callback_id) {}
virtual void NotifyPlaybackState(int state,
int player_id,
const std::string& url,
ResetLastInteractedElements();
[EnableIf=is_tizen_tv]
+ IsVideoPlaying() => (bool is_video_playing);
+
+ [EnableIf=is_tizen_tv]
SetTranslatedURL(string url);
[EnableIf=is_tizen_tv]
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetFloatVideoWindowState(bool enable) = 0;
+ // Return if there is any active video in the view
+ virtual bool IsVideoPlaying() const = 0;
virtual void SetParentalRatingResult(const WebString&, bool) = 0;
#endif
return GetFrame() && GetFrame()->IsMainFrame();
}
+#if BUILDFLAG(IS_TIZEN_TV)
+bool Document::IsVideoPlaying() const {
+ if (GetExecutionContext())
+ return GetExecutionContext()->CheckVideoPlaying();
+
+ LOG(INFO) << "GetExecutionContext() is null";
+ return false;
+}
+#endif
+
bool Document::IsInOutermostMainFrame() const {
return GetFrame() && GetFrame()->IsOutermostMainFrame();
}
}
ExecutionContext* Document::GetExecutionContext() const {
- return execution_context_.Get();
+ if (execution_context_)
+ return execution_context_.Get();
+ else
+ return nullptr;
}
Agent& Document::GetAgent() const {
// See `Frame::IsMainFrame`.
bool IsInMainFrame() const;
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool IsVideoPlaying() const;
+#endif
+
// Returns true if this document has a frame and is an outermost main frame.
// See `Frame::IsOutermostMainFrame`.
bool IsInOutermostMainFrame() const;
state_observer->SetParentalRatingResult(is_pass);
});
}
+
+bool ExecutionContext::CheckVideoPlaying() const {
+ bool result = false;
+ ContextLifecycleNotifier::observers().ForEachObserver(
+ [&](ContextLifecycleObserver* observer) {
+ if (!observer->IsExecutionContextLifecycleObserver())
+ return;
+ if (static_cast<ExecutionContextLifecycleObserver*>(observer)
+ ->ObserverType() !=
+ ExecutionContextLifecycleObserver::kStateObjectType)
+ return;
+ ExecutionContextLifecycleStateObserver* state_observer =
+ static_cast<ExecutionContextLifecycleStateObserver*>(observer);
+ if (state_observer->HasVideo()) {
+#if DCHECK_IS_ON()
+ DCHECK_EQ(state_observer->GetExecutionContext(), Context());
+ DCHECK(state_observer->UpdateStateIfNeededCalled());
+#endif
+ if (state_observer->IsPlaying())
+ result = true;
+ }
+ });
+
+ return result;
+}
#endif
void ExecutionContext::AddConsoleMessageImpl(
virtual bool HasStorageAccess() const { return false; }
#if BUILDFLAG(IS_TIZEN_TV)
+ bool CheckVideoPlaying() const;
void SetTranslatedURL(const String&);
void SetParentalRatingResult(const String& url, bool is_pass);
#endif
virtual void ContextLifecycleStateChanged(
mojom::blink::FrameLifecycleState state) {}
+ virtual bool HasVideo() const { return false; }
#if BUILDFLAG(IS_TIZEN_TV)
+ virtual bool IsPlaying() const { return false; }
virtual bool IsHTMLMediaElement() const { return false; }
virtual String GetUrl() const { return ""; }
virtual void SetParentalRatingResult(bool) {}
+ virtual void SetTranslatedURL(const String&) {}
#endif
void SetExecutionContext(ExecutionContext*) override;
-#if BUILDFLAG(IS_TIZEN_TV)
- virtual void SetTranslatedURL(const String&) {}
-#endif
protected:
~ExecutionContextLifecycleStateObserver() override;
document->SetParentalRatingResult(url, is_pass);
}
}
+
+bool WebViewImpl::IsVideoPlaying() const {
+ if (!MainFrameImpl()){
+ LOG(ERROR) << "no main frame.";
+ return false;
+ }
+
+ for (const Frame* frame = MainFrameImpl()->GetFrame(); frame;
+ frame = frame->Tree().TraverseNext()) {
+ Document* document = To<LocalFrame>(frame)->GetDocument();
+ DCHECK(document);
+ if (document->IsVideoPlaying())
+ return true;
+ }
+ return false;
+}
#endif
} // namespace blink
gfx::Size MainFrameSize();
#if BUILDFLAG(IS_TIZEN_TV)
+ bool IsVideoPlaying() const override;
void SetParentalRatingResult(const WebString&, bool) override;
#endif
webview->SetParentalRatingResult(blink::WebString::FromUTF8(url.Ascii()),
is_pass);
}
+
+bool WebFrameWidgetImpl::IsVideoPlaying() {
+ WebViewImpl* webview = View();
+ if (!webview){
+ LOG(ERROR) << "no webview.";
+ return false;
+ }
+ return webview->IsVideoPlaying();
+}
#endif
void WebFrameWidgetImpl::SetNeedsRecalculateRasterScales() {
#if BUILDFLAG(IS_TIZEN_TV)
//Browser edge scroll
void EdgeScrollBy(const gfx::Point& offset, const gfx::Point& mouse_position) override;
+ // notify web browser video playing status
+ bool IsVideoPlaying() override;
void SetTranslatedURL(const WTF::String& url) override;
void SetParentalRatingResult(const WTF::String& url, bool is_pass) override;
#endif
// Returns true if the loaded media has a video track.
// Note that even an audio element can have video track in cases such as
// <audio src="video.webm">, in which case this function will return true.
- bool HasVideo() const;
+ bool HasVideo() const override;
// Returns true if loaded media has an audio track.
bool HasAudio() const;
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool IsPlaying() const override { return playing_; }
+#endif
+
// Whether the media element has encrypted audio or video streams.
bool IsEncrypted() const;
void WidgetBase::SetParentalRatingResult(const WTF::String& url, bool is_pass) {
client_->SetParentalRatingResult(url, is_pass);
}
+
+void WidgetBase::IsVideoPlaying(IsVideoPlayingCallback callback) {
+ std::move(callback).Run(client_->IsVideoPlaying());
+}
#endif // IS_TIZEN_TV
void WidgetBase::WasHidden() {
#if BUILDFLAG(IS_TIZEN_TV)
void SetTranslatedURL(const WTF::String& url) override;
+ void IsVideoPlaying(IsVideoPlayingCallback callback) override;
void SetParentalRatingResult(const WTF::String& url, bool is_pass) override;
#endif
#endif
#if BUILDFLAG(IS_TIZEN_TV)
+ virtual bool IsVideoPlaying() {}
virtual void SetTranslatedURL(const WTF::String& url) {}
virtual void SetParentalRatingResult(const WTF::String& url, bool is_pass) {}
#endif
LOG(ERROR) << "rwhv_aura_ is null";
}
+void RWHVAuraCommonHelperEfl::VideoPlayingStatusReceived(bool is_playing,
+ int callback_id) {
+ if (web_contents_ && web_contents_->GetDelegate())
+ web_contents_->GetDelegate()->VideoPlayingStatusReceived(is_playing,
+ callback_id);
+ else
+ LOG(ERROR) << "web_contents_ or web_contents_->GetDelegate() is null";
+}
+
+void RWHVAuraCommonHelperEfl::RequestVideoPlaying(int callback_id) {
+ if (rwhv_aura_)
+ rwhv_aura_->host()->RequestVideoPlaying(callback_id);
+ else
+ LOG(ERROR) << "rwhv_aura_ is null";
+}
+
void RWHVAuraCommonHelperEfl::SetPopupMenuVisible(const bool visible) {
NOTIMPLEMENTED();
}
void SetMouseEventsEnabled(bool enabled);
void SetTranslatedURL(const std::string& url);
void SetParentalRatingResult(const std::string& url, bool is_pass);
+ // notify web browser video playing status
+ void RequestVideoPlaying(int callback_id);
+ void VideoPlayingStatusReceived(bool is_playing, int callback_id);
#endif
void OnGestureEvent(ui::GestureEvent* event);
select_picker_.reset();
context_menu_.reset();
mhtml_callback_map_.Clear();
+#if BUILDFLAG(IS_TIZEN_TV)
+ is_video_playing_callback_map_.Clear();
+#endif
compositor_observer_.reset();
rwhva()->aura_efl_helper()->SetTranslatedURL(std::string(url));
LOG(INFO) << "translate_url:" << url;
}
+
+bool EWebView::IsVideoPlaying(Ewk_Is_Video_Playing_Callback callback,
+ void* user_data) {
+ IsVideoPlayingCallback* cb = new IsVideoPlayingCallback(callback, user_data);
+ int callback_id = is_video_playing_callback_map_.Add(cb);
+
+ if (!rwhva() || !rwhva()->aura_efl_helper()) {
+ LOG(ERROR) << "rwhva() or rwhva()->aura_efl_helper() is false";
+ return false;
+ }
+ rwhva()->aura_efl_helper()->RequestVideoPlaying(callback_id);
+ return true;
+}
+
+void EWebView::InvokeIsVideoPlayingCallback(bool is_playing, int callback_id) {
+ IsVideoPlayingCallback* callback =
+ is_video_playing_callback_map_.Lookup(callback_id);
+ if (!callback) {
+ LOG(INFO) << "callback is null";
+ return;
+ }
+
+ LOG(INFO) << __func__ << " ; is_playing : " << is_playing;
+ callback->Run(ewk_view(), is_playing);
+ is_video_playing_callback_map_.Remove(callback_id);
+}
#endif
void EWebView::RequestManifest(Ewk_View_Request_Manifest_Callback callback,
};
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+class IsVideoPlayingCallback {
+ public:
+ IsVideoPlayingCallback(Ewk_Is_Video_Playing_Callback func, void* user_data)
+ : func_(func), user_data_(user_data) {}
+ void Run(Evas_Object* obj, bool isplaying) {
+ if (func_) {
+ (func_)(obj, isplaying ? EINA_TRUE : EINA_FALSE, user_data_);
+ }
+ }
+
+ private:
+ Ewk_Is_Video_Playing_Callback func_;
+ void* user_data_;
+};
+#endif
+
class WebViewAsyncRequestHitTestDataCallback;
class JavaScriptDialogManagerEfl;
class PermissionPopupManager;
bool EdgeScrollBy(int delta_x, int delta_y);
void GetMousePosition(gfx::Point&);
void InvokeEdgeScrollByCallback(const gfx::Point&, bool);
+ // notify web browser video playing status
+ bool IsVideoPlaying(Ewk_Is_Video_Playing_Callback callback, void* user_data);
+ void InvokeIsVideoPlayingCallback(bool is_playing, int callback_id);
#endif
void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
MHTMLCallbackDetails;
base::IDMap<MHTMLCallbackDetails*> mhtml_callback_map_;
+#if BUILDFLAG(IS_TIZEN_TV)
+ base::IDMap<IsVideoPlayingCallback*> is_video_playing_callback_map_;
+#endif
+
typedef WebViewCallback<Ewk_View_Main_Frame_Scrollbar_Visible_Get_Callback,
bool>
MainFrameScrollbarVisibleGetCallback;
Eina_Bool ewk_view_is_video_playing(Evas_Object* o, Ewk_Is_Video_Playing_Callback callback, void* user_data)
{
- LOG_EWK_API_MOCKUP();
+#if BUILDFLAG(IS_TIZEN_TV)
+ EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
+ LOG(INFO) << __func__;
+ return impl->IsVideoPlaying(callback, user_data) ? EINA_TRUE : EINA_FALSE;
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV.");
return EINA_FALSE;
+#endif
}
Eina_Bool ewk_view_stop_video(Evas_Object* o, Ewk_Stop_Video_Callback callback, void* user_data)
*drm_info = data.at(2);
}
}
+
+void WebContentsDelegateEfl::OnIsVideoPlayingGet(bool is_playing,
+ int callback_id) {
+ if (web_view_)
+ web_view_->InvokeIsVideoPlayingCallback(is_playing, callback_id);
+ else
+ LOG(INFO) << "web_view_ is null";
+}
+
+void WebContentsDelegateEfl::VideoPlayingStatusReceived(bool is_playing,
+ int callback_id) {
+ if (web_view_)
+ web_view_->InvokeIsVideoPlayingCallback(is_playing, callback_id);
+ else
+ LOG(INFO) << "web_view_ is null";
+}
#endif
} // namespace content
using EnumerationCallback =
base::OnceCallback<void(const MediaDeviceEnumeration&)>;
void GetMediaDeviceList(EnumerationCallback cb);
+ void VideoPlayingStatusReceived(bool is_playing, int callback_id) override;
#endif
#if defined(TIZEN_AUTOFILL)
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_ = false;