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

Side by Side Diff: ui/views/window/dialog_delegate.cc

Issue 2604303002: (Mac)Views: Widgets focus first View in traversal order if initial focus fails. (Closed)
Patch Set: Use views:: everywhere for consistency (?) Created 3 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/window/dialog_delegate.h" 5 #include "ui/views/window/dialog_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 NOTREACHED(); 157 NOTREACHED();
158 return base::string16(); 158 return base::string16();
159 } 159 }
160 160
161 bool DialogDelegate::IsDialogButtonEnabled(ui::DialogButton button) const { 161 bool DialogDelegate::IsDialogButtonEnabled(ui::DialogButton button) const {
162 return true; 162 return true;
163 } 163 }
164 164
165 View* DialogDelegate::GetInitiallyFocusedView() { 165 View* DialogDelegate::GetInitiallyFocusedView() {
166 const DialogClientView* dcv = GetDialogClientView();
167 if (!dcv->GetFocusManager()->keyboard_accessible())
karandeepb 2016/12/30 21:16:04 null-check the focus manager? Did you test this
Patti Lor 2017/01/03 03:48:26 Oops, that's a mistake. I originally had the #ifde
karandeepb 2017/01/04 00:12:33 Yeah this seems reasonable to me as well, though o
168 return NULL;
169
166 // Focus the default button if any. 170 // Focus the default button if any.
167 const DialogClientView* dcv = GetDialogClientView();
168 int default_button = GetDefaultDialogButton(); 171 int default_button = GetDefaultDialogButton();
169 if (default_button == ui::DIALOG_BUTTON_NONE) 172 if (default_button == ui::DIALOG_BUTTON_NONE)
170 return NULL; 173 return NULL;
171 174
172 if ((default_button & GetDialogButtons()) == 0) { 175 if ((default_button & GetDialogButtons()) == 0) {
173 // The default button is a button we don't have. 176 // The default button is a button we don't have.
174 NOTREACHED(); 177 NOTREACHED();
175 return NULL; 178 return NULL;
176 } 179 }
177 180
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 node_data->role = ui::AX_ROLE_DIALOG; 264 node_data->role = ui::AX_ROLE_DIALOG;
262 } 265 }
263 266
264 void DialogDelegateView::ViewHierarchyChanged( 267 void DialogDelegateView::ViewHierarchyChanged(
265 const ViewHierarchyChangedDetails& details) { 268 const ViewHierarchyChangedDetails& details) {
266 if (details.is_add && details.child == this && GetWidget()) 269 if (details.is_add && details.child == this && GetWidget())
267 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 270 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
268 } 271 }
269 272
270 } // namespace views 273 } // namespace views
OLDNEW
« ui/views/controls/focus_ring.cc ('K') | « ui/views/controls/focus_ring.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698