libaurum: Add ref_accessible API to convert the accessible object found by dump_tree 15/320415/6
authorHosang Kim <hosang12.kim@samsung.com>
Tue, 25 Feb 2025 09:52:47 +0000 (18:52 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Tue, 18 Mar 2025 03:52:16 +0000 (12:52 +0900)
Change-Id: I243f33ce7929e7eb8c43855ba5cad1f0ef68ed28

libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiWrapper.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiWrapper.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc

index 4bf4a37745392a2cfcab4a21129ee2175fe8ac34..f1d4e89c20ae7416c30c02257c90f71263317524 100644 (file)
@@ -169,6 +169,18 @@ public:
      */
     virtual std::shared_ptr<AccessibleNode> last() const = 0;
 
+    /**
+     * @brief Gets reference of AccessibleNode.
+     *
+     * @param[in] appName application name
+     * @param[in] path path of node
+     *
+     * @return AccessibleNode pointer
+     *
+     * @since_tizen 10.0
+     */
+    virtual std::shared_ptr<AccessibleNode> refAccessibleNode(const std::string &appName, const std::string &path ) const = 0;
+
     /**
      * @brief Called by @AccessibleWatcher::notifyAll.
      *        Changes Node property If it's @EventType, @ObjectEventType are matches.
index 790d543ece694a10607b6636b54e7a768e32bbfa..149980de70f300f0f16465548793ebda529036e8 100644 (file)
@@ -105,6 +105,11 @@ public:
      */
     std::shared_ptr<AccessibleNode> last() const override;
 
+    /**
+     * @copydoc AccessibleNode::refAccessibleNode()
+     */
+    std::shared_ptr<AccessibleNode> refAccessibleNode(const std::string &appName, const std::string &path ) const override;
+
     /**
      * @copydoc AccessibleNode::isValid()
      */
index eb2a23d453ca0e7de7ca5d21df927d3c69236ce8..ad635b01a1370e2ac2dbed0ab30499ee1bdceef5 100644 (file)
@@ -82,6 +82,7 @@ public:
     static void Atspi_accessible_set_include_hidden(AtspiAccessible *obj, gboolean enabled, GError **error);
     static gboolean Atspi_accessible_get_include_hidden(AtspiAccessible *obj, GError **error);
     static gchar *Atspi_accessible_dump_tree(AtspiAccessible *obj, AtspiDumpDetailLevelType detail_level, GError **error);
+    static AtspiAccessible *Atspi_ref_accessible(const gchar *app_name, const gchar *path);
 
 private:
     static std::recursive_mutex mMutex;
index aaba614d68c681d82e4186688443af981b2fb607..f0bc7f0d8fea065f76a91e41829fbc9fa9230027 100644 (file)
@@ -104,6 +104,11 @@ public:
      */
     std::shared_ptr<AccessibleNode> last() const override;
 
+    /**
+     * @copydoc AccessibleNode::refAccessibleNode()
+     */
+    std::shared_ptr<AccessibleNode> refAccessibleNode(const std::string &appName, const std::string &path ) const override;
+
 public:
     /**
      * @brief TBD
index 192125cad30227ca1a6c672a0c64ff6ba226d25f..316cd5e55dc09afbcab2bc1a8336a2e7df0ea7bf 100644 (file)
@@ -802,4 +802,12 @@ bool AtspiAccessibleNode::getIncludeHidden() const
     }
 
     return false;
-}
\ No newline at end of file
+}
+
+std::shared_ptr<AccessibleNode> AtspiAccessibleNode::refAccessibleNode(const std::string &appName, const std::string &path) const
+{
+    AtspiAccessible *accessible = AtspiWrapper::Atspi_ref_accessible(appName.c_str(), path.c_str());
+    auto node = std::make_shared<AtspiAccessibleNode>(accessible);
+
+    return node;
+}
index 47525659a3384c5e7828b8814b87aa2d784f5e90..ef531f1c5a04b96fe06a2ffb0a02b3187bf8a30b 100644 (file)
@@ -302,3 +302,9 @@ gchar *AtspiWrapper::Atspi_accessible_dump_tree(AtspiAccessible *obj, AtspiDumpD
     std::unique_lock<std::recursive_mutex> lock(mMutex);
     return atspi_accessible_dump_tree(obj, detail_level, error);
 }
+
+AtspiAccessible *AtspiWrapper::Atspi_ref_accessible(const gchar *app_name, const gchar *path)
+{
+    std::unique_lock<std::recursive_mutex> lock(mMutex);
+    return ref_accessible(app_name, path);
+}
\ No newline at end of file
index 448c2e898968b38d776df2abc5b01660799c8075..5501b92fa4682dcbe2e8c32c9cb0fe1e9b68344c 100644 (file)
@@ -349,4 +349,10 @@ void MockAccessibleNode::setIncludeHidden(bool enabled) const
 bool MockAccessibleNode::getIncludeHidden() const
 {
     return false;
-}
\ No newline at end of file
+}
+
+std::shared_ptr<AccessibleNode> MockAccessibleNode::refAccessibleNode(const std::string &appName, const std::string &path) const
+{
+    return nullptr;
+}
+