OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/tabs/dock_info.h" | 5 #include "chrome/browser/ui/tabs/dock_info.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser_list.h" | 7 #include "ui/aura/root_window.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "ui/aura/window.h" |
9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "ui/gfx/compositor/layer.h" |
10 #include "chrome/browser/ui/views/tabs/tab.h" | |
11 #include "ui/gfx/screen.h" | |
12 #if defined(OS_WIN) | |
13 #include "base/win/scoped_gdi_object.h" | |
14 #endif | |
15 | 10 |
16 // DockInfo ------------------------------------------------------------------- | 11 // DockInfo ------------------------------------------------------------------- |
17 | 12 |
| 13 namespace { |
| 14 |
| 15 aura::Window* GetLocalProcessWindowAtPointImpl( |
| 16 const gfx::Point& screen_point, |
| 17 const std::set<gfx::NativeView>& ignore, |
| 18 aura::Window* window) { |
| 19 if (ignore.find(window) != ignore.end()) |
| 20 return NULL; |
| 21 |
| 22 if (!window->IsVisible()) |
| 23 return NULL; |
| 24 |
| 25 if (window->layer()->type() == ui::Layer::LAYER_HAS_TEXTURE) { |
| 26 gfx::Point window_point(screen_point); |
| 27 aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(), window, |
| 28 &window_point); |
| 29 return gfx::Rect(window->bounds().size()).Contains(window_point) ? |
| 30 window : NULL; |
| 31 } |
| 32 for (aura::Window::Windows::const_reverse_iterator i = |
| 33 window->children().rbegin(); i != window->children().rend(); ++i) { |
| 34 aura::Window* result = |
| 35 GetLocalProcessWindowAtPointImpl(screen_point, ignore, *i); |
| 36 if (result) |
| 37 return result; |
| 38 } |
| 39 return NULL; |
| 40 } |
| 41 |
| 42 } // namespace |
| 43 |
18 // static | 44 // static |
19 DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point, | 45 DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point, |
20 const std::set<gfx::NativeView>& ignore) { | 46 const std::set<gfx::NativeView>& ignore) { |
21 // TODO(beng): | 47 // TODO(beng): |
22 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
23 return DockInfo(); | 49 return DockInfo(); |
24 } | 50 } |
25 | 51 |
| 52 // static |
26 gfx::NativeView DockInfo::GetLocalProcessWindowAtPoint( | 53 gfx::NativeView DockInfo::GetLocalProcessWindowAtPoint( |
27 const gfx::Point& screen_point, | 54 const gfx::Point& screen_point, |
28 const std::set<gfx::NativeView>& ignore) { | 55 const std::set<gfx::NativeView>& ignore) { |
29 // TODO(beng): | 56 return GetLocalProcessWindowAtPointImpl( |
30 NOTIMPLEMENTED(); | 57 screen_point, ignore, aura::RootWindow::GetInstance()); |
31 return NULL; | |
32 } | 58 } |
33 | 59 |
34 bool DockInfo::GetWindowBounds(gfx::Rect* bounds) const { | 60 bool DockInfo::GetWindowBounds(gfx::Rect* bounds) const { |
35 // TODO(beng): | 61 if (!window()) |
36 NOTIMPLEMENTED(); | 62 return false; |
| 63 *bounds = window_->bounds(); |
37 return true; | 64 return true; |
38 } | 65 } |
39 | 66 |
40 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { | 67 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { |
41 // TODO(beng): | 68 window_->SetBounds(bounds); |
42 NOTIMPLEMENTED(); | |
43 } | 69 } |
OLD | NEW |