Add WebAuthDisplayQR, Response and MediaPermission 91/318391/1
authordongsug.song <dongsug.song@samsung.com>
Thu, 5 Sep 2024 12:23:00 +0000 (21:23 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Fri, 27 Sep 2024 07:51:32 +0000 (16:51 +0900)
Change-Id: Ia034489abd004c0080d772e84e0c797f5b30e985

dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h
dali/devel-api/adaptor-framework/web-engine/web-engine-user-media-permission-request.h [new file with mode: 0755]
dali/devel-api/adaptor-framework/web-engine/web-engine.cpp
dali/devel-api/adaptor-framework/web-engine/web-engine.h
dali/devel-api/file.list
dali/internal/web-engine/common/web-engine-impl.cpp
dali/internal/web-engine/common/web-engine-impl.h

index 8dbd584bd575cbf7606a79d6a89911ce15f2dcb3..a105b64344674e92013e211478fc8605ceb28986 100755 (executable)
@@ -47,6 +47,7 @@ class WebEnginePolicyDecision;
 class WebEngineSettings;
 class HoverEvent;
 class WheelEvent;
+class WebEngineUserMediaPermissionRequest;
 
 /**
  * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin.
@@ -205,6 +206,21 @@ public:
    */
   using PlainTextReceivedCallback = std::function<void(const std::string&)>;
 
+  /**
+   * @brief WebView callback informs browser app to display QB code popup for passkey scenario.
+   */
+  using WebEngineWebAuthDisplayQRCallback = std::function<void(const std::string&)>;
+
+  /**
+   * @brief WebView callback informs browser app that the passkey registration and authentication has been successful and app can close QR popup.
+   */
+  using WebEngineWebAuthResponseCallback = std::function<void(void)>;
+
+  /**
+   * @brief The callback to be called when the web engine received a user media permission reqeust from user application.
+   */
+  using WebEngineUserMediaPermissionRequestCallback = std::function<void(std::unique_ptr<Dali::WebEngineUserMediaPermissionRequest>, const std::string&)>;
+
   /**
    * @brief Enumeration for the scroll edge.
    */
@@ -952,6 +968,33 @@ public:
    * @param[in] callback The callback function called asynchronously.
    */
   virtual void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) = 0;
+
+  /**
+   * @brief Cancel WebAuthentication(cancel in progress passkey operation).
+   */
+  virtual void WebAuthenticationCancel() = 0;
+
+  /**
+   * @brief Register WebAuthDisplayQR callback.
+   *
+   * @param[in] callback The callback informs browser app to display QR code popup for passkey scenario.
+   */
+  virtual void RegisterWebAuthDisplayQRCallback(WebEngineWebAuthDisplayQRCallback callback) = 0;
+
+  /**
+   * @brief Register WebAuthResponse callback.
+   *
+   * @param[in] callback The callback informs browser app that the passkey registration and authentication has been successful and app can close QR popup.
+   */
+  virtual void RegisterWebAuthResponseCallback(WebEngineWebAuthResponseCallback callback) = 0;
+
+  /**
+   * @brief Register UserMediaPermissionRequest callback.
+   *
+   * @param[in] callback The callback to be called for handling user media permission.
+   */
+  virtual void RegisterUserMediaPermissionRequestCallback(WebEngineUserMediaPermissionRequestCallback callback) = 0;
+
 };
 
 // specialization has to be done in the same namespace
diff --git a/dali/devel-api/adaptor-framework/web-engine/web-engine-user-media-permission-request.h b/dali/devel-api/adaptor-framework/web-engine/web-engine-user-media-permission-request.h
new file mode 100755 (executable)
index 0000000..88e6ea9
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef DALI_WEB_ENGINE_USER_MEDIA_PERMISSION_REQUEST_H
+#define DALI_WEB_ENGINE_USER_MEDIA_PERMISSION_REQUEST_H
+
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+namespace Dali
+{
+/**
+ * @brief A class WebEngineUserMediaPermissionRequest for handling user's media permission of web engine.
+ */
+class WebEngineUserMediaPermissionRequest
+{
+public:
+  /**
+   * @brief Constructor.
+   */
+  WebEngineUserMediaPermissionRequest() = default;
+
+  /**
+   * @brief Destructor.
+   */
+  virtual ~WebEngineUserMediaPermissionRequest() = default;
+
+  /**
+   * @brief Request to set user media permission of web engine.
+   *
+   * @param[in] allowed if true, allow to set, false, not allow to set.
+   */
+  virtual void Set(bool allowed) const = 0;
+
+  /**
+   * @brief Suspend user media permission request process of web engine.
+   * @return true if the suspension was successful, false otherwise.
+   */
+  virtual bool Suspend() const = 0;
+};
+} // namespace Dali
+
+#endif // DALI_WEB_ENGINE_USER_MEDIA_PERMISSION_REQUEST_H
index 3549b507a699d4d93930b2ef3370ea17ce656e9e..482a83b26a1cb7c017613def63865884521a54fa 100755 (executable)
@@ -605,4 +605,24 @@ void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextRecei
   GetImplementation(*this).GetPlainTextAsynchronously(callback);
 }
 
+void WebEngine::WebAuthenticationCancel()
+{
+  GetImplementation(*this).WebAuthenticationCancel();
+}
+
+void WebEngine::RegisterWebAuthDisplayQRCallback(Dali::WebEnginePlugin::WebEngineWebAuthDisplayQRCallback callback)
+{
+  GetImplementation(*this).RegisterWebAuthDisplayQRCallback(callback);
+}
+
+void WebEngine::RegisterWebAuthResponseCallback(Dali::WebEnginePlugin::WebEngineWebAuthResponseCallback callback)
+{
+  GetImplementation(*this).RegisterWebAuthResponseCallback(callback);
+}
+
+void WebEngine::RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback)
+{
+  GetImplementation(*this).RegisterUserMediaPermissionRequestCallback(callback);
+}
+
 } // namespace Dali
index 8f8a8fb351cce2b2944ca267d5146e59430708a0..26aa6acc21bdee4e21e3d154283c46c1eb42d1e8 100755 (executable)
@@ -833,6 +833,35 @@ public:
    */
   void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
 
+  /**
+   * @brief Cancel WebAuthentication(cancel in progress passkey operation).
+   */
+  void WebAuthenticationCancel();
+
+  /**
+   * @brief Get a plain text of current web page asynchronously.
+   *
+   * @param[in] callback The callback function called asynchronously.
+
+   */
+  void RegisterWebAuthDisplayQRCallback(Dali::WebEnginePlugin::WebEngineWebAuthDisplayQRCallback callback);
+
+  /**
+   * @brief Get a plain text of current web page asynchronously.
+   *
+   * @param[in] callback The callback function called asynchronously.
+
+   */
+  void RegisterWebAuthResponseCallback(Dali::WebEnginePlugin::WebEngineWebAuthResponseCallback callback);
+
+  /**
+   * @brief Register UserMediaPermissionRequest callback.
+   *
+   * @param[in] callback The callback to be called for handling user media permission.
+   */
+  void RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback);
+
+
 private: // Not intended for application developers
   /**
    * @brief Internal constructor
index 94ded8bd5b7a01a94db345cfc900101018f0bc89..fff4c81b98a46a48261203d82f9240114b38a68a 100755 (executable)
@@ -158,6 +158,7 @@ SET( devel_api_adaptor_framework_web_engine_header_files
   ${adaptor_devel_api_dir}/adaptor-framework/web-engine/web-engine-request-interceptor.h
   ${adaptor_devel_api_dir}/adaptor-framework/web-engine/web-engine-security-origin.h
   ${adaptor_devel_api_dir}/adaptor-framework/web-engine/web-engine-settings.h
+  ${adaptor_devel_api_dir}/adaptor-framework/web-engine/web-engine-user-media-permission-request.h  
 )
 
 
index 79406420b9d5a53ed744aa9fb7c96eb0c40c0d63..f0276bfb081af6bce89f2dd045efe57f5d38b096 100644 (file)
@@ -815,6 +815,27 @@ void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextRecei
   mPlugin->GetPlainTextAsynchronously(callback);
 }
 
+void WebEngine::WebAuthenticationCancel()
+{
+  mPlugin->WebAuthenticationCancel();
+}
+
+void WebEngine::RegisterWebAuthDisplayQRCallback(Dali::WebEnginePlugin::WebEngineWebAuthDisplayQRCallback callback)
+{
+  mPlugin->RegisterWebAuthDisplayQRCallback(callback);
+}
+
+void WebEngine::RegisterWebAuthResponseCallback(Dali::WebEnginePlugin::WebEngineWebAuthResponseCallback callback)
+{
+  mPlugin->RegisterWebAuthResponseCallback(callback);
+}
+
+void WebEngine::RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback)
+{
+  mPlugin->RegisterUserMediaPermissionRequestCallback(callback);
+}
+
+
 } // namespace Adaptor
 } // namespace Internal
 } // namespace Dali
index 3e18f8d9f3f398b9474f7abe323fc0fbd40a5004..1fa0135ed74ed9f9b7683f9cf3679da6b7bca146 100755 (executable)
@@ -592,6 +592,26 @@ public:
    */
   void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
 
+  /**
+   * @copydoc Dali::WebEngine::WebAuthenticationCancel()
+   */
+  void WebAuthenticationCancel();
+
+  /**
+   * @copydoc Dali::WebEngine::RegisterWebAuthDisplayQRCallback()
+   */
+  void RegisterWebAuthDisplayQRCallback(Dali::WebEnginePlugin::WebEngineWebAuthDisplayQRCallback callback);
+
+  /**
+   * @copydoc Dali::WebEngine::RegisterWebAuthResponseCallback()
+   */
+  void RegisterWebAuthResponseCallback(Dali::WebEnginePlugin::WebEngineWebAuthResponseCallback callback);
+
+  /**
+   * @copydoc Dali::WebEngine::RegisterUserMediaPermissionRequestCallback()
+   */
+  void RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback);
+
 private:
   /**
    * @brief Constructor.