OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_capture/desktop_media_list_view.h" | 5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/media/desktop_media_list.h" | 9 #include "chrome/browser/media/desktop_media_list.h" |
| 10 #include "chrome/browser/media/window_icon_util.h" |
10 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" | 11 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" |
11 #include "chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h" | 12 #include "chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "ui/accessibility/ax_view_state.h" | 15 #include "ui/accessibility/ax_view_state.h" |
15 #include "ui/views/focus/focus_manager.h" | 16 #include "ui/views/focus/focus_manager.h" |
16 | 17 |
17 using content::DesktopMediaID; | 18 using content::DesktopMediaID; |
18 | 19 |
19 namespace { | 20 namespace { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 145 |
145 // We are going to have a second item, apply the generic style. | 146 // We are going to have a second item, apply the generic style. |
146 if (child_count() == 1) | 147 if (child_count() == 1) |
147 SetStyle(&generic_style_); | 148 SetStyle(&generic_style_); |
148 | 149 |
149 DesktopMediaSourceView* source_view = | 150 DesktopMediaSourceView* source_view = |
150 new DesktopMediaSourceView(this, source.id, *active_style_); | 151 new DesktopMediaSourceView(this, source.id, *active_style_); |
151 | 152 |
152 source_view->SetName(source.name); | 153 source_view->SetName(source.name); |
153 source_view->SetGroup(kDesktopMediaSourceViewGroupId); | 154 source_view->SetGroup(kDesktopMediaSourceViewGroupId); |
| 155 if (source.id.type == DesktopMediaID::TYPE_WINDOW) |
| 156 source_view->SetIcon(GetWindowIcon(source.id)); |
154 AddChildViewAt(source_view, index); | 157 AddChildViewAt(source_view, index); |
155 | 158 |
156 if ((child_count() - 1) % active_style_->columns == 0) | 159 if ((child_count() - 1) % active_style_->columns == 0) |
157 parent_->OnMediaListRowsChanged(); | 160 parent_->OnMediaListRowsChanged(); |
158 | 161 |
159 // Auto select the first screen. | 162 // Auto select the first screen. |
160 if (index == 0 && source.id.type == DesktopMediaID::TYPE_SCREEN) | 163 if (index == 0 && source.id.type == DesktopMediaID::TYPE_SCREEN) |
161 source_view->RequestFocus(); | 164 source_view->RequestFocus(); |
162 | 165 |
163 PreferredSizeChanged(); | 166 PreferredSizeChanged(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 DesktopMediaSourceView* source_view = | 243 DesktopMediaSourceView* source_view = |
241 static_cast<DesktopMediaSourceView*>(child_at(i)); | 244 static_cast<DesktopMediaSourceView*>(child_at(i)); |
242 source_view->SetStyle(*active_style_); | 245 source_view->SetStyle(*active_style_); |
243 } | 246 } |
244 } | 247 } |
245 | 248 |
246 void DesktopMediaListView::GetAccessibleState(ui::AXViewState* state) { | 249 void DesktopMediaListView::GetAccessibleState(ui::AXViewState* state) { |
247 state->role = ui::AX_ROLE_GROUP; | 250 state->role = ui::AX_ROLE_GROUP; |
248 state->name = accessible_name_; | 251 state->name = accessible_name_; |
249 } | 252 } |
OLD | NEW |