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 17 matching lines...) Expand all Loading... |
28 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
29 #include "ui/native_theme/native_theme.h" | 29 #include "ui/native_theme/native_theme.h" |
30 #include "ui/views/background.h" | 30 #include "ui/views/background.h" |
31 #include "ui/views/bubble/bubble_frame_view.h" | 31 #include "ui/views/bubble/bubble_frame_view.h" |
32 #include "ui/views/controls/button/checkbox.h" | 32 #include "ui/views/controls/button/checkbox.h" |
33 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
34 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
35 #include "ui/views/controls/scroll_view.h" | 35 #include "ui/views/controls/scroll_view.h" |
36 #include "ui/views/layout/box_layout.h" | 36 #include "ui/views/layout/box_layout.h" |
37 #include "ui/views/layout/layout_constants.h" | 37 #include "ui/views/layout/layout_constants.h" |
| 38 #include "ui/views/style/platform_style.h" |
38 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
39 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
40 #include "ui/wm/core/shadow_types.h" | 41 #include "ui/wm/core/shadow_types.h" |
41 | 42 |
42 using content::DesktopMediaID; | 43 using content::DesktopMediaID; |
43 | 44 |
44 namespace { | 45 namespace { |
45 | 46 |
46 const int kThumbnailWidth = 160; | 47 const int kThumbnailWidth = 160; |
47 const int kThumbnailHeight = 100; | 48 const int kThumbnailHeight = 100; |
(...skipping 28 matching lines...) Expand all Loading... |
76 DesktopMediaSourceView::DesktopMediaSourceView( | 77 DesktopMediaSourceView::DesktopMediaSourceView( |
77 DesktopMediaListView* parent, | 78 DesktopMediaListView* parent, |
78 DesktopMediaID source_id) | 79 DesktopMediaID source_id) |
79 : parent_(parent), | 80 : parent_(parent), |
80 source_id_(source_id), | 81 source_id_(source_id), |
81 image_view_(new views::ImageView()), | 82 image_view_(new views::ImageView()), |
82 label_(new views::Label()), | 83 label_(new views::Label()), |
83 selected_(false) { | 84 selected_(false) { |
84 AddChildView(image_view_); | 85 AddChildView(image_view_); |
85 AddChildView(label_); | 86 AddChildView(label_); |
86 SetFocusable(true); | 87 views::PlatformStyle::ConfigureFocus( |
| 88 views::PlatformStyle::CONTROL::DESKTOP_MEDIA_SOURCE_VIEW, this); |
87 } | 89 } |
88 | 90 |
89 DesktopMediaSourceView::~DesktopMediaSourceView() {} | 91 DesktopMediaSourceView::~DesktopMediaSourceView() {} |
90 | 92 |
91 void DesktopMediaSourceView::SetName(const base::string16& name) { | 93 void DesktopMediaSourceView::SetName(const base::string16& name) { |
92 label_->SetText(name); | 94 label_->SetText(name); |
93 } | 95 } |
94 | 96 |
95 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { | 97 void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { |
96 image_view_->SetImage(thumbnail); | 98 image_view_->SetImage(thumbnail); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 RequestFocus(); | 207 RequestFocus(); |
206 event->SetHandled(); | 208 event->SetHandled(); |
207 } | 209 } |
208 } | 210 } |
209 | 211 |
210 DesktopMediaListView::DesktopMediaListView( | 212 DesktopMediaListView::DesktopMediaListView( |
211 DesktopMediaPickerDialogView* parent, | 213 DesktopMediaPickerDialogView* parent, |
212 std::unique_ptr<DesktopMediaList> media_list) | 214 std::unique_ptr<DesktopMediaList> media_list) |
213 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { | 215 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { |
214 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); | 216 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); |
215 SetFocusable(true); | 217 views::PlatformStyle::ConfigureFocus( |
| 218 views::PlatformStyle::CONTROL::DESKTOP_MEDIA_LIST_VIEW, this); |
216 } | 219 } |
217 | 220 |
218 DesktopMediaListView::~DesktopMediaListView() {} | 221 DesktopMediaListView::~DesktopMediaListView() {} |
219 | 222 |
220 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { | 223 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { |
221 media_list_->SetViewDialogWindowId(dialog_window_id); | 224 media_list_->SetViewDialogWindowId(dialog_window_id); |
222 media_list_->StartUpdating(this); | 225 media_list_->StartUpdating(this); |
223 } | 226 } |
224 | 227 |
225 void DesktopMediaListView::OnSelectionChanged() { | 228 void DesktopMediaListView::OnSelectionChanged() { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 content::BrowserThread::PostTask( | 636 content::BrowserThread::PostTask( |
634 content::BrowserThread::UI, FROM_HERE, | 637 content::BrowserThread::UI, FROM_HERE, |
635 base::Bind(callback_, source)); | 638 base::Bind(callback_, source)); |
636 callback_.Reset(); | 639 callback_.Reset(); |
637 } | 640 } |
638 | 641 |
639 // static | 642 // static |
640 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 643 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
641 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); | 644 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); |
642 } | 645 } |
OLD | NEW |