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

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 2691183002: Check if the focused view is valid (Closed)
Patch Set: . Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 keyboard_accessible_ = keyboard_accessible; 294 keyboard_accessible_ = keyboard_accessible;
295 // Disabling keyboard accessibility may cause the focused view to become not 295 // Disabling keyboard accessibility may cause the focused view to become not
296 // focusable. Hence advance focus if necessary. 296 // focusable. Hence advance focus if necessary.
297 AdvanceFocusIfNecessary(); 297 AdvanceFocusIfNecessary();
298 } 298 }
299 299
300 void FocusManager::SetFocusedViewWithReason( 300 void FocusManager::SetFocusedViewWithReason(
301 View* view, FocusChangeReason reason) { 301 View* view, FocusChangeReason reason) {
302 if (focused_view_ == view) 302 if (focused_view_ == view)
303 return; 303 return;
304 // TODO(oshima|achuith): This is to diagnose crbug.com/687232.
305 // Change this to DCHECK once it's resolved.
306 CHECK(!view || ContainsView(view));
304 307
305 #if !defined(OS_MACOSX) 308 #if !defined(OS_MACOSX)
306 // TODO(warx): There are some AccessiblePaneViewTest failed on macosx. 309 // TODO(warx): There are some AccessiblePaneViewTest failed on macosx.
307 // crbug.com/650859. Remove !defined(OS_MACOSX) once that is fixed. 310 // crbug.com/650859. Remove !defined(OS_MACOSX) once that is fixed.
308 // 311 //
309 // If the widget isn't active store the focused view and then attempt to 312 // If the widget isn't active store the focused view and then attempt to
310 // activate the widget. If activation succeeds |view| will be focused. 313 // activate the widget. If activation succeeds |view| will be focused.
311 // If activation fails |view| will be focused the next time the widget is 314 // If activation fails |view| will be focused the next time the widget is
312 // made active. 315 // made active.
313 if (view && !widget_->IsActive()) { 316 if (view && !widget_->IsActive()) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // |keyboard_accessible_| is only used on Mac. 559 // |keyboard_accessible_| is only used on Mac.
557 #if defined(OS_MACOSX) 560 #if defined(OS_MACOSX)
558 return keyboard_accessible_ ? view->IsAccessibilityFocusable() 561 return keyboard_accessible_ ? view->IsAccessibilityFocusable()
559 : view->IsFocusable(); 562 : view->IsFocusable();
560 #else 563 #else
561 return view->IsAccessibilityFocusable(); 564 return view->IsAccessibilityFocusable();
562 #endif 565 #endif
563 } 566 }
564 567
565 } // namespace views 568 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698