Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/ui/views/desktop_media_picker_views.cc

Issue 1313843003: Enable keyboard navigation for Desktopcapture window selection dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: q Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/media/desktop_media_list.h" 10 #include "chrome/browser/media/desktop_media_list.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 } 200 }
201 201
202 DesktopMediaListView::DesktopMediaListView( 202 DesktopMediaListView::DesktopMediaListView(
203 DesktopMediaPickerDialogView* parent, 203 DesktopMediaPickerDialogView* parent,
204 scoped_ptr<DesktopMediaList> media_list) 204 scoped_ptr<DesktopMediaList> media_list)
205 : parent_(parent), 205 : parent_(parent),
206 media_list_(media_list.Pass()), 206 media_list_(media_list.Pass()),
207 weak_factory_(this) { 207 weak_factory_(this) {
208 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); 208 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight));
209
210 // Enable keyboard focus
Peter Kasting 2015/09/23 22:43:57 This comment adds nothing to the code; remove it.
gyzhou 2015/09/23 23:43:40 Done.
211 SetFocusable(true);
209 } 212 }
210 213
211 DesktopMediaListView::~DesktopMediaListView() {} 214 DesktopMediaListView::~DesktopMediaListView() {}
212 215
213 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { 216 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) {
214 media_list_->SetViewDialogWindowId(dialog_window_id); 217 media_list_->SetViewDialogWindowId(dialog_window_id);
215 media_list_->StartUpdating(this); 218 media_list_->StartUpdating(this);
216 } 219 }
217 220
218 void DesktopMediaListView::OnSelectionChanged() { 221 void DesktopMediaListView::OnSelectionChanged() {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 #endif 439 #endif
437 440
438 // Set native window ID if the windows is outside Ash. 441 // Set native window ID if the windows is outside Ash.
439 if (!is_ash_window) { 442 if (!is_ash_window) {
440 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId( 443 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
441 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget()); 444 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
442 } 445 }
443 } 446 }
444 447
445 list_view_->StartUpdating(dialog_window_id); 448 list_view_->StartUpdating(dialog_window_id);
449
450 // Request keyboard focus for initial view.
Peter Kasting 2015/09/23 22:43:57 This block should not be necessary because the wid
gyzhou 2015/09/23 23:43:40 Done.
451 views::View* initView = GetInitiallyFocusedView();
452 if (initView)
453 initView->RequestFocus();
446 } 454 }
447 455
448 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} 456 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {}
449 457
458 views::View* DesktopMediaPickerDialogView::GetInitiallyFocusedView()
459 {
460 if (list_view_)
Peter Kasting 2015/09/23 22:43:57 Why null-check this when it can't ever be null?
gyzhou 2015/09/23 23:43:40 Done.
461 return list_view_;
462
463 return NULL;
464 }
465
450 void DesktopMediaPickerDialogView::DetachParent() { 466 void DesktopMediaPickerDialogView::DetachParent() {
451 parent_ = NULL; 467 parent_ = NULL;
452 } 468 }
453 469
454 gfx::Size DesktopMediaPickerDialogView::GetPreferredSize() const { 470 gfx::Size DesktopMediaPickerDialogView::GetPreferredSize() const {
455 static const size_t kDialogViewWidth = 600; 471 static const size_t kDialogViewWidth = 600;
456 const gfx::Insets title_insets = views::BubbleFrameView::GetTitleInsets(); 472 const gfx::Insets title_insets = views::BubbleFrameView::GetTitleInsets();
457 size_t label_height = 473 size_t label_height =
458 label_->GetHeightForWidth(kDialogViewWidth - title_insets.height() * 2); 474 label_->GetHeightForWidth(kDialogViewWidth - title_insets.height() * 2);
459 475
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 content::BrowserThread::PostTask( 601 content::BrowserThread::PostTask(
586 content::BrowserThread::UI, FROM_HERE, 602 content::BrowserThread::UI, FROM_HERE,
587 base::Bind(callback_, source)); 603 base::Bind(callback_, source));
588 callback_.Reset(); 604 callback_.Reset();
589 } 605 }
590 606
591 // static 607 // static
592 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { 608 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
593 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); 609 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
594 } 610 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698