[XWalkExtension] Change a way to load XWalk extensions 19/290419/5
authorDongHyun Song <dh81.song@samsung.com>
Fri, 24 Mar 2023 07:12:29 +0000 (16:12 +0900)
committerBot Blink <blinkbot@samsung.com>
Thu, 30 Mar 2023 02:04:42 +0000 (02:04 +0000)
This will load all *.json from given base folder, not a
specific json file.

Change-Id: I8ddc154366308f4eece7a2d8e538d321b566c928
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
tizen_src/chromium_impl/components/xwalk_extensions/browser/xwalk_extension_manager.cc
tizen_src/chromium_impl/components/xwalk_extensions/browser/xwalk_extension_manager.h
tizen_src/ewk/efl_integration/common/content_switches_efl.cc
tizen_src/ewk/efl_integration/common/content_switches_efl.h
tizen_src/ewk/efl_integration/content_browser_client_efl.cc
tizen_src/ewk/efl_integration/content_main_delegate_efl.cc
tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.cc

index ace3201..7c66d67 100644 (file)
@@ -89,14 +89,12 @@ void XWalkExtensionManager::SetPreloadHandle(
   preload_handle_[lib_path] = handle;
 }
 
-void XWalkExtensionManager::LoadExtensionsByJsonPath(
-    const std::string& json_path) {
-  if (is_loaded_by_json_path_)
+void XWalkExtensionManager::LoadExtensionsByPath(const std::string& path) {
+  if (is_loaded_by_path_)
     return;
 
-  std::set<std::string> files;
-  ParseMetadata(json_path, &files, XWALK_EXTENSION_PATH);
-  is_loaded_by_json_path_ = true;
+  std::ignore = LoadExtensions(path);
+  is_loaded_by_path_ = true;
 }
 
 void XWalkExtensionManager::LoadUIAppExtensions() {
index 4714510..42cd809 100644 (file)
@@ -40,7 +40,7 @@ class XWalkExtensionManager : public mojom::XWalkExtensionBrowser {
 
   void ClearPreloadHandle(const std::string& lib_path);
   void GetRuntimeVariable(const char* key, char* value, size_t value_len);
-  void LoadExtensionsByJsonPath(const std::string& json_path);
+  void LoadExtensionsByPath(const std::string& path);
   void LoadUIAppExtensions();
   void LoadServiceAppExtensions();
   void LoadUserExtensions(const std::string& app_path);
@@ -108,7 +108,7 @@ class XWalkExtensionManager : public mojom::XWalkExtensionBrowser {
   virtual std::string HandleRuntimeMessageInternal(
       const std::string& type, const std::string& value);
 
-  bool is_loaded_by_json_path_ = false;
+  bool is_loaded_by_path_ = false;
   bool is_loaded_for_service_app_ = false;
   bool is_loaded_for_web_app_ = false;
 
index c8c3e05..0c43013 100644 (file)
@@ -36,7 +36,7 @@ const char kWidgetEncodedBundle[] = "widget-encoded-bundle";
 
 const char kEwkEnableMobileFeaturesForDesktop[] =
     "ewk-enable-mobile-features-for-desktop";
-const char kXWalkExtensionJsonPath[] = "xwalk-extension-json-path";
+const char kXWalkExtensionPath[] = "xwalk-extension-path";
 
 #if defined(TIZEN_PEPPER_EXTENSIONS)
 const char kEnableTrustedPepperPlugins[] = "enable-trusted-pepper-plugins";
index a608320..6270389 100644 (file)
@@ -36,7 +36,7 @@ CONTENT_EXPORT extern const char kTizenAppVersion[];
 CONTENT_EXPORT extern const char kWidgetScale[];
 CONTENT_EXPORT extern const char kWidgetTheme[];
 CONTENT_EXPORT extern const char kWidgetEncodedBundle[];
-CONTENT_EXPORT extern const char kXWalkExtensionJsonPath[];
+CONTENT_EXPORT extern const char kXWalkExtensionPath[];
 
 // Turns on a bunch of settings (mostly on blink::WebView) for which there is no
 // command line switches. This allows desktop "ubrowser --mobile" to have
index 9810adc..b4cd842 100644 (file)
@@ -650,7 +650,7 @@ void ContentBrowserClientEfl::ExposeInterfacesToRenderer(
     blink::AssociatedInterfaceRegistry* associated_registry,
     content::RenderProcessHost* render_process_host) {
   if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kXWalkExtensionJsonPath)) {
+          switches::kXWalkExtensionPath)) {
     return;
   }
 #if BUILDFLAG(IS_TIZEN)
index 08b3a35..57d6011 100644 (file)
@@ -99,13 +99,13 @@ void ContentMainDelegateEfl::PreSandboxStartupBrowser() {
   content::RegisterGpuMainThreadFactory(CreateInProcessGpuThread);
 
 #if BUILDFLAG(IS_TIZEN)
-  // switches::kXWalkExtensionJsonPath SHOULD be set before MainDelegate init.
-  auto json_path =
+  // switches::kXWalkExtensionPath SHOULD be set before MainDelegate init.
+  auto extension_path =
       base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
-          switches::kXWalkExtensionJsonPath);
-  if (!json_path.empty()) {
+          switches::kXWalkExtensionPath);
+  if (!extension_path.empty()) {
     auto* extension_manager = wrt::XWalkExtensionManager::GetInstance();
-    extension_manager->LoadExtensionsByJsonPath(json_path);
+    extension_manager->LoadExtensionsByPath(extension_path);
     extension_manager->PreloadExtensions();
     extension_manager->SetDelegate(
         std::make_unique<XWalkExtensionBrowserEfl>());
index c55cca8..110de26 100644 (file)
@@ -99,7 +99,7 @@ namespace {
 
 bool ShouldRegisterXWalkExtension(int world_id) {
   return world_id == 0 && base::CommandLine::ForCurrentProcess()->HasSwitch(
-                              switches::kXWalkExtensionJsonPath);
+                              switches::kXWalkExtensionPath);
 }
 
 #if defined(TIZEN_PEPPER_EXTENSIONS)
@@ -171,7 +171,7 @@ void ContentRendererClientEfl::RenderThreadStarted() {
     LocaleEfl::Initialize();
 
 #if BUILDFLAG(IS_TIZEN)
-  if (command_line.HasSwitch(switches::kXWalkExtensionJsonPath)) {
+  if (command_line.HasSwitch(switches::kXWalkExtensionPath)) {
     wrt::XWalkExtensionRendererController::GetInstance().SetPrivilegeChecker(
         base::BindRepeating([]() -> bool {
           // TODO(dh81.song)