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

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

Issue 8642002: Enable FocusManager tests for Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 bool FocusManager::ProcessAccelerator(const ui::Accelerator& accelerator) { 378 bool FocusManager::ProcessAccelerator(const ui::Accelerator& accelerator) {
379 return accelerator_manager_->Process(accelerator); 379 return accelerator_manager_->Process(accelerator);
380 } 380 }
381 381
382 ui::AcceleratorTarget* FocusManager::GetCurrentTargetForAccelerator( 382 ui::AcceleratorTarget* FocusManager::GetCurrentTargetForAccelerator(
383 const ui::Accelerator& accelerator) const { 383 const ui::Accelerator& accelerator) const {
384 return accelerator_manager_->GetCurrentTarget(accelerator); 384 return accelerator_manager_->GetCurrentTarget(accelerator);
385 } 385 }
386 386
387 void FocusManager::FocusNativeView(gfx::NativeView native_view) {
388 widget_->FocusNativeView(native_view);
389 }
390
391 // static 387 // static
392 bool FocusManager::IsTabTraversalKeyEvent(const KeyEvent& key_event) { 388 bool FocusManager::IsTabTraversalKeyEvent(const KeyEvent& key_event) {
393 return key_event.key_code() == ui::VKEY_TAB && !key_event.IsControlDown(); 389 return key_event.key_code() == ui::VKEY_TAB && !key_event.IsControlDown();
394 } 390 }
395 391
396 void FocusManager::ViewRemoved(View* removed) { 392 void FocusManager::ViewRemoved(View* removed) {
397 // If the view being removed contains (or is) the focused view, 393 // If the view being removed contains (or is) the focused view,
398 // clear the focus. However, it's not safe to call ClearFocus() 394 // clear the focus. However, it's not safe to call ClearFocus()
399 // (and in turn ClearNativeFocus()) here because ViewRemoved() can 395 // (and in turn ClearNativeFocus()) here because ViewRemoved() can
400 // be called while the top level widget is being destroyed. 396 // be called while the top level widget is being destroyed.
401 if (focused_view_ && removed && removed->Contains(focused_view_)) 397 if (focused_view_ && removed && removed->Contains(focused_view_))
402 SetFocusedView(NULL); 398 SetFocusedView(NULL);
403 } 399 }
404 400
405 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { 401 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) {
406 focus_change_listeners_.AddObserver(listener); 402 focus_change_listeners_.AddObserver(listener);
407 } 403 }
408 404
409 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { 405 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) {
410 focus_change_listeners_.RemoveObserver(listener); 406 focus_change_listeners_.RemoveObserver(listener);
411 } 407 }
412 408
413 } // namespace views 409 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698