Index: ash/wm/ash_focus_rules.cc |
diff --git a/ash/wm/ash_focus_rules.cc b/ash/wm/ash_focus_rules.cc |
index ac4d9a8d5632563c6275db5b47a2fa061bc2e870..21f7f023f569b2c3a1ed7704f04980addde85e65 100644 |
--- a/ash/wm/ash_focus_rules.cc |
+++ b/ash/wm/ash_focus_rules.cc |
@@ -13,7 +13,9 @@ |
#include "ash/wm/window_state.h" |
#include "ash/wm/window_state_aura.h" |
#include "ash/wm_window.h" |
+#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/window.h" |
+#include "ui/events/event.h" |
namespace ash { |
namespace wm { |
@@ -33,13 +35,9 @@ bool BelongsToContainerWithEqualOrGreaterId(const aura::Window* window, |
//////////////////////////////////////////////////////////////////////////////// |
// AshFocusRules, public: |
-AshFocusRules::AshFocusRules() {} |
+AshFocusRules::AshFocusRules() = default; |
-AshFocusRules::~AshFocusRules() {} |
- |
-bool AshFocusRules::IsWindowConsideredActivatable(aura::Window* window) const { |
- return ash::IsWindowConsideredActivatable(WmWindow::Get(window)); |
-} |
+AshFocusRules::~AshFocusRules() = default; |
//////////////////////////////////////////////////////////////////////////////// |
// AshFocusRules, ::wm::FocusRules: |
@@ -73,6 +71,19 @@ bool AshFocusRules::CanActivateWindow(aura::Window* window) const { |
return true; |
} |
+bool AshFocusRules::CanFocusWindow(aura::Window* window, |
+ const ui::Event* event) const { |
+ if (!window) |
+ return true; |
+ |
+ if (event && (event->IsMouseEvent() || event->IsGestureEvent()) && |
oshima
2017/04/27 20:50:17
We don't need to check touch event?
Qiang(Joe) Xu
2017/04/27 21:32:24
yes, touch event is actually handled in https://cs
|
+ !window->GetProperty(aura::client::kActivateOnPointerKey)) { |
+ return false; |
+ } |
+ |
+ return BaseFocusRules::CanFocusWindow(window, event); |
+} |
+ |
aura::Window* AshFocusRules::GetNextActivatableWindow( |
aura::Window* ignore) const { |
DCHECK(ignore); |
@@ -141,7 +152,7 @@ aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( |
!window_state->IsMinimized()) |
return *i; |
} |
- return NULL; |
+ return nullptr; |
} |
} // namespace wm |