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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 DesktopMediaSourceView::DesktopMediaSourceView( | 76 DesktopMediaSourceView::DesktopMediaSourceView( |
77 DesktopMediaListView* parent, | 77 DesktopMediaListView* parent, |
78 DesktopMediaID source_id) | 78 DesktopMediaID source_id) |
79 : parent_(parent), | 79 : parent_(parent), |
80 source_id_(source_id), | 80 source_id_(source_id), |
81 image_view_(new views::ImageView()), | 81 image_view_(new views::ImageView()), |
82 label_(new views::Label()), | 82 label_(new views::Label()), |
83 selected_(false) { | 83 selected_(false) { |
84 AddChildView(image_view_); | 84 AddChildView(image_view_); |
85 AddChildView(label_); | 85 AddChildView(label_); |
86 SetFocusable(true); | 86 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
87 } | 87 } |
88 | 88 |
89 DesktopMediaSourceView::~DesktopMediaSourceView() {} | 89 DesktopMediaSourceView::~DesktopMediaSourceView() {} |
90 | 90 |
91 void DesktopMediaSourceView::SetName(const base::string16& name) { | 91 void DesktopMediaSourceView::SetName(const base::string16& name) { |
92 label_->SetText(name); | 92 label_->SetText(name); |
93 } | 93 } |
94 | 94 |
95 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { | 95 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { |
96 image_view_->SetImage(thumbnail); | 96 image_view_->SetImage(thumbnail); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 RequestFocus(); | 205 RequestFocus(); |
206 event->SetHandled(); | 206 event->SetHandled(); |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 DesktopMediaListView::DesktopMediaListView( | 210 DesktopMediaListView::DesktopMediaListView( |
211 DesktopMediaPickerDialogView* parent, | 211 DesktopMediaPickerDialogView* parent, |
212 std::unique_ptr<DesktopMediaList> media_list) | 212 std::unique_ptr<DesktopMediaList> media_list) |
213 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { | 213 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { |
214 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); | 214 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); |
215 SetFocusable(true); | 215 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
216 } | 216 } |
217 | 217 |
218 DesktopMediaListView::~DesktopMediaListView() {} | 218 DesktopMediaListView::~DesktopMediaListView() {} |
219 | 219 |
220 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { | 220 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { |
221 media_list_->SetViewDialogWindowId(dialog_window_id); | 221 media_list_->SetViewDialogWindowId(dialog_window_id); |
222 media_list_->StartUpdating(this); | 222 media_list_->StartUpdating(this); |
223 } | 223 } |
224 | 224 |
225 void DesktopMediaListView::OnSelectionChanged() { | 225 void DesktopMediaListView::OnSelectionChanged() { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 content::BrowserThread::PostTask( | 641 content::BrowserThread::PostTask( |
642 content::BrowserThread::UI, FROM_HERE, | 642 content::BrowserThread::UI, FROM_HERE, |
643 base::Bind(callback_, source)); | 643 base::Bind(callback_, source)); |
644 callback_.Reset(); | 644 callback_.Reset(); |
645 } | 645 } |
646 | 646 |
647 // static | 647 // static |
648 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 648 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
649 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 649 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
650 } | 650 } |
OLD | NEW |