Decouple SharingUiController from SharingDialogView.

This moves all required data to display sharing dialogs into the view
itself instead of having to call through to the controller. User actions
are bound back to the controller via weak pointers.
This is a cleaner fix for a UAF issue caused by different lifetimes of
controller and view and prevents further similar issues here.

[email protected]

Bug: 1000934
Change-Id: I34b4695fb6cdddb96c0e7bbf5d7edd36c5e729db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789149
Commit-Queue: Richard Knoll <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Reviewed-by: David Jacobo <[email protected]>
Reviewed-by: Alex Chau <[email protected]>
Cr-Commit-Position: refs/heads/master@{#704536}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 64deee4..16938cb 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3398,6 +3398,8 @@
       "sharing/sharing_app.cc",
       "sharing/sharing_app.h",
       "sharing/sharing_dialog.h",
+      "sharing/sharing_dialog_data.cc",
+      "sharing/sharing_dialog_data.h",
       "sharing/sharing_notification_handler.cc",
       "sharing/sharing_notification_handler.h",
       "sharing/sharing_ui_controller.cc",