| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 AddChildView(label_); | 472 AddChildView(label_); |
| 473 | 473 |
| 474 scroll_view_->SetContents(list_view_); | 474 scroll_view_->SetContents(list_view_); |
| 475 AddChildView(scroll_view_); | 475 AddChildView(scroll_view_); |
| 476 | 476 |
| 477 DialogDelegate::CreateDialogWidget(this, context, parent_window); | 477 DialogDelegate::CreateDialogWidget(this, context, parent_window); |
| 478 | 478 |
| 479 // DesktopMediaList needs to know the ID of the picker window which | 479 // DesktopMediaList needs to know the ID of the picker window which |
| 480 // matches the ID it gets from the OS. Depending on the OS and configuration | 480 // matches the ID it gets from the OS. Depending on the OS and configuration |
| 481 // we get this ID differently. | 481 // we get this ID differently. |
| 482 // | 482 content::DesktopMediaID::Id dialog_window_id = 0; |
| 483 // TODO(sergeyu): Update this code when Ash-specific window capturer is | |
| 484 // implemented. Currently this code will always get native windows ID | |
| 485 // which is not what we need in Ash. http://crbug.com/295102 | |
| 486 content::DesktopMediaID::Id dialog_window_id; | |
| 487 | 483 |
| 488 #if defined(OS_WIN) | 484 #if defined(OS_WIN) |
| 489 dialog_window_id = reinterpret_cast<content::DesktopMediaID::Id>( | 485 dialog_window_id = reinterpret_cast<content::DesktopMediaID::Id>( |
| 490 views::HWNDForWidget(GetWidget())); | 486 views::HWNDForWidget(GetWidget())); |
| 491 #elif defined(USE_AURA) | 487 #elif defined(USE_AURA) |
| 492 dialog_window_id = static_cast<content::DesktopMediaID::Id>( | 488 |
| 493 GetWidget()->GetNativeWindow()->GetDispatcher()->host()-> | 489 #if defined(USE_ASH) |
| 494 GetAcceleratedWidget()); | 490 if (ash::Shell::HasInstance()) { |
| 495 #else | 491 dialog_window_id = content::DesktopMediaID::RegisterAuraWindow( |
| 492 GetWidget()->GetNativeWindow()).id; |
| 493 } else |
| 494 #endif |
| 495 { |
| 496 dialog_window_id = static_cast<content::DesktopMediaID::Id>( |
| 497 GetWidget()->GetNativeWindow()->GetDispatcher()->host()-> |
| 498 GetAcceleratedWidget()); |
| 499 } |
| 500 |
| 501 #else // defined(USE_AURA) |
| 496 dialog_window_id = 0; | 502 dialog_window_id = 0; |
| 497 NOTIMPLEMENTED(); | 503 NOTIMPLEMENTED(); |
| 498 #endif | 504 #endif // !defined(USE_AURA) |
| 499 | 505 |
| 500 list_view_->StartUpdating(dialog_window_id); | 506 list_view_->StartUpdating(dialog_window_id); |
| 501 | 507 |
| 502 GetWidget()->Show(); | 508 GetWidget()->Show(); |
| 503 } | 509 } |
| 504 | 510 |
| 505 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} | 511 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} |
| 506 | 512 |
| 507 void DesktopMediaPickerDialogView::DetachParent() { | 513 void DesktopMediaPickerDialogView::DetachParent() { |
| 508 parent_ = NULL; | 514 parent_ = NULL; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 base::Bind(callback_, source)); | 612 base::Bind(callback_, source)); |
| 607 callback_.Reset(); | 613 callback_.Reset(); |
| 608 } | 614 } |
| 609 | 615 |
| 610 } // namespace | 616 } // namespace |
| 611 | 617 |
| 612 // static | 618 // static |
| 613 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 619 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
| 614 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 620 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
| 615 } | 621 } |
| OLD | NEW |