Support function of set and get application type.
EWK_APPLICATION_TYPE_WEBBROWSER = 0,
EWK_APPLICATION_TYPE_HBBTV = 1,
EWK_APPLICATION_TYPE_TIZENWRT = 2,
EWK_APPLICATION_TYPE_OTHER = 3
Can distinguish application type in Chromium as:
IsWebBrowser
IsHbbTV
IsTizenWRT
References: https://review.tizen.org/gerrit/273943/
Change-Id: I8a0af3761f7ef1d46854e16b1abff11cda5d1147
Signed-off-by: Ayush Kumar <ayush.k123@samsung.com>
"web/web_window_features.h",
]
+ if (tizen_product_tv) {
+ sources += [ "platform/web_application_type.h" ]
+ }
+
if (is_mac) {
sources += [
"platform/mac/web_sandbox_support.h",
--- /dev/null
+// Copyright 2018 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_APPLICATION_TYPE_H_
+#define WEB_APPLICATION_TYPE_H_
+
+namespace blink {
+
+enum class ApplicationType : unsigned {
+ WEBBROWSER = 0,
+ HBBTV,
+ TIZENWRT,
+ OTHER
+};
+
+void SetApplicationType(const ApplicationType appType);
+bool IsWebBrowser();
+bool IsHbbTV();
+bool IsTIZENWRT();
+
+} // namespace blink
+
+#endif
import("//third_party/blink/renderer/config.gni")
import("//third_party/blink/renderer/platform/platform_generated.gni")
import("//v8/gni/v8.gni")
+if (use_efl) {
+ import(
+ "//tizen_src/chromium_impl/third_party/blink/renderer/platform/blink_platform_efl.gni")
+}
# Most targets in this file are private actions so use that as the default.
visibility = [
deps += [ "//third_party/libjxl:libjxl" ]
}
+ if (use_efl) {
+ sources += external_blink_platform_files
+ }
+
if (current_cpu == "x86" || current_cpu == "x64") {
deps += [ ":blink_x86_avx" ]
sources += [ "audio/cpu/x86/audio_delay_dsp_kernel_sse2.cc" ]
--- /dev/null
+# Copyright (c) 2023 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/features.gni")
+
+external_blink_platform_files = []
+
+if (tizen_product_tv) {
+ external_blink_platform_files += [ "//tizen_src/chromium_impl/third_party/blink/renderer/platform/web_application_type.cc" ]
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2018 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/blink/public/platform/web_application_type.h"
+
+namespace blink {
+
+namespace {
+ApplicationType s_applicationType = ApplicationType::WEBBROWSER;
+} // namespace
+
+void SetApplicationType(const ApplicationType appType) {
+ s_applicationType = appType;
+}
+
+bool IsWebBrowser() {
+ return s_applicationType == ApplicationType::WEBBROWSER;
+}
+
+bool IsHbbTV() {
+ return s_applicationType == ApplicationType::HBBTV;
+}
+
+bool IsTIZENWRT() {
+ return s_applicationType == ApplicationType::TIZENWRT;
+}
+
+} // namespace blink
"wrt/wrtwidget.h",
]
+ if (tizen_product_tv) {
+ sources += [
+ "common/application_type.cc",
+ "common/application_type.h",
+ ]
+ }
+
# FIXME: ewk_bringup definition should be removed.
if (!ewk_bringup) {
sources += [
--- /dev/null
+// Copyright 2018 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "common/application_type.h"
+
+#include "third_party/blink/public/platform/web_application_type.h"
+
+namespace content {
+
+// Make sure the enum values of content::ApplicationType and
+// blink::ApplicationType match.
+#define STATIC_ASSERT_ENUM_MATCH(name) \
+ static_assert( \
+ content::name == static_cast<content::ApplicationType>(blink::name), \
+ #name " value must match in content and blink.")
+
+STATIC_ASSERT_ENUM_MATCH(ApplicationType::WEBBROWSER);
+STATIC_ASSERT_ENUM_MATCH(ApplicationType::HBBTV);
+STATIC_ASSERT_ENUM_MATCH(ApplicationType::TIZENWRT);
+STATIC_ASSERT_ENUM_MATCH(ApplicationType::OTHER);
+
+void SetApplicationType(const ApplicationType app_type) {
+ blink::SetApplicationType(static_cast<blink::ApplicationType>(app_type));
+}
+
+bool IsWebBrowser() {
+ return blink::IsWebBrowser();
+}
+
+bool IsHbbTV() {
+ return blink::IsHbbTV();
+}
+
+bool IsTIZENWRT() {
+ return blink::IsTIZENWRT();
+}
+} // namespace content
--- /dev/null
+// Copyright 2018 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Define all the application type.
+#ifndef APPLICATION_TYPE_H_
+#define APPLICATION_TYPE_H_
+
+namespace content {
+
+enum class ApplicationType : unsigned {
+ WEBBROWSER = 0,
+ HBBTV,
+ TIZENWRT,
+ OTHER
+};
+
+void SetApplicationType(const ApplicationType app_type);
+bool IsWebBrowser();
+bool IsHbbTV();
+bool IsTIZENWRT();
+} // namespace content
+#endif // APPLICATION_TYPE_H_
const char kEnableViewMode[] = "enable-view-mode";
const char kInjectedBundlePath[] = "injected-bundle-path";
+#if BUILDFLAG(IS_TIZEN_TV)
+// Save ApplicationType in command line.
+const char kApplicationType[] = "application-type";
+#endif
+
// Widget Info
const char kTizenAppId[] = "widget-id";
const char kWidgetScale[] = "widget-scale";
// different modes using CSS Media Queries.
CONTENT_EXPORT extern const char kEnableViewMode[];
CONTENT_EXPORT extern const char kInjectedBundlePath[];
+#if BUILDFLAG(IS_TIZEN_TV)
+// Save ApplicationType in command line.
+CONTENT_EXPORT extern const char kApplicationType[];
+#endif
CONTENT_EXPORT extern const char kTizenAppId[];
CONTENT_EXPORT extern const char kWidgetScale[];
CONTENT_EXPORT extern const char kWidgetTheme[];
return browser_main_parts;
}
+void ContentBrowserClientEfl::AppendExtraCommandLineSwitchesInternal(
+ base::CommandLine* command_line,
+ int child_process_id) {
+ if (!command_line->HasSwitch(switches::kProcessType))
+ return;
+
+ if (command_line->GetSwitchValueASCII(switches::kProcessType) !=
+ switches::kRendererProcess)
+ return;
+
+ content::RenderProcessHost* host =
+ content::RenderProcessHost::FromID(child_process_id);
+ if (!host)
+ return;
+
+ EWebContext* context =
+ static_cast<BrowserContextEfl*>(host->GetBrowserContext())->WebContext();
+ if (!context)
+ return;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ Ewk_Application_Type application_type = context->GetApplicationType();
+ command_line->AppendSwitchASCII(
+ switches::kApplicationType,
+ base::NumberToString(static_cast<int>(application_type)));
+#endif
+
+ const std::string& injectedBundlePath = context->GetInjectedBundlePath();
+ if (injectedBundlePath.empty())
+ return;
+
+ command_line->AppendSwitchASCII(switches::kInjectedBundlePath,
+ injectedBundlePath);
+
+ const std::string& tizen_app_id = context->GetTizenAppId();
+ command_line->AppendSwitchASCII(switches::kTizenAppId, tizen_app_id);
+
+ double scale = context->GetWidgetScale();
+ command_line->AppendSwitchASCII(switches::kWidgetScale,
+ base::NumberToString(scale));
+
+ const std::string& widget_theme = context->GetWidgetTheme();
+ command_line->AppendSwitchASCII(switches::kWidgetTheme, widget_theme);
+
+ const std::string& widget_encoded_bundle = context->GetWidgetEncodedBundle();
+ command_line->AppendSwitchASCII(switches::kWidgetEncodedBundle,
+ widget_encoded_bundle);
+}
+
void ContentBrowserClientEfl::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
- if (command_line->HasSwitch(switches::kProcessType)) {
- std::string processType =
- command_line->GetSwitchValueASCII(switches::kProcessType);
- if (processType == switches::kRendererProcess) {
- if (content::RenderProcessHost* host =
- content::RenderProcessHost::FromID(child_process_id)) {
- if (EWebContext* context =
- static_cast<BrowserContextEfl*>(host->GetBrowserContext())
- ->WebContext()) {
- const std::string& injectedBundlePath =
- context->GetInjectedBundlePath();
- if (!injectedBundlePath.empty()) {
- command_line->AppendSwitchASCII(switches::kInjectedBundlePath,
- injectedBundlePath);
-
- const std::string& tizen_app_id = context->GetTizenAppId();
- command_line->AppendSwitchASCII(
- switches::kTizenAppId, tizen_app_id);
-
- double scale = context->GetWidgetScale();
- command_line->AppendSwitchASCII(switches::kWidgetScale,
- base::NumberToString(scale));
-
- const std::string& widget_theme = context->GetWidgetTheme();
- command_line->AppendSwitchASCII(switches::kWidgetTheme,
- widget_theme);
-
- const std::string& widget_encoded_bundle =
- context->GetWidgetEncodedBundle();
- command_line->AppendSwitchASCII(switches::kWidgetEncodedBundle,
- widget_encoded_bundle);
- }
- }
- }
- }
- }
+ AppendExtraCommandLineSwitchesInternal(command_line, child_process_id);
CommandLineEfl::AppendProcessSpecificArgs(*command_line);
}
const GURL& target_url);
void NotifyAcceptLangsChanged();
+ void AppendExtraCommandLineSwitchesInternal(base::CommandLine* command_line,
+ int child_process_id);
BrowserMainPartsEfl* browser_main_parts_efl_;
#include "content_browser_client_efl.h"
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "common/application_type.h"
+#endif
+
using content::BrowserThread;
using content::BrowserContext;
using content::BrowserContextEfl;
injected_bundle_handle_(nullptr),
#endif
widget_scale_(0),
+#if BUILDFLAG(IS_TIZEN_TV)
+ application_type_(EWK_APPLICATION_TYPE_WEBBROWSER),
+#endif
m_pixmap(0),
inspector_server_(NULL) {
#if BUILDFLAG(IS_TIZEN)
resource_context_efl->SetInterceptRequestCallback(ewk_context, callback,
user_data);
}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void EWebContext::SetApplicationType(
+ const Ewk_Application_Type application_type) {
+ application_type_ = application_type;
+ switch (application_type) {
+ case EWK_APPLICATION_TYPE_WEBBROWSER:
+ content::SetApplicationType(content::ApplicationType::WEBBROWSER);
+ break;
+ case EWK_APPLICATION_TYPE_HBBTV:
+ content::SetApplicationType(content::ApplicationType::HBBTV);
+ break;
+ case EWK_APPLICATION_TYPE_TIZENWRT:
+ content::SetApplicationType(content::ApplicationType::TIZENWRT);
+ break;
+ case EWK_APPLICATION_TYPE_OTHER:
+ content::SetApplicationType(content::ApplicationType::OTHER);
+ break;
+ default:
+ LOG(ERROR) << "Invalid application type. set application type WEBBROWSER "
+ "as default !!";
+ application_type_ = EWK_APPLICATION_TYPE_WEBBROWSER;
+ content::SetApplicationType(content::ApplicationType::WEBBROWSER);
+ break;
+ }
+}
+#endif
Ewk_Context_Intercept_Request_Callback callback,
void* user_data);
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetApplicationType(const Ewk_Application_Type application_type);
+ Ewk_Application_Type GetApplicationType() const { return application_type_; }
+#endif
+
private:
EWebContext(bool incognito);
EWebContext(const std::string& injectedBundlePath);
std::unique_ptr<EwkDidStartDownloadCallback> start_download_callback_;
std::unique_ptr<EwkMimeOverrideCallback> mime_override_callback_;
int m_pixmap;
+#if BUILDFLAG(IS_TIZEN_TV)
+ Ewk_Application_Type application_type_;
+#endif
+
content::DevToolsDelegateEfl* inspector_server_;
std::unique_ptr<EWebContextNotificationCallback> notification_cb_;
};
void* user_data) {
impl->SetInterceptRequestCallback(this, callback, user_data);
}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void Ewk_Context::SetApplicationType(
+ const Ewk_Application_Type application_type) {
+ impl->SetApplicationType(application_type);
+}
+
+Ewk_Application_Type Ewk_Context::GetApplicationType() const {
+ return impl->GetApplicationType();
+}
+#endif
Ewk_Context_Intercept_Request_Callback callback,
void* user_data);
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Application Type
+ void SetApplicationType(const Ewk_Application_Type application_type);
+ Ewk_Application_Type GetApplicationType() const;
+#endif
+
private:
EWebContext* impl;
LOG_EWK_API_MOCKUP();
}
-void ewk_context_application_type_set(Ewk_Context* ewkContext, const Ewk_Application_Type applicationType) {
- LOG_EWK_API_MOCKUP();
-}
-
Eina_Bool ewk_context_pwa_storage_path_set(Ewk_Context* context, const char* pwa_storage_path) {
LOG_EWK_API_MOCKUP();
return EINA_FALSE;
double zoom_factor) {
LOG_EWK_API_MOCKUP();
}
+
+void ewk_context_application_type_set(
+ Ewk_Context* ewkContext,
+ const Ewk_Application_Type applicationType) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ EINA_SAFETY_ON_NULL_RETURN(ewkContext);
+ LOG(INFO) << "Set current application type: " << applicationType;
+ ewkContext->SetApplicationType(applicationType);
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV");
+#endif
+}
+
+Ewk_Application_Type ewk_context_application_type_get(Ewk_Context* ewkContext) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, EWK_APPLICATION_TYPE_OTHER);
+ LOG(INFO) << "Get current application type: "
+ << ewkContext->GetApplicationType();
+ return ewkContext->GetApplicationType();
+#else
+ LOG_EWK_API_MOCKUP("Only for Tizen TV");
+ return EWK_APPLICATION_TYPE_OTHER;
+#endif
+}
#include "content/common/wrt/wrt_url_parse.h"
#include "wrt/wrtwidget.h"
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "common/application_type.h"
+#endif
+
#if defined(TIZEN_AUTOFILL_SUPPORT)
using autofill::AutofillAgent;
using autofill::PasswordAutofillAgent;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (command_line.HasSwitch(switches::kApplicationType)) {
+ std::string type =
+ command_line.GetSwitchValueASCII(switches::kApplicationType);
+ int app_type = 0;
+ base::StringToInt(type, &app_type);
+ LOG(INFO) << "Sync application type for render thread: " << app_type;
+ content::SetApplicationType(
+ static_cast<content::ApplicationType>(app_type));
+ }
+#endif
+
if (command_line.HasSwitch(switches::kInjectedBundlePath)) {
std::string tizen_app_id =
command_line.GetSwitchValueASCII(switches::kTizenAppId);