1.implement ewk api ewk_media_set_parental_rating_result.
2.implement ewk callback api "on,parentalrating,info".
refer:
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/293483/
Change-Id: If9727683890cddcdb8bfdabbd098d46eb773b4e7
Signed-off-by: yangzhiwen <zw714.yang@samsung.com>
}
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+void RenderWidgetHostImpl::SetParentalRatingResult(const std::string& url,
+ bool is_pass) {
+ if (!blink_widget_){
+ LOG(ERROR) << "blink_widget_ is null";
+ return;
+ }
+ blink_widget_->SetParentalRatingResult(url, is_pass);
+}
+#endif
+
// static
const base::TimeDelta RenderWidgetHostImpl::kActivationNotificationExpireTime =
base::Milliseconds(300);
#if BUILDFLAG(IS_TIZEN_TV)
void SetTranslatedURL(const std::string& url);
+ void SetParentalRatingResult(const std::string& url, bool is_pass);
#endif
RenderWidgetHostDelegate* delegate() const { return delegate_; }
uint32_t previous,
uint32_t current) {}
virtual bool IsHighBitRate() const { return false; }
+ virtual void NotifyParentalRatingInfo(const std::string& info,
+ const std::string& url) {}
virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri,
const std::string& value,
const std::string& data,
#endif
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetContentMimeType(const std::string& mime_type) = 0;
+ virtual void SetParentalRatingResult(bool is_pass) = 0;
#endif
};
#endif
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type);
+ void SetParentalRatingResult(bool is_pass);
#endif
// |enabled_track_ids| contains track ids of enabled audio tracks.
if (shared_state_.renderer)
shared_state_.renderer->SetContentMimeType(mime_type_);
}
+
+void PipelineImpl::RendererWrapper::SetParentalRatingResult(bool is_pass) {
+ DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
+
+ if (shared_state_.renderer)
+ shared_state_.renderer->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "renderer is null";
+}
#endif
#if BUILDFLAG(IS_TIZEN_TV)
base::BindOnce(&RendererWrapper::SetContentMimeType,
base::Unretained(renderer_wrapper_.get()), mime_type));
}
+
+void PipelineImpl::SetParentalRatingResult(bool is_pass) {
+ DVLOG(2) << __func__;
+ DCHECK(thread_checker_.CalledOnValidThread());
+ renderer_wrapper_->SetParentalRatingResult(is_pass);
+}
#endif
+
void PipelineImpl::OnDurationChange(base::TimeDelta duration) {
DVLOG(2) << __func__;
DCHECK(thread_checker_.CalledOnValidThread());
void OnMetadata(const PipelineMetadata& metadata);
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type) override;
+ void SetParentalRatingResult(bool is_pass) override;
#endif
void OnBufferingStateChange(BufferingState state,
BufferingStateChangeReason reason);
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetContentMimeType(const std::string& mime_type) {}
+ virtual void SetParentalRatingResult(bool is_pass) {}
#endif
// Starts rendering from |time|.
#include "media/filters/pipeline_controller.h"
#include "base/functional/bind.h"
+#include "base/logging.h"
#include "media/base/demuxer.h"
namespace media {
if (pipeline_)
pipeline_->SetContentMimeType(mime_type);
}
+
+void PipelineController::SetParentalRatingResult(bool is_pass) {
+ if (pipeline_)
+ pipeline_->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "pipeline_ is null";
+}
#endif
} // namespace media
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type);
+ void SetParentalRatingResult(bool is_pass);
#endif
private:
// Attempts to make progress from the current state to the target state.
if (remote_renderer_.is_bound())
remote_renderer_->SetContentMimeType(mime_type);
}
+
+void MojoRenderer::SetParentalRatingResult(bool is_pass) {
+ DCHECK(task_runner_->RunsTasksInCurrentSequence());
+
+ if (remote_renderer_.is_bound())
+ remote_renderer_->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "remote_renderer is null";
+}
#endif
void MojoRenderer::OnWaiting(WaitingReason reason) {
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type) override;
+ void SetParentalRatingResult(bool is_pass) override;
#endif
private:
if (mojo_renderer_)
mojo_renderer_->SetContentMimeType(mime_type);
}
+
+void MojoRendererWrapper::SetParentalRatingResult(bool is_pass) {
+ if (mojo_renderer_)
+ mojo_renderer_->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "mojo_renderer_ is null";
+}
#endif
} // namespace media
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type) override;
+ void SetParentalRatingResult(bool is_pass) override;
#endif
base::TimeDelta GetMediaTime() override;
[EnableIf=is_tizen_tv]
SetContentMimeType(string mime_type);
+
+ [EnableIf=is_tizen_tv]
+ SetParentalRatingResult(bool is_pass);
};
// A Mojo equivalent of media::RendererClient. See media/mojo/README.md
if (renderer_)
renderer_->SetContentMimeType(mime_type);
}
+
+void MojoRendererService::SetParentalRatingResult(bool is_pass) {
+ DVLOG(3) << __func__;
+ if (renderer_)
+ renderer_->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "renderer_ is null";
+}
#endif
void MojoRendererService::OnBufferingStateChange(
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type) final;
+ void SetParentalRatingResult(bool is_pass) final;
#endif
private:
[EnableIf=is_tizen_tv]
SetTranslatedURL(string url);
+ [EnableIf=is_tizen_tv]
+ SetParentalRatingResult(string url, bool is_pass);
+
[EnableIf=is_efl]
PrintToPdf(uint32 width, uint32 height, mojo_base.mojom.FilePath filename);
// Adjusts the frame sink hierarchy for the media frame sink.
virtual void RegisterFrameSinkHierarchy() {}
virtual void UnregisterFrameSinkHierarchy() {}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void SetParentalRatingResult(bool is_pass) {}
+#endif
};
} // namespace blink
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetFloatVideoWindowState(bool enable) = 0;
+ virtual void SetParentalRatingResult(const WebString&, bool) = 0;
#endif
protected:
void Document::SetTranslatedURL(const String& url) {
GetExecutionContext()->SetTranslatedURL(url);
}
+
+void Document::SetParentalRatingResult(const String& url, bool is_pass) {
+ if (GetExecutionContext())
+ GetExecutionContext()->SetParentalRatingResult(url, is_pass);
+ else
+ LOG(ERROR) << "GetExecutionContext() is false";
+}
#endif
template class CORE_TEMPLATE_EXPORT Supplement<Document>;
bool IsSlotAssignmentDirty() const;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetParentalRatingResult(const String& url, bool is_pass);
+#endif
+
#if DCHECK_IS_ON()
unsigned& SlotAssignmentRecalcForbiddenRecursionDepth() {
return slot_assignment_recalc_forbidden_recursion_depth_;
state_observer->SetTranslatedURL(url);
});
}
+
+void ExecutionContext::SetParentalRatingResult(const String& url,
+ bool is_pass) {
+ 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 DCHECK_IS_ON()
+ DCHECK_EQ(state_observer->GetExecutionContext(), Context());
+ DCHECK(state_observer->UpdateStateIfNeededCalled());
+#endif
+ if (state_observer->IsHTMLMediaElement() &&
+ state_observer->GetUrl() == url)
+ state_observer->SetParentalRatingResult(is_pass);
+ });
+}
#endif
void ExecutionContext::AddConsoleMessageImpl(
#if BUILDFLAG(IS_TIZEN_TV)
void SetTranslatedURL(const String&);
+ void SetParentalRatingResult(const String& url, bool is_pass);
#endif
protected:
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
virtual void ContextLifecycleStateChanged(
mojom::blink::FrameLifecycleState state) {}
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual bool IsHTMLMediaElement() const { return false; }
+ virtual String GetUrl() const { return ""; }
+ virtual void SetParentalRatingResult(bool) {}
+#endif
+
void SetExecutionContext(ExecutionContext*) override;
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetTranslatedURL(const String&) {}
document->SetTranslatedURL(url);
}
}
+
+void WebViewImpl::SetParentalRatingResult(const WebString& url, bool is_pass) {
+ if (!MainFrameImpl()){
+ LOG(ERROR) << "no main frame.";
+ return;
+ }
+
+ for (const Frame* frame = MainFrameImpl()->GetFrame(); frame;
+ frame = frame->Tree().TraverseNext()) {
+ Document* document = To<LocalFrame>(frame)->GetDocument();
+ DCHECK(document);
+ document->SetParentalRatingResult(url, is_pass);
+ }
+}
#endif
} // namespace blink
gfx::Size Size();
gfx::Size MainFrameSize();
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetParentalRatingResult(const WebString&, bool) override;
+#endif
+
PageScaleConstraintsSet& GetPageScaleConstraintsSet() const;
gfx::Vector2dF ElasticOverscroll() const { return elastic_overscroll_; }
return;
webview->SetTranslatedURL(blink::WebString::FromUTF8(url.Ascii()));
}
+
+void WebFrameWidgetImpl::SetParentalRatingResult(const WTF::String& url,
+ bool is_pass) {
+ WebViewImpl* webview = View();
+ if (!webview){
+ LOG(ERROR) << "no webview.";
+ return;
+ }
+ webview->SetParentalRatingResult(blink::WebString::FromUTF8(url.Ascii()),
+ is_pass);
+}
#endif
void WebFrameWidgetImpl::SetNeedsRecalculateRasterScales() {
//Browser edge scroll
void EdgeScrollBy(const gfx::Point& offset, const gfx::Point& mouse_position) override;
void SetTranslatedURL(const WTF::String& url) override;
+ void SetParentalRatingResult(const WTF::String& url, bool is_pass) override;
#endif
// mojom::blink::FrameWidgetInputHandler overrides.
}
RequestReload(current_src_.GetSource());
}
+
+void HTMLMediaElement::SetParentalRatingResult(bool is_pass) {
+ LOG(INFO) << "setParentalRatingResult:" << BoolString(is_pass);
+ if (!GetWebMediaPlayer()) {
+ LOG(ERROR) << "setParentalRatingResult: mediaplayer not created";
+ return;
+ }
+ GetWebMediaPlayer()->SetParentalRatingResult(is_pass);
+}
#endif
bool HTMLMediaElement::HasPendingActivity() const {
WebString GetContentMIMEType() override;
void RequestReload(const KURL& new_url);
void SetTranslatedURL(const String&) override;
+ bool IsHTMLMediaElement() const override { return true; }
+ WTF::String GetUrl() const override { return current_src_.GetSource(); }
+ void SetParentalRatingResult(bool is_pass) override;
#endif
bool HasMediaSource() const { return media_source_attachment_.get(); }
UpdatePlayState();
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebMediaPlayerImpl::SetParentalRatingResult(bool is_pass) {
+ pipeline_controller_->SetParentalRatingResult(is_pass);
+}
+#endif
+
void WebMediaPlayerImpl::OnDurationChange() {
DCHECK(main_task_runner_->BelongsToCurrentThread());
media::BufferingState state,
media::BufferingStateChangeReason reason) override;
void OnDurationChange() override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetParentalRatingResult(bool is_pass) override;
+#endif
void OnWaiting(media::WaitingReason reason) override;
void OnAudioConfigChange(const media::AudioDecoderConfig& config) override;
void OnVideoConfigChange(const media::VideoDecoderConfig& config) override;
void WidgetBase::SetTranslatedURL(const WTF::String& url) {
client_->SetTranslatedURL(url);
}
+
+void WidgetBase::SetParentalRatingResult(const WTF::String& url, bool is_pass) {
+ client_->SetParentalRatingResult(url, is_pass);
+}
#endif // IS_TIZEN_TV
void WidgetBase::WasHidden() {
#if BUILDFLAG(IS_TIZEN_TV)
void SetTranslatedURL(const WTF::String& url);
+ void SetParentalRatingResult(const WTF::String& url, bool is_pass) override;
#endif
void WasHidden() override;
#if BUILDFLAG(IS_TIZEN_TV)
virtual void SetTranslatedURL(const WTF::String& url) {}
+ virtual void SetParentalRatingResult(const WTF::String& url, bool is_pass) {}
#endif
// Convert screen coordinates to device emulated coordinates (scaled
media_player_->SetContentMimeType(mime_type);
}
+void TizenRendererImpl::SetParentalRatingResult(bool is_pass) {
+ if (media_player_)
+ media_player_->SetParentalRatingResult(is_pass);
+ else
+ LOG(ERROR) << "media_player_ is null";
+}
+
bool TizenRendererImpl::PlaybackNotificationEnabled() {
content::WebContents* web_contents = GetWebContents();
if (!web_contents) {
#if BUILDFLAG(IS_TIZEN_TV)
void SetContentMimeType(const std::string& mime_type) override;
+ void SetParentalRatingResult(bool is_pass) override;
#endif
private:
web_contents_->GetDelegate()->DidEdgeScrollBy(offset, handled);
}
+void RWHVAuraCommonHelperEfl::SetParentalRatingResult(const std::string& url,
+ bool is_pass) {
+ if (rwhv_aura_)
+ rwhv_aura_->host()->SetParentalRatingResult(url, is_pass);
+ else
+ LOG(ERROR) << "rwhv_aura_ is null";
+}
+
void RWHVAuraCommonHelperEfl::SetPopupMenuVisible(const bool visible) {
NOTIMPLEMENTED();
}
void SetIMERecommendedWordsType(bool should_enable);
void SetMouseEventsEnabled(bool enabled);
void SetTranslatedURL(const std::string& url);
+ void SetParentalRatingResult(const std::string& url, bool is_pass);
#endif
void OnGestureEvent(ui::GestureEvent* event);
void SetMediaPlayerClient(MediaPlayerTizenClient* client) override {
client_ = client;
}
+ void SetParentalRatingResult(bool is_pass) override{};
#if defined(TIZEN_VIDEO_HOLE)
void SetVideoHole(bool is_video_hole) override;
if (blink::IsHbbTV() && CheckHighBitRate() && stream_type_ == DASH_STREAM)
AppendUrlHighBitRate(url_.spec());
player_prepared_ = false;
+
+ parental_rating_pass_ = true;
MediaPlayerBridgeCapi::Prepare();
if (GetMediaPlayerClient())
GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackReady, player_id_);
LOG(ERROR) << "HBBTV prePlay fail.";
return false;
}
+
+ if (blink::IsHbbTV() && !parental_rating_pass_) {
+ LOG(INFO) << "parental rating authenticatoin is not pass yet,waiting...";
+ delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
+ MediaPlayerBridgeCapi::ExecuteDelayedPlayerState();
+ return false;
+ }
+
if (!MediaPlayerBridgeCapi::Play())
return false;
if (GetMediaPlayerClient())
MediaPlayerBridgeCapi::OnHandlePlayerError(err_code, FROM_HERE);
}
+void MediaPlayerBridgeCapiTV::HandleParentalRatingInfo(const std::string& info,
+ const std::string& url) {
+ content::WebContentsDelegate* web_contents_delegate =
+ GetMediaPlayerClient()->GetWebContentsDelegate();
+ if (!web_contents_delegate){
+ LOG(ERROR) << "web_contents_delegate is null";
+ return;
+ }
+ web_contents_delegate->NotifyParentalRatingInfo(info, url);
+}
+
+void MediaPlayerBridgeCapiTV::SetParentalRatingResult(bool is_pass) {
+ LOG(INFO) << "ParentalRatingResult:" << std::boolalpha << is_pass;
+ parental_rating_pass_ = is_pass;
+
+ // if authentication fail, raise MEDIA_ERROR_DECODE
+ if (!parental_rating_pass_) {
+ OnHandlePlayerError(PLAYER_ERROR_INVALID_OPERATION, FROM_HERE);
+ return;
+ }
+
+ if (player_prepared_) {
+ LOG(INFO) << "player already prepared,execute play";
+ ExecuteDelayedPlayerState();
+ }
+}
} // namespace media
void OnPlayerPreloading();
void OnDrmError(int err_code, char* err_str);
+ void SetParentalRatingResult(bool is_pass) override;
+ void HandleParentalRatingInfo(const std::string& info,
+ const std::string& url);
protected:
void PlayerPrepared() override;
std::string hbbtv_url_{""}; // url_ + HIGHBITRATE(if mpd)
std::string mime_type_ = "";
bool is_live_stream_ = false;
+ bool parental_rating_pass_{false};
base::TimeDelta min_seekable_time_{base::TimeDelta()};
base::TimeDelta max_seekable_time_{base::TimeDelta()};
virtual void EnableTbmBufferCallback(bool enable) {}
virtual void SetAppInfo() {}
virtual void SetContentMimeType(const std::string& mime_type) {}
+ virtual void SetParentalRatingResult(bool is_pass) {}
};
} // namespace media
#include "devtools_port_manager.h"
#include "private/ewk_file_chooser_request_private.h"
#include "public/ewk_media_downloadable_font_info.h"
+#include "public/ewk_media_parental_rating_info.h"
#include "public/ewk_media_playback_info_product.h"
#include "public/ewk_user_media_internal.h"
#endif
const std::string& cert_path) {
web_contents_->AddDynamicCertificatePath(host, cert_path);
}
+
+void EWebView::NotifyParentalRatingInfo(const char* info, const char* url) {
+ LOG(INFO) << "info:" << info << ",url:" << url;
+ Ewk_Media_Parental_Rating_Info* data =
+ ewkMediaParentalRatingInfoCreate(info, url);
+ SmartCallback<EWebViewCallbacks::ParentalRatingInfo>().call(
+ static_cast<void*>(data));
+ ewkMediaParentalRatingInfoDelete(data);
+}
+
+void EWebView::SetParentalRatingResult(const char* url, bool is_pass) {
+ LOG(INFO) << "SetParentalRatingResult,url:" << url
+ << ",pass:" << std::boolalpha << is_pass;
+
+ if (!rwhva() || !rwhva()->aura_efl_helper()){
+ LOG(ERROR) << "rwhva() or rwhva()->aura_efl_helper() is false";
+ return;
+ }
+ rwhva()->aura_efl_helper()->SetParentalRatingResult(
+ static_cast<std::string>(url), is_pass);
+}
#endif
bool EWebView::SetVisibility(bool enable) {
std::array<blink::WebMediaDeviceInfoArray, NUM_MEDIA_DEVICE_TYPES>;
void OnDeviceListed(const MediaDeviceEnumeration& devices);
void SetTranslatedURL(const char* url);
+ void NotifyParentalRatingInfo(const char* info, const char* url);
+ void SetParentalRatingResult(const char* info, bool is_pass);
#endif // IS_TIZEN_TV
void SetDidChangeThemeColorCallback(
#if BUILDFLAG(IS_TIZEN_TV)
HoverOverLink,
HoverOutLink,
+ ParentalRatingInfo,
LoginFormSubmitted,
LoginFields,
DidBlockInsecureContent,
#endif // IS_TIZEN
#if BUILDFLAG(IS_TIZEN_TV)
+DECLARE_EWK_VIEW_CALLBACK(ParentalRatingInfo, "on,parentalrating,info", void*);
DECLARE_EWK_VIEW_CALLBACK(HoverOverLink, "hover,over,link", const char*);
DECLARE_EWK_VIEW_CALLBACK(HoverOutLink, "hover,out,link", const char*);
DECLARE_EWK_VIEW_CALLBACK(LoginFormSubmitted,
void ewk_media_set_parental_rating_result(Evas_Object* ewkView, const char* url, Eina_Bool is_pass)
{
- LOG_EWK_API_MOCKUP();
+#if BUILDFLAG(IS_TIZEN_TV)
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+ impl->SetParentalRatingResult(url, is_pass);
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV.");
+#endif
}
void ewk_media_start_with_high_bit_rate(Evas_Object* ewkView, Eina_Bool high_bitrate)
return web_view_ ? web_view_->IsHighBitRate() : false;
}
+void WebContentsDelegateEfl::NotifyParentalRatingInfo(const std::string& info,
+ const std::string& url) {
+ if (web_view_)
+ web_view_->NotifyParentalRatingInfo(info.c_str(), url.c_str());
+ else
+ LOG(ERROR) << "web_view_ is null";
+}
+
void WebContentsDelegateEfl::NotifyDownloadableFontInfo(
const std::string& scheme_id_uri,
const std::string& value,
bool* media_resource_acquired,
std::string* translated_url,
std::string* drm_info) override;
+ void NotifyParentalRatingInfo(const std::string& info,
+ const std::string& url) override;
#endif
void RequestCertificateConfirm(
WebContents* web_contents,