Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8689)

Unified Diff: chrome/browser/ui/views/desktop_media_picker_views.cc

Issue 307453010: Fix a crash when chooseDesktopMedia is called with no target tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/desktop_media_picker_views.cc
diff --git a/chrome/browser/ui/views/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_media_picker_views.cc
index 30f5ed1a7f7fcf42f24eea8bd04a2614946544f4..d8b8a8307a5995e46dd863d0e507d5a626258527 100644
--- a/chrome/browser/ui/views/desktop_media_picker_views.cc
+++ b/chrome/browser/ui/views/desktop_media_picker_views.cc
@@ -518,15 +518,20 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
scroll_view_->SetContents(list_view_);
AddChildView(scroll_view_);
- WebContentsModalDialogManager* web_contents_modal_dialog_manager =
- WebContentsModalDialogManager::FromWebContents(parent_web_contents);
- DCHECK(web_contents_modal_dialog_manager);
- WebContentsModalDialogManagerDelegate* delegate =
- web_contents_modal_dialog_manager->delegate();
- DCHECK(delegate);
- views::Widget::CreateWindowAsFramelessChild(
- this,
- delegate->GetWebContentsModalDialogHost()->GetHostView());
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager = NULL;
+ if (parent_web_contents) {
Sergey Ulanov 2014/06/03 01:27:30 nit: add comment to explain what happens here, par
+ web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(parent_web_contents);
+ DCHECK(web_contents_modal_dialog_manager);
+ WebContentsModalDialogManagerDelegate* delegate =
+ web_contents_modal_dialog_manager->delegate();
+ DCHECK(delegate);
+ views::Widget::CreateWindowAsFramelessChild(
+ this,
+ delegate->GetWebContentsModalDialogHost()->GetHostView());
+ } else {
+ DialogDelegate::CreateDialogWidget(this, context, parent_window);
+ }
// DesktopMediaList needs to know the ID of the picker window which
// matches the ID it gets from the OS. Depending on the OS and configuration
@@ -547,8 +552,12 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
list_view_->StartUpdating(dialog_window_id);
- web_contents_modal_dialog_manager->ShowModalDialog(
- GetWidget()->GetNativeView());
+ if (parent_web_contents) {
+ web_contents_modal_dialog_manager->ShowModalDialog(
+ GetWidget()->GetNativeView());
+ } else {
+ GetWidget()->Show();
+ }
}
DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {}
« no previous file with comments | « chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698