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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 // web contents. Otherwise, a new dialog widget inside |parent_window| will be | 539 // web contents. Otherwise, a new dialog widget inside |parent_window| will be |
540 // created for the picker. Note that |parent_window| may also be NULL if | 540 // created for the picker. Note that |parent_window| may also be NULL if |
541 // parent web contents is not set. In this case the picker will be parented | 541 // parent web contents is not set. In this case the picker will be parented |
542 // by a root window. | 542 // by a root window. |
543 views::Widget* widget = NULL; | 543 views::Widget* widget = NULL; |
544 if (parent_web_contents) | 544 if (parent_web_contents) |
545 widget = CreateWebModalDialogViews(this, parent_web_contents); | 545 widget = CreateWebModalDialogViews(this, parent_web_contents); |
546 else | 546 else |
547 widget = DialogDelegate::CreateDialogWidget(this, context, parent_window); | 547 widget = DialogDelegate::CreateDialogWidget(this, context, parent_window); |
548 | 548 |
549 // DesktopMediaList needs to know the ID of the picker window which | 549 // The picker window is embedded in the parent window and does not have its |
550 // matches the ID it gets from the OS. Depending on the OS and configuration | 550 // own native window with Aura. So we do not filter any window. |
Sergey Ulanov
2014/06/13 17:38:41
Actually it's not always the case. We still have a
jiayl
2014/06/13 17:54:54
But I tested both the desktopCapture example exten
| |
551 // we get this ID differently. | 551 list_view_->StartUpdating(0); |
552 content::DesktopMediaID::Id dialog_window_id = 0; | |
553 #if defined(USE_ASH) | |
554 if (chrome::IsNativeWindowInAsh(widget->GetNativeWindow())) { | |
555 dialog_window_id = content::DesktopMediaID::RegisterAuraWindow( | |
556 widget->GetNativeWindow()).id; | |
557 DCHECK_NE(dialog_window_id, 0); | |
558 } | |
559 #endif | |
560 if (dialog_window_id == 0) { | |
561 dialog_window_id = AcceleratedWidgetToDesktopMediaId( | |
562 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget()); | |
563 } | |
564 | |
565 list_view_->StartUpdating(dialog_window_id); | |
566 | 552 |
567 if (parent_web_contents) { | 553 if (parent_web_contents) { |
568 web_modal::WebContentsModalDialogManager* manager = | 554 web_modal::WebContentsModalDialogManager* manager = |
569 web_modal::WebContentsModalDialogManager::FromWebContents( | 555 web_modal::WebContentsModalDialogManager::FromWebContents( |
570 parent_web_contents); | 556 parent_web_contents); |
571 manager->ShowModalDialog(widget->GetNativeView()); | 557 manager->ShowModalDialog(widget->GetNativeView()); |
572 } else { | 558 } else { |
573 widget->Show(); | 559 widget->Show(); |
574 } | 560 } |
575 } | 561 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 base::Bind(callback_, source)); | 675 base::Bind(callback_, source)); |
690 callback_.Reset(); | 676 callback_.Reset(); |
691 } | 677 } |
692 | 678 |
693 } // namespace | 679 } // namespace |
694 | 680 |
695 // static | 681 // static |
696 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 682 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
697 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 683 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
698 } | 684 } |
OLD | NEW |