Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / tabs / window_finder_ash.cc
bloba0cbe04768e32634d0b2eca4638133409720753e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/tabs/window_finder.h"
7 #include "ash/shell_window_ids.h"
8 #include "ash/wm/coordinate_conversion.h"
9 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h"
12 namespace {
14 gfx::NativeWindow GetLocalProcessWindowAtPointImpl(
15 const gfx::Point& screen_point,
16 const std::set<gfx::NativeWindow>& ignore,
17 gfx::NativeWindow window) {
18 if (ignore.find(window) != ignore.end())
19 return NULL;
21 if (!window->IsVisible())
22 return NULL;
24 if (window->id() == ash::kShellWindowId_PhantomWindow ||
25 window->id() == ash::kShellWindowId_OverlayContainer ||
26 window->id() == ash::kShellWindowId_MouseCursorContainer)
27 return NULL;
29 if (window->layer()->type() == ui::LAYER_TEXTURED)
30 return window->GetBoundsInScreen().Contains(screen_point) ? window : NULL;
32 for (aura::Window::Windows::const_reverse_iterator i =
33 window->children().rbegin(); i != window->children().rend(); ++i) {
34 gfx::NativeWindow result =
35 GetLocalProcessWindowAtPointImpl(screen_point, ignore, *i);
36 if (result)
37 return result;
39 return NULL;
42 } // namespace
44 gfx::NativeWindow GetLocalProcessWindowAtPointAsh(
45 const gfx::Point& screen_point,
46 const std::set<gfx::NativeWindow>& ignore) {
47 return GetLocalProcessWindowAtPointImpl(
48 screen_point, ignore, ::ash::wm::GetRootWindowAt(screen_point));