OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/media/desktop_media_picker.h" | 5 #include "chrome/browser/media/desktop_media_picker.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/media/desktop_media_list.h" | 8 #include "chrome/browser/media/desktop_media_list.h" |
9 #include "chrome/browser/media/desktop_media_list_observer.h" | 9 #include "chrome/browser/media/desktop_media_list_observer.h" |
10 #include "chrome/browser/ui/ash/ash_util.h" | 10 #include "chrome/browser/ui/ash/ash_util.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 views::Widget* widget = NULL; | 558 views::Widget* widget = NULL; |
559 if (parent_web_contents) | 559 if (parent_web_contents) |
560 widget = CreateWebModalDialogViews(this, parent_web_contents); | 560 widget = CreateWebModalDialogViews(this, parent_web_contents); |
561 else | 561 else |
562 widget = DialogDelegate::CreateDialogWidget(this, context, parent_window); | 562 widget = DialogDelegate::CreateDialogWidget(this, context, parent_window); |
563 | 563 |
564 // DesktopMediaList needs to know the ID of the picker window which | 564 // DesktopMediaList needs to know the ID of the picker window which |
565 // matches the ID it gets from the OS. Depending on the OS and configuration | 565 // matches the ID it gets from the OS. Depending on the OS and configuration |
566 // we get this ID differently. | 566 // we get this ID differently. |
567 content::DesktopMediaID::Id dialog_window_id = 0; | 567 content::DesktopMediaID::Id dialog_window_id = 0; |
568 | |
569 // If there is |parent_window| or |parent_web_contents|, the picker window | |
570 // is embedded in the parent and does not have its own native window id, so we | |
571 // do not filter in that case. | |
572 if (!parent_window && !parent_web_contents) { | |
Sergey Ulanov
2014/06/16 21:48:43
You need just !parent_web_contents. parent_window
jiayl
2014/06/16 22:07:34
That's not true. If the parent_web_contents is NUL
Sergey Ulanov
2014/06/16 22:14:00
Did you try it with Ash? I think with Ash you'll g
| |
568 #if defined(USE_ASH) | 573 #if defined(USE_ASH) |
569 if (chrome::IsNativeWindowInAsh(widget->GetNativeWindow())) { | 574 if (chrome::IsNativeWindowInAsh(widget->GetNativeWindow())) { |
570 dialog_window_id = content::DesktopMediaID::RegisterAuraWindow( | 575 dialog_window_id = content::DesktopMediaID::RegisterAuraWindow( |
571 widget->GetNativeWindow()).id; | 576 widget->GetNativeWindow()).id; |
572 DCHECK_NE(dialog_window_id, 0); | 577 DCHECK_NE(dialog_window_id, 0); |
573 } | 578 } |
574 #endif | 579 #endif |
575 if (dialog_window_id == 0) { | 580 |
576 dialog_window_id = AcceleratedWidgetToDesktopMediaId( | 581 if (dialog_window_id == 0) { |
577 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget()); | 582 dialog_window_id = AcceleratedWidgetToDesktopMediaId( |
583 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget()); | |
584 } | |
578 } | 585 } |
579 | 586 |
580 list_view_->StartUpdating(dialog_window_id); | 587 list_view_->StartUpdating(dialog_window_id); |
581 | 588 |
582 if (parent_web_contents) { | 589 if (parent_web_contents) { |
583 web_modal::WebContentsModalDialogManager* manager = | 590 web_modal::WebContentsModalDialogManager* manager = |
584 web_modal::WebContentsModalDialogManager::FromWebContents( | 591 web_modal::WebContentsModalDialogManager::FromWebContents( |
585 parent_web_contents); | 592 parent_web_contents); |
586 manager->ShowModalDialog(widget->GetNativeView()); | 593 manager->ShowModalDialog(widget->GetNativeView()); |
587 } else { | 594 } else { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 base::Bind(callback_, source)); | 731 base::Bind(callback_, source)); |
725 callback_.Reset(); | 732 callback_.Reset(); |
726 } | 733 } |
727 | 734 |
728 } // namespace | 735 } // namespace |
729 | 736 |
730 // static | 737 // static |
731 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 738 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
732 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 739 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
733 } | 740 } |
OLD | NEW |