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

Unified Diff: ui/views/accessibility/ax_aura_obj_cache.cc

Issue 2530073002: Add kAccessibilityFocusFallsbackToWidget property (Closed)
Patch Set: Check whether the window is arc or not Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/accessibility/ax_aura_obj_cache.cc
diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc
index 0ce0047c9987815064f5f795ccbb317198d53528..8fd37da7299584b6bc683ff17d5f4c1e95beb395 100644
--- a/ui/views/accessibility/ax_aura_obj_cache.cc
+++ b/ui/views/accessibility/ax_aura_obj_cache.cc
@@ -6,6 +6,8 @@
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
+#include "base/strings/string_util.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/window.h"
#include "ui/views/accessibility/ax_aura_obj_wrapper.h"
@@ -17,6 +19,27 @@
namespace views {
+namespace {
+
+const char kExoShellSurfaceWindowName[] = "ExoShellSurface";
+const char kArcProcessNamePrefix[] = "org.chromium.arc.";
+
+// TODO(yawano): chrome/browser/memory/tab_manager_delegate_chromeos.cc is doing
+// the same thing. Move this to some utility function and share the logic with
+// it.
+bool IsArcWindow(aura::Window* window) {
sky 2016/12/06 17:23:20 Views shouldn't need to know about arc. Instead th
yawano 2016/12/07 11:10:00 Thank you! Seems good property for this behavior.
+ if (!window || window->GetName() != kExoShellSurfaceWindowName)
sky 2016/12/02 17:49:56 Why do you need to check the name *and* the kAppId
sky 2016/12/02 17:50:40 Also, can't you set an explicit property rather th
yawano 2016/12/05 02:16:36 As far as I tested, checking only kAppIdKey would
reveman 2016/12/05 16:42:37 We already do this. exo::ShellSurface::GetMainSurf
reveman 2016/12/05 16:42:37 exo::ShellSurface::GetMainSurface can be used to m
+ return false;
+
+ std::string* application_id = window->GetProperty(aura::client::kAppIdKey);
+ if (!application_id)
+ return false;
+
+ return base::StartsWith(*application_id, kArcProcessNamePrefix,
+ base::CompareCase::SENSITIVE);
+}
+} // namespace
+
// static
AXAuraObjCache* AXAuraObjCache::GetInstance() {
return base::Singleton<AXAuraObjCache>::get();
@@ -158,10 +181,14 @@ View* AXAuraObjCache::GetFocusedView() {
return nullptr;
View* focused_view = focus_manager->GetFocusedView();
- if (focused_view)
+
+ // If focused window is arc, don't try to put focus on root view even if
+ // focused_view is nullptr.
+ if (IsArcWindow(focused_window) || focused_view)
return focused_view;
- else
- return focused_widget->GetRootView();
+
+ // If no view is focused, falls back to root view.
+ return focused_widget->GetRootView();
}
void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus,
« no previous file with comments | « chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698