Add id to cast web contents observer

Added a id to replace tab_id as unique
identifier for the webviews that are created from the
platform views service.  The tab_id was always 0
because is_root_frame is true on creation.
Subsequent lookups for the ax tree id by tab id
were only working by chance. The linear search for the
tab id among the list of windows always matches the
first one found, which was the correct one.  This ensures
tab ids will be unique.

Bug: None
Test: display assistant created webviews followed by navigation
      causing render frames to be swapped

Change-Id: Ib6b9f1fd217367423f15965e5b760df1f170caa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2342640
Commit-Queue: Randy Rossi <[email protected]>
Reviewed-by: Daniel Nicoara <[email protected]>
Cr-Commit-Position: refs/heads/master@{#796903}
diff --git a/chromecast/browser/cast_web_contents.h b/chromecast/browser/cast_web_contents.h
index b921830d..171cddf 100644
--- a/chromecast/browser/cast_web_contents.h
+++ b/chromecast/browser/cast_web_contents.h
@@ -269,6 +269,10 @@
   // same tab ID at any given time.
   virtual int tab_id() const = 0;
 
+  // An identifier for the WebContents, mainly used by platform views service.
+  // IDs may be re-used but are unique among all live CastWebContents.
+  virtual int id() const = 0;
+
   // TODO(seantopping): Hide this, clients shouldn't use WebContents directly.
   virtual content::WebContents* web_contents() const = 0;
   virtual PageState page_state() const = 0;