This interface set a path located xwalk extension json profile file.
- ewk_context_set_xwalk_extension_profile(context, path)
- i.e.,
ewk_context_set_xwalk_extension_profile(
ctx, "/usr/lib/tizen-extensions-crosswalk-ewk/");
Reference Patch:
https://review.tizen.org/gerrit/292805/
Change-Id: I2ddf3e6bdb2ebaf60bcbb360aa6b2a89e0d51b16
Signed-off-by: liwei90727 <wei90727.li@samsung.com>
#include "renderer/content_renderer_client_efl.h"
#include "ui/base/resource/resource_bundle.h"
-#if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
+#if BUILDFLAG(IS_TIZEN)
#include "components/xwalk_extensions/browser/xwalk_extension_manager.h"
#endif
// needed for gpu thread
content::RegisterGpuMainThreadFactory(CreateInProcessGpuThread);
-#if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
- // switches::kXWalkExtensionPath SHOULD be set before MainDelegate init.
+#if BUILDFLAG(IS_TIZEN)
auto extension_path =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kXWalkExtensionPath);
if (!extension_path.empty()) {
- auto* extension_manager = wrt::XWalkExtensionManager::GetInstance();
- extension_manager->LoadExtensionsByPath(extension_path);
- extension_manager->PreloadExtensions();
- extension_manager->SetDelegate(
- std::make_unique<XWalkExtensionBrowserEfl>());
+ // initialize by switch
+ InitializeXWalkExtensions(extension_path);
}
#endif
}
return browser_client_.get();
}
+#if BUILDFLAG(IS_TIZEN)
+void ContentMainDelegateEfl::InitializeXWalkExtensions(
+ const std::string& extension_path) {
+ auto* extension_manager = wrt::XWalkExtensionManager::GetInstance();
+ if (extension_manager->HasDelegate())
+ return;
+
+ extension_manager->LoadExtensionsByPath(extension_path);
+ extension_manager->PreloadExtensions();
+ extension_manager->SetDelegate(std::make_unique<XWalkExtensionBrowserEfl>());
+}
+#endif
+/* LCOV_EXCL_STOP */
+
#if BUILDFLAG(IS_TIZEN_TV)
void ContentMainDelegateEfl::ProcessExiting(const std::string& process_type) {
if (!enableInspector_)
ContentBrowserClient* GetContentBrowserClient() const;
+#if BUILDFLAG(IS_TIZEN)
+ void InitializeXWalkExtensions(const std::string& extension_path);
+#endif
#if BUILDFLAG(IS_TIZEN_TV)
void ProcessExiting(const std::string& process_type) override;
void SetInspectorStatus(bool enable);
#include "content/public/common/content_switches.h"
#include "content/public/common/zygote/zygote_handle.h"
#include "content_browser_client_efl.h"
+#include "content_main_delegate_efl.h"
#endif
#if BUILDFLAG(IS_TIZEN_TV)
base::NumberToString(max_refresh_rate));
#endif
}
+
+void EWebContext::SetXWalkExtensionProfile(const std::string& extension_path) {
+#if BUILDFLAG(IS_TIZEN)
+ auto& command_line = *base::CommandLine::ForCurrentProcess();
+ command_line.AppendSwitchASCII(switches::kXWalkExtensionPath, extension_path);
+ EwkGlobalData::GetInstance()
+ ->GetContentMainDelegateEfl()
+ .InitializeXWalkExtensions(extension_path);
+#endif
+}
void EnableAppControl(bool enabled);
void SetMaxRefreshRate(int max_refresh_rate);
+ void SetXWalkExtensionProfile(const std::string& extension_path);
private:
EWebContext(bool incognito, const std::string& injectedBundlePath);
void Ewk_Context::SetMaxRefreshRate(int max_refresh_rate) {
impl->SetMaxRefreshRate(max_refresh_rate);
}
+
+void Ewk_Context::SetXWalkExtensionProfile(const std::string& extension_path) {
+ impl->SetXWalkExtensionProfile(extension_path);
+}
void EnableAppControl(bool enabled);
void SetMaxRefreshRate(int max_refresh_rate);
+ void SetXWalkExtensionProfile(const std::string& extension_path);
private:
EWebContext* impl;
LOG_EWK_API_MOCKUP();
}
+void ewk_context_set_xwalk_extension_profile(Ewk_Context* ewk_context,
+ const char* extension_path) {
+ EINA_SAFETY_ON_NULL_RETURN(ewk_context);
+ LOG(INFO) << "extension_path : " << extension_path;
+ ewk_context->SetXWalkExtensionProfile(extension_path);
+}
+
Eina_Bool ewk_context_background_music_get(Ewk_Context* context)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(context, EINA_FALSE);