bool IsSupportedMimeType(const std::string& mime_type) const;
+#if BUILDFLAG(IS_TIZEN_TV)
+ void RegisterJavascriptPluginMimeTypes(const std::string& mime_type);
+ bool IsSupportedJavascriptPluginMimeType(const std::string& mime_type) const;
+#endif
+
private:
friend struct base::LazyInstanceTraitsBase<MimeUtil>;
MimeTypes non_image_types_;
MimeTypes unsupported_text_types_;
MimeTypes javascript_types_;
+#if BUILDFLAG(IS_TIZEN_TV)
+ MimeTypes javascript_plugin_types_;
+#endif
};
MimeUtil::MimeUtil() {
IsSupportedNonImageMimeType(mime_type);
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void MimeUtil::RegisterJavascriptPluginMimeTypes(
+ const std::string& mime_types) {
+ std::stringstream stream(mime_types);
+ std::string mime_type;
+ while (std::getline(stream, mime_type, ','))
+ javascript_plugin_types_.insert(base::ToLowerASCII(mime_type));
+}
+
+bool MimeUtil::IsSupportedJavascriptPluginMimeType(
+ const std::string& mime_type) const {
+ return javascript_plugin_types_.find(base::ToLowerASCII(mime_type)) !=
+ javascript_plugin_types_.end();
+}
+#endif
+
// This variable is Leaky because it is accessed from WorkerPool threads.
static base::LazyInstance<MimeUtil>::Leaky g_mime_util =
LAZY_INSTANCE_INITIALIZER;
return g_mime_util.Get().IsSupportedMimeType(mime_type);
}
+#if BUILDFLAG(IS_TIZEN_TV)
+void RegisterJavascriptPluginMimeTypes(const std::string& mime_type) {
+ g_mime_util.Get().RegisterJavascriptPluginMimeTypes(mime_type);
+}
+
+bool IsSupportedJavascriptPluginMimeType(const std::string& mime_type) {
+ return g_mime_util.Get().IsSupportedJavascriptPluginMimeType(mime_type);
+}
+#endif
} // namespace blink
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MIME_UTIL_MIME_UTIL_H_
#include <string>
+#include "build/build_config.h"
#include "third_party/blink/public/common/common_export.h"
namespace blink {
// Convenience function.
bool BLINK_COMMON_EXPORT IsSupportedMimeType(const std::string& mime_type);
+#if BUILDFLAG(IS_TIZEN_TV)
+void BLINK_COMMON_EXPORT RegisterJavascriptPluginMimeTypes(const std::string&);
+bool BLINK_COMMON_EXPORT
+IsSupportedJavascriptPluginMimeType(const std::string&);
+#endif
} // namespace blink
// response time match from the network cache.
static void RegisterURLSchemeAsCodeCacheWithHashing(const WebString&);
#if BUILDFLAG(IS_TIZEN_TV)
- // Registers a non-HTTP URL scheme which can be sent CORS requests.
+ // Registers a non-HTTP URL scheme which can be sent CORS requests.
BLINK_EXPORT static void RegisterURLSchemeAsCORSEnabled(const WebString&);
#endif
// specified?
ReloadPluginOnAttributeChange(name);
} else if (name == html_names::kDataAttr) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (!MIMETypeRegistry::IsSupportedJavaScriptPluginMIMEType(service_type_))
+ url_ = StripLeadingAndTrailingHTMLSpaces(params.new_value);
+#else
SetUrl(StripLeadingAndTrailingHTMLSpaces(params.new_value));
+#endif
if (GetLayoutObject() && IsImageType()) {
SetNeedsPluginUpdate(true);
if (!image_loader_)
HTMLPlugInElement::ObjectContentType HTMLPlugInElement::GetObjectContentType()
const {
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (MIMETypeRegistry::IsSupportedJavaScriptPluginMIMEType(service_type_))
+ return ObjectContentType::kNone;
+#endif
String mime_type = service_type_;
KURL url = GetDocument().CompleteURL(url_);
if (mime_type.empty()) {
EqualIgnoringASCIICase(mime_type, "text/xsl"));
}
+#if BUILDFLAG(IS_TIZEN_TV)
+bool MIMETypeRegistry::IsSupportedJavaScriptPluginMIMEType(
+ const String& mime_type) {
+ return IsSupportedJavascriptPluginMimeType(ToASCIIOrEmpty(mime_type));
+}
+#endif
} // namespace blink
// Checks to see if a mime type is suitable for being loaded as plain text.
static bool IsPlainTextMIMEType(const String& mime_type);
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Check to see if a mime type is a valid registered JavaScript plugin mime
+ // type.
+ static bool IsSupportedJavaScriptPluginMIMEType(const String&);
+#endif
};
} // namespace blink
const char kApplicationType[] = "application-type";
// CORS enabled URL schemes
const char kCORSEnabledURLSchemes[] = "cors-enabled-url-schemes";
+// JS plugin mime types
+const char kJSPluginMimeTypes[] = "jsplugin-mime-types";
#endif
// Widget Info
CONTENT_EXPORT extern const char kApplicationType[];
// CORS enabled url schemes
CONTENT_EXPORT extern const char kCORSEnabledURLSchemes[];
+// JS plugin mime types
+CONTENT_EXPORT extern const char kJSPluginMimeTypes[];
#endif
CONTENT_EXPORT extern const char kTizenAppId[];
CONTENT_EXPORT extern const char kTizenAppVersion[];
IPC_MESSAGE_ROUTED0(EwkHostMsg_DidNotAllowScript)
#if BUILDFLAG(IS_TIZEN_TV)
+IPC_MESSAGE_CONTROL1(HbbtvMsg_RegisterJSPluginMimeTypes,
+ std::string /* mime types */)
+
IPC_MESSAGE_CONTROL1(HbbtvMsg_RegisterURLSchemesAsCORSEnabled,
std::string /* scheme */)
}
}
+void EWebContext::RegisterJSPluginMimeTypes(const Eina_List* mime_types_list) {
+ std::string mime_types;
+ const Eina_List* it;
+ const void* mime_type;
+ EINA_LIST_FOREACH(mime_types_list, it, mime_type) {
+ mime_types += static_cast<const char*>(mime_type);
+ mime_types += ",";
+ }
+ HbbtvWidgetHost::Get().RegisterJSPluginMimeTypes(mime_types);
+}
+
void EWebContext::RegisterURLSchemesAsCORSEnabled(
const Eina_List* schemes_list) {
std::string schemes;
#if BUILDFLAG(IS_TIZEN_TV)
void SetApplicationType(const Ewk_Application_Type application_type);
Ewk_Application_Type GetApplicationType() const { return application_type_; }
+ void RegisterJSPluginMimeTypes(const Eina_List*);
void RegisterURLSchemesAsCORSEnabled(const Eina_List* schemes_list);
#endif
return impl->GetApplicationType();
}
+void Ewk_Context::RegisterJSPluginMimeTypes(const Eina_List* mime_types) {
+ impl->RegisterJSPluginMimeTypes(mime_types);
+}
+
void Ewk_Context::RegisterURLSchemesAsCORSEnabled(
const Eina_List* schemes_list) {
impl->RegisterURLSchemesAsCORSEnabled(schemes_list);
void SetApplicationType(const Ewk_Application_Type application_type);
Ewk_Application_Type GetApplicationType() const;
+ // Registers JS plugins mime types
+ void RegisterJSPluginMimeTypes(const Eina_List*);
// Registers url scheme as CORS enabled for HBBTV
void RegisterURLSchemesAsCORSEnabled(const Eina_List* schemes_list);
#endif
void ewk_context_register_jsplugin_mime_types(Ewk_Context* context, const Eina_List* mime_types)
{
- LOG_EWK_API_MOCKUP();
+#if BUILDFLAG(IS_TIZEN_TV)
+ EINA_SAFETY_ON_NULL_RETURN(context);
+ EINA_SAFETY_ON_NULL_RETURN(mime_types);
+ context->RegisterJSPluginMimeTypes(mime_types);
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV");
+#endif
}
void ewk_context_websdi_set(Eina_Bool enable)
#include "components/autofill/core/common/password_generation_util.h"
#endif
-#include "renderer/content_renderer_client_efl.h"
#include "common/navigation_policy_params.h"
#include "content/common/wrt/wrt_url_parse.h"
+#include "renderer/content_renderer_client_efl.h"
+#include "wrt/hbbtv_widget.h"
#include "wrt/wrtwidget.h"
#if BUILDFLAG(IS_TIZEN_TV)
content::RenderFrame* render_frame,
v8::Handle<v8::Context> context,
int world_id) {
- if (widget_) {
- widget_->StartSession(context, render_frame->GetRoutingID(),
- render_frame->GetWebFrame()
- ->GetDocument()
- .BaseURL()
- .GetString()
- .Utf8()
- .c_str());
+ if (!widget_)
+ return;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (widget_->GetType() == V8Widget::Type::HBBTV) {
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kJSPluginMimeTypes)) {
+ static_cast<HbbtvWidget*>(widget_.get())
+ ->RegisterJSPluginMimeTypes(
+ command_line.GetSwitchValueASCII(switches::kJSPluginMimeTypes));
+ }
}
+#endif
+
+ widget_->StartSession(context, render_frame->GetRoutingID(),
+ render_frame->GetWebFrame()
+ ->GetDocument()
+ .BaseURL()
+ .GetString()
+ .Utf8()
+ .c_str());
}
void ContentRendererClientEfl::WillReleaseScriptContext(
virtual bool InitRenderer(const std::string& injected_bundle_path);
// Interface for WebApp URL Conversion
- virtual void SetWidgetInfo(const std::string& tizen_app_id) {};
+ virtual void SetWidgetInfo(const std::string& tizen_app_id){};
virtual bool CanHandleParseUrl(const std::string& scheme) const = 0;
virtual void ParseURL(std::string* old_url,
std::string* new_url,
#include "common/render_messages_ewk.h"
#include "content/public/renderer/render_thread.h"
#include "content/renderer/render_thread_impl.h"
+#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "third_party/blink/public/web/web_security_policy.h"
#include "wrt/hbbtv_dynamicplugin.h"
bool OnControlMessageReceived(const IPC::Message& message) override {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(HbbtvRenderThreadObserver, message)
+ IPC_MESSAGE_FORWARD(HbbtvMsg_RegisterJSPluginMimeTypes, hbbtv_widget_,
+ HbbtvWidget::RegisterJSPluginMimeTypes)
IPC_MESSAGE_FORWARD(HbbtvMsg_RegisterURLSchemesAsCORSEnabled, hbbtv_widget_,
HbbtvWidget::RegisterURLSchemesAsCORSEnabled)
IPC_MESSAGE_UNHANDLED(handled = false)
return observer_.get();
}
+void HbbtvWidget::RegisterJSPluginMimeTypes(std::string mime_types) {
+ LOG(INFO) << "mime_types = " << mime_types;
+ blink::RegisterJavascriptPluginMimeTypes(mime_types);
+}
+
void HbbtvWidget::RegisterURLSchemesAsCORSEnabled(std::string schemes) {
LOG(INFO) << "schemes = " << schemes;
if (schemes_ == schemes)
~HbbtvWidget() override;
content::RenderThreadObserver* GetObserver() override;
+ void RegisterJSPluginMimeTypes(std::string);
void RegisterURLSchemesAsCORSEnabled(std::string scheme);
private:
return g_hbbtv_widget_host_getter.Get().Host();
}
+void HbbtvWidgetHost::RegisterJSPluginMimeTypes(const std::string& mime_types) {
+ if (mime_types_ == mime_types)
+ return;
+
+ LOG(INFO) << "mime types " << mime_types;
+ mime_types_ = mime_types;
+ SendToAllRenderers(new HbbtvMsg_RegisterJSPluginMimeTypes(mime_types));
+}
+
+const std::string& HbbtvWidgetHost::GetJSPluginMimeTypes() {
+ return mime_types_;
+}
+
void HbbtvWidgetHost::RegisterURLSchemesAsCORSEnabled(
const std::string& schemes) {
if (cors_enabled_url_schemes_ == schemes)
static HbbtvWidgetHost& Get();
~HbbtvWidgetHost();
+ void RegisterJSPluginMimeTypes(const std::string&);
+ const std::string& GetJSPluginMimeTypes();
+
void RegisterURLSchemesAsCORSEnabled(const std::string& schemes);
const std::string& GetCORSEnabledURLSchemes();
HbbtvWidgetHost();
std::string cors_enabled_url_schemes_;
+ std::string mime_types_;
friend class HbbtvWidgetHostGetter;
};