Chromium Code Reviews| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/media/desktop_media_list.h" | 9 #include "chrome/browser/media/desktop_media_list.h" |
| 10 #include "chrome/browser/media/desktop_media_list_observer.h" | 10 #include "chrome/browser/media/desktop_media_list_observer.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 AddChildView(label_); | 488 AddChildView(label_); |
| 489 | 489 |
| 490 scroll_view_->SetContents(list_view_); | 490 scroll_view_->SetContents(list_view_); |
| 491 AddChildView(scroll_view_); | 491 AddChildView(scroll_view_); |
| 492 | 492 |
| 493 DialogDelegate::CreateDialogWidget(this, context, parent_window); | 493 DialogDelegate::CreateDialogWidget(this, context, parent_window); |
| 494 | 494 |
| 495 // DesktopMediaList needs to know the ID of the picker window which | 495 // DesktopMediaList needs to know the ID of the picker window which |
| 496 // matches the ID it gets from the OS. Depending on the OS and configuration | 496 // matches the ID it gets from the OS. Depending on the OS and configuration |
| 497 // we get this ID differently. | 497 // we get this ID differently. |
| 498 // | 498 content::DesktopMediaID::Id dialog_window_id = 0; |
| 499 // TODO(sergeyu): Update this code when Ash-specific window capturer is | |
| 500 // implemented. Currently this code will always get native windows ID | |
| 501 // which is not what we need in Ash. http://crbug.com/295102 | |
| 502 content::DesktopMediaID::Id dialog_window_id; | |
| 503 | 499 |
| 504 #if defined(OS_WIN) | 500 #if defined(OS_WIN) |
| 505 dialog_window_id = reinterpret_cast<content::DesktopMediaID::Id>( | 501 dialog_window_id = reinterpret_cast<content::DesktopMediaID::Id>( |
| 506 views::HWNDForWidget(GetWidget())); | 502 views::HWNDForWidget(GetWidget())); |
| 507 #elif defined(USE_AURA) | 503 #elif defined(USE_AURA) |
| 508 dialog_window_id = static_cast<content::DesktopMediaID::Id>( | 504 |
| 509 GetWidget()->GetNativeWindow()->GetDispatcher()->host()-> | 505 #if defined(USE_ASH) |
| 510 GetAcceleratedWidget()); | 506 if (ash::Shell::HasInstance()) { |
|
Ben Goodger (Google)
2013/12/19 04:01:07
instead of doing this, you probably should instead
Sergey Ulanov
2013/12/20 01:43:08
Done.
| |
| 511 #else | 507 dialog_window_id = content::DesktopMediaID::RegisterAuraWindow( |
| 508 GetWidget()->GetNativeWindow()).id; | |
| 509 } else | |
| 510 #endif | |
| 511 { | |
| 512 dialog_window_id = static_cast<content::DesktopMediaID::Id>( | |
| 513 GetWidget()->GetNativeWindow()->GetDispatcher()->host()-> | |
| 514 GetAcceleratedWidget()); | |
| 515 } | |
| 516 | |
| 517 #else // defined(USE_AURA) | |
| 512 dialog_window_id = 0; | 518 dialog_window_id = 0; |
| 513 NOTIMPLEMENTED(); | 519 NOTIMPLEMENTED(); |
| 514 #endif | 520 #endif // !defined(USE_AURA) |
| 515 | 521 |
| 516 list_view_->StartUpdating(dialog_window_id); | 522 list_view_->StartUpdating(dialog_window_id); |
| 517 | 523 |
| 518 GetWidget()->Show(); | 524 GetWidget()->Show(); |
| 519 } | 525 } |
| 520 | 526 |
| 521 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} | 527 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} |
| 522 | 528 |
| 523 void DesktopMediaPickerDialogView::DetachParent() { | 529 void DesktopMediaPickerDialogView::DetachParent() { |
| 524 parent_ = NULL; | 530 parent_ = NULL; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 base::Bind(callback_, source)); | 628 base::Bind(callback_, source)); |
| 623 callback_.Reset(); | 629 callback_.Reset(); |
| 624 } | 630 } |
| 625 | 631 |
| 626 } // namespace | 632 } // namespace |
| 627 | 633 |
| 628 // static | 634 // static |
| 629 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 635 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
| 630 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 636 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
| 631 } | 637 } |
| OLD | NEW |