| 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/ui/views/desktop_media_picker_views.h" | 5 #include "chrome/browser/ui/views/desktop_media_picker_views.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 DesktopMediaSourceView::DesktopMediaSourceView( | 77 DesktopMediaSourceView::DesktopMediaSourceView( |
| 78 DesktopMediaListView* parent, | 78 DesktopMediaListView* parent, |
| 79 DesktopMediaID source_id) | 79 DesktopMediaID source_id) |
| 80 : parent_(parent), | 80 : parent_(parent), |
| 81 source_id_(source_id), | 81 source_id_(source_id), |
| 82 image_view_(new views::ImageView()), | 82 image_view_(new views::ImageView()), |
| 83 label_(new views::Label()), | 83 label_(new views::Label()), |
| 84 selected_(false) { | 84 selected_(false) { |
| 85 AddChildView(image_view_); | 85 AddChildView(image_view_); |
| 86 AddChildView(label_); | 86 AddChildView(label_); |
| 87 SetFocusable(true); | 87 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 88 } | 88 } |
| 89 | 89 |
| 90 DesktopMediaSourceView::~DesktopMediaSourceView() {} | 90 DesktopMediaSourceView::~DesktopMediaSourceView() {} |
| 91 | 91 |
| 92 void DesktopMediaSourceView::SetName(const base::string16& name) { | 92 void DesktopMediaSourceView::SetName(const base::string16& name) { |
| 93 label_->SetText(name); | 93 label_->SetText(name); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { | 96 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { |
| 97 image_view_->SetImage(thumbnail); | 97 image_view_->SetImage(thumbnail); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 RequestFocus(); | 206 RequestFocus(); |
| 207 event->SetHandled(); | 207 event->SetHandled(); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 DesktopMediaListView::DesktopMediaListView( | 211 DesktopMediaListView::DesktopMediaListView( |
| 212 DesktopMediaPickerDialogView* parent, | 212 DesktopMediaPickerDialogView* parent, |
| 213 std::unique_ptr<DesktopMediaList> media_list) | 213 std::unique_ptr<DesktopMediaList> media_list) |
| 214 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { | 214 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { |
| 215 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); | 215 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); |
| 216 SetFocusable(true); | 216 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 217 } | 217 } |
| 218 | 218 |
| 219 DesktopMediaListView::~DesktopMediaListView() {} | 219 DesktopMediaListView::~DesktopMediaListView() {} |
| 220 | 220 |
| 221 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { | 221 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { |
| 222 media_list_->SetViewDialogWindowId(dialog_window_id); | 222 media_list_->SetViewDialogWindowId(dialog_window_id); |
| 223 media_list_->StartUpdating(this); | 223 media_list_->StartUpdating(this); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DesktopMediaListView::OnSelectionChanged() { | 226 void DesktopMediaListView::OnSelectionChanged() { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 content::BrowserThread::PostTask( | 663 content::BrowserThread::PostTask( |
| 664 content::BrowserThread::UI, FROM_HERE, | 664 content::BrowserThread::UI, FROM_HERE, |
| 665 base::Bind(callback_, source)); | 665 base::Bind(callback_, source)); |
| 666 callback_.Reset(); | 666 callback_.Reset(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 // static | 669 // static |
| 670 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 670 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
| 671 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 671 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
| 672 } | 672 } |
| OLD | NEW |