UIDevtool: Support query by ID

This change is mainly used for supporting Desktop UI benchmark to query
element by id. Previously we used class name to find elements, which
is not ideal as discussed in the doc.

We will gradually migrate to query element by id since it's more robust
to code refactor.

Doc: https://docs.google.com/document/d/1zcVPqvatmAyNZQZOT_yL8Goj1xckt0eUfAGEGEoOf9g/edit?usp=sharing&resourcekey=0-RJywpBq5u1XqweomTY-NWA
Bug: 1201243
Change-Id: I95488d622381fe56b64c316d07fc8dfa4843a54f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3253505
Commit-Queue: Yuheng Huang <[email protected]>
Reviewed-by: Wei Li <[email protected]>
Cr-Commit-Position: refs/heads/main@{#936628}
diff --git a/components/ui_devtools/ui_element.h b/components/ui_devtools/ui_element.h
index 9a081f7..3ec8046 100644
--- a/components/ui_devtools/ui_element.h
+++ b/components/ui_devtools/ui_element.h
@@ -140,6 +140,11 @@
   // Get the sources for the element.
   std::vector<Source> GetSources();
 
+  // Get the ID of the backing UI element. This is used to locate
+  // a UIElement by ID set on the browser side and different than
+  // node_id().
+  virtual int GetBackingElementID();
+
   virtual bool DispatchMouseEvent(protocol::DOM::MouseEvent* event);
 
   virtual bool DispatchKeyEvent(protocol::DOM::KeyEvent* event);