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

Unified Diff: ui/wm/core/base_focus_rules.cc

Issue 2809073002: cros: allow aura window not considered activatable for pointer event (Closed)
Patch Set: feedback from sky Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/wm/core/base_focus_rules.cc
diff --git a/ui/wm/core/base_focus_rules.cc b/ui/wm/core/base_focus_rules.cc
index e38aa2e5508dcc9779ea303e54d2d5352e851713..e6b42d4822584e100ac243a99f37bfa02590002e 100644
--- a/ui/wm/core/base_focus_rules.cc
+++ b/ui/wm/core/base_focus_rules.cc
@@ -16,7 +16,7 @@ namespace {
aura::Window* GetFocusedWindow(aura::Window* context) {
aura::client::FocusClient* focus_client =
aura::client::GetFocusClient(context);
- return focus_client ? focus_client->GetFocusedWindow() : NULL;
+ return focus_client ? focus_client->GetFocusedWindow() : nullptr;
}
} // namespace
@@ -24,11 +24,9 @@ aura::Window* GetFocusedWindow(aura::Window* context) {
////////////////////////////////////////////////////////////////////////////////
// BaseFocusRules, protected:
-BaseFocusRules::BaseFocusRules() {
-}
+BaseFocusRules::BaseFocusRules() = default;
-BaseFocusRules::~BaseFocusRules() {
-}
+BaseFocusRules::~BaseFocusRules() = default;
bool BaseFocusRules::IsWindowConsideredVisibleForActivation(
aura::Window* window) const {
@@ -78,7 +76,8 @@ bool BaseFocusRules::CanActivateWindow(aura::Window* window) const {
return !GetModalTransient(window);
}
-bool BaseFocusRules::CanFocusWindow(aura::Window* window) const {
+bool BaseFocusRules::CanFocusWindow(aura::Window* window,
+ ui::Event* event) const {
// It is possible to focus a NULL window, it is equivalent to clearing focus.
if (!window)
return true;
@@ -101,7 +100,7 @@ aura::Window* BaseFocusRules::GetToplevelWindow(aura::Window* window) const {
parent = parent->parent();
child = child->parent();
}
- return NULL;
+ return nullptr;
}
aura::Window* BaseFocusRules::GetActivatableWindow(aura::Window* window) const {
@@ -133,11 +132,11 @@ aura::Window* BaseFocusRules::GetActivatableWindow(aura::Window* window) const {
parent = parent->parent();
child = child->parent();
}
- return NULL;
+ return nullptr;
}
aura::Window* BaseFocusRules::GetFocusableWindow(aura::Window* window) const {
- if (CanFocusWindow(window))
+ if (CanFocusWindow(window, nullptr))
return window;
// |window| may be in a hierarchy that is non-activatable, in which case we
@@ -150,7 +149,7 @@ aura::Window* BaseFocusRules::GetFocusableWindow(aura::Window* window) const {
if (toplevel)
activatable = GetNextActivatableWindow(toplevel);
if (!activatable)
- return NULL;
+ return nullptr;
}
if (!activatable->Contains(window)) {
@@ -161,7 +160,7 @@ aura::Window* BaseFocusRules::GetFocusableWindow(aura::Window* window) const {
return activatable->Contains(focused) ? focused : activatable;
}
- while (window && !CanFocusWindow(window))
+ while (window && !CanFocusWindow(window, nullptr))
window = window->parent();
return window;
}
@@ -172,7 +171,7 @@ aura::Window* BaseFocusRules::GetNextActivatableWindow(
// Can be called from the RootWindow's destruction, which has a NULL parent.
if (!ignore->parent())
- return NULL;
+ return nullptr;
// In the basic scenarios handled by BasicFocusRules, the pool of activatable
// windows is limited to the |ignore|'s siblings.
@@ -188,7 +187,7 @@ aura::Window* BaseFocusRules::GetNextActivatableWindow(
if (CanActivateWindow(cur))
return cur;
}
- return NULL;
+ return nullptr;
}
} // namespace wm

Powered by Google App Engine
This is Rietveld 408576698