| Index: ui/wm/core/focus_controller.cc
|
| diff --git a/ui/wm/core/focus_controller.cc b/ui/wm/core/focus_controller.cc
|
| index 594e66ee94db2655a9a8064e0c57e69141603ee3..81ee8be3391eea5dd8d0e84d6362a5986a618038 100644
|
| --- a/ui/wm/core/focus_controller.cc
|
| +++ b/ui/wm/core/focus_controller.cc
|
| @@ -38,8 +38,8 @@ void StackTransientParentsBelowModalWindow(aura::Window* window) {
|
| // FocusController, public:
|
|
|
| FocusController::FocusController(FocusRules* rules)
|
| - : active_window_(NULL),
|
| - focused_window_(NULL),
|
| + : active_window_(nullptr),
|
| + focused_window_(nullptr),
|
| updating_focus_(false),
|
| updating_activation_(false),
|
| rules_(rules),
|
| @@ -47,8 +47,7 @@ FocusController::FocusController(FocusRules* rules)
|
| DCHECK(rules);
|
| }
|
|
|
| -FocusController::~FocusController() {
|
| -}
|
| +FocusController::~FocusController() = default;
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // FocusController, aura::client::ActivationClient implementation:
|
| @@ -127,7 +126,8 @@ void FocusController::OnKeyEvent(ui::KeyEvent* event) {
|
|
|
| void FocusController::OnMouseEvent(ui::MouseEvent* event) {
|
| if (event->type() == ui::ET_MOUSE_PRESSED && !event->handled())
|
| - WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target()));
|
| + WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target()),
|
| + event);
|
| }
|
|
|
| void FocusController::OnScrollEvent(ui::ScrollEvent* event) {
|
| @@ -140,7 +140,8 @@ void FocusController::OnGestureEvent(ui::GestureEvent* event) {
|
| if (event->type() == ui::ET_GESTURE_BEGIN &&
|
| event->details().touch_points() == 1 &&
|
| !event->handled()) {
|
| - WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target()));
|
| + WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target()),
|
| + event);
|
| }
|
| }
|
|
|
| @@ -196,7 +197,7 @@ void FocusController::FocusAndActivateWindow(
|
| // that the rules could redirect activation activation and/or focus.
|
| aura::Window* focusable = rules_->GetFocusableWindow(window);
|
| aura::Window* activatable =
|
| - focusable ? rules_->GetActivatableWindow(focusable) : NULL;
|
| + focusable ? rules_->GetActivatableWindow(focusable) : nullptr;
|
|
|
| // We need valid focusable/activatable windows in the event we're not clearing
|
| // focus. "Clearing focus" is inferred by whether or not |window| passed to
|
| @@ -247,7 +248,7 @@ void FocusController::SetFocusedWindow(aura::Window* window) {
|
| for (auto& observer : focus_observers_) {
|
| observer.OnWindowFocused(
|
| focused_window_,
|
| - window_tracker.Contains(lost_focus) ? lost_focus : NULL);
|
| + window_tracker.Contains(lost_focus) ? lost_focus : nullptr);
|
| }
|
| if (window_tracker.Contains(lost_focus)) {
|
| aura::client::FocusChangeObserver* observer =
|
| @@ -260,7 +261,7 @@ void FocusController::SetFocusedWindow(aura::Window* window) {
|
| if (observer) {
|
| observer->OnWindowFocused(
|
| focused_window_,
|
| - window_tracker.Contains(lost_focus) ? lost_focus : NULL);
|
| + window_tracker.Contains(lost_focus) ? lost_focus : nullptr);
|
| }
|
| }
|
|
|
| @@ -300,7 +301,7 @@ void FocusController::SetActiveWindow(
|
| if (active_window_)
|
| StackActiveWindow();
|
|
|
| - aura::client::ActivationChangeObserver* observer = NULL;
|
| + aura::client::ActivationChangeObserver* observer = nullptr;
|
| if (window_tracker.Contains(lost_activation)) {
|
| observer = aura::client::GetActivationChangeObserver(lost_activation);
|
| if (observer)
|
| @@ -310,12 +311,12 @@ void FocusController::SetActiveWindow(
|
| if (observer) {
|
| observer->OnWindowActivated(
|
| reason, active_window_,
|
| - window_tracker.Contains(lost_activation) ? lost_activation : NULL);
|
| + window_tracker.Contains(lost_activation) ? lost_activation : nullptr);
|
| }
|
| for (auto& observer : activation_observers_) {
|
| observer.OnWindowActivated(
|
| reason, active_window_,
|
| - window_tracker.Contains(lost_activation) ? lost_activation : NULL);
|
| + window_tracker.Contains(lost_activation) ? lost_activation : nullptr);
|
| }
|
| }
|
|
|
| @@ -338,7 +339,7 @@ void FocusController::WindowLostFocusFromDispositionChange(
|
| aura::Window* next_activatable = rules_->GetNextActivatableWindow(window);
|
| SetActiveWindow(aura::client::ActivationChangeObserver::ActivationReason::
|
| WINDOW_DISPOSITION_CHANGED,
|
| - NULL, next_activatable);
|
| + nullptr, next_activatable);
|
| if (!(active_window_ && active_window_->Contains(focused_window_)))
|
| SetFocusedWindow(next_activatable);
|
| } else if (window->Contains(focused_window_)) {
|
| @@ -347,7 +348,11 @@ void FocusController::WindowLostFocusFromDispositionChange(
|
| }
|
| }
|
|
|
| -void FocusController::WindowFocusedFromInputEvent(aura::Window* window) {
|
| +void FocusController::WindowFocusedFromInputEvent(aura::Window* window,
|
| + ui::Event* event) {
|
| + if (!rules_->IsWindowConsideredActivatableForEvent(window, event))
|
| + return;
|
| +
|
| // Only focus |window| if it or any of its parents can be focused. Otherwise
|
| // FocusWindow() will focus the topmost window, which may not be the
|
| // currently focused one.
|
|
|