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

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: reiew update 4 Created 5 years, 3 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 SetFocusable(true);
209 } 210 }
210 211
211 DesktopMediaListView::~DesktopMediaListView() {} 212 DesktopMediaListView::~DesktopMediaListView() {}
212 213
213 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { 214 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) {
214 media_list_->SetViewDialogWindowId(dialog_window_id); 215 media_list_->SetViewDialogWindowId(dialog_window_id);
215 media_list_->StartUpdating(this); 216 media_list_->StartUpdating(this);
216 } 217 }
217 218
218 void DesktopMediaListView::OnSelectionChanged() { 219 void DesktopMediaListView::OnSelectionChanged() {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 #endif 437 #endif
437 438
438 // Set native window ID if the windows is outside Ash. 439 // Set native window ID if the windows is outside Ash.
439 if (!is_ash_window) { 440 if (!is_ash_window) {
440 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId( 441 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
441 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget()); 442 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
442 } 443 }
443 } 444 }
444 445
445 list_view_->StartUpdating(dialog_window_id); 446 list_view_->StartUpdating(dialog_window_id);
447
448 views::View* initView = GetInitiallyFocusedView();
Peter Kasting 2015/09/24 04:10:25 This block is still here. Why is it not removed?
gyzhou 2015/10/02 18:51:26 Done.
449 if (initView)
450 initView->RequestFocus();
446 } 451 }
447 452
448 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} 453 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {}
449 454
450 void DesktopMediaPickerDialogView::DetachParent() { 455 void DesktopMediaPickerDialogView::DetachParent() {
451 parent_ = NULL; 456 parent_ = NULL;
452 } 457 }
453 458
454 gfx::Size DesktopMediaPickerDialogView::GetPreferredSize() const { 459 gfx::Size DesktopMediaPickerDialogView::GetPreferredSize() const {
455 static const size_t kDialogViewWidth = 600; 460 static const size_t kDialogViewWidth = 600;
(...skipping 17 matching lines...) Expand all
473 gfx::Rect label_rect(rect.x(), rect.y(), rect.width(), 478 gfx::Rect label_rect(rect.x(), rect.y(), rect.width(),
474 label_->GetHeightForWidth(rect.width())); 479 label_->GetHeightForWidth(rect.width()));
475 label_->SetBoundsRect(label_rect); 480 label_->SetBoundsRect(label_rect);
476 481
477 int scroll_view_top = label_rect.bottom() + views::kPanelVerticalSpacing; 482 int scroll_view_top = label_rect.bottom() + views::kPanelVerticalSpacing;
478 scroll_view_->SetBounds( 483 scroll_view_->SetBounds(
479 rect.x(), scroll_view_top, 484 rect.x(), scroll_view_top,
480 rect.width(), rect.height() - scroll_view_top); 485 rect.width(), rect.height() - scroll_view_top);
481 } 486 }
482 487
488 views::View* DesktopMediaPickerDialogView::GetInitiallyFocusedView(){
489 return list_view_;
490 }
491
483 ui::ModalType DesktopMediaPickerDialogView::GetModalType() const { 492 ui::ModalType DesktopMediaPickerDialogView::GetModalType() const {
484 return ui::MODAL_TYPE_CHILD; 493 return ui::MODAL_TYPE_CHILD;
485 } 494 }
486 495
487 base::string16 DesktopMediaPickerDialogView::GetWindowTitle() const { 496 base::string16 DesktopMediaPickerDialogView::GetWindowTitle() const {
488 return l10n_util::GetStringFUTF16(IDS_DESKTOP_MEDIA_PICKER_TITLE, app_name_); 497 return l10n_util::GetStringFUTF16(IDS_DESKTOP_MEDIA_PICKER_TITLE, app_name_);
489 } 498 }
490 499
491 bool DesktopMediaPickerDialogView::IsDialogButtonEnabled( 500 bool DesktopMediaPickerDialogView::IsDialogButtonEnabled(
492 ui::DialogButton button) const { 501 ui::DialogButton button) const {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 content::BrowserThread::PostTask( 594 content::BrowserThread::PostTask(
586 content::BrowserThread::UI, FROM_HERE, 595 content::BrowserThread::UI, FROM_HERE,
587 base::Bind(callback_, source)); 596 base::Bind(callback_, source));
588 callback_.Reset(); 597 callback_.Reset();
589 } 598 }
590 599
591 // static 600 // static
592 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { 601 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
593 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); 602 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
594 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698