Screen capture UI: don't recreate the widget if it already exists.

Bug: 1001503
Change-Id: I28c6c8445407315d8b2e9ab364cfb86f451758d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1848385
Commit-Queue: Marina Ciocea <marinaciocea@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704321}
diff --git a/chrome/browser/ui/views/screen_capture_notification_ui_views.cc b/chrome/browser/ui/views/screen_capture_notification_ui_views.cc
index 9c51558..2c0a4c5 100644
--- a/chrome/browser/ui/views/screen_capture_notification_ui_views.cc
+++ b/chrome/browser/ui/views/screen_capture_notification_ui_views.cc
@@ -175,6 +175,9 @@
 gfx::NativeViewId ScreenCaptureNotificationUIViews::OnStarted(
     base::OnceClosure stop_callback,
     content::MediaStreamUI::SourceCallback source_callback) {
+  if (GetWidget())
+    return 0;
+
   stop_callback_ = std::move(stop_callback);
   source_callback_ = std::move(source_callback);
 
@@ -225,11 +228,7 @@
   widget->SetOpacity(kWindowAlphaValue);
   widget->SetVisibleOnAllWorkspaces(true);
 
-#if defined(OS_WIN)
-  return gfx::NativeViewId(views::HWNDForWidget(widget));
-#else
   return 0;
-#endif
 }
 
 void ScreenCaptureNotificationUIViews::DeleteDelegate() {