OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ash/display/screen_ash.h" | 5 #include "ash/display/screen_ash.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/root_window_settings.h" | 10 #include "ash/root_window_settings.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class ScreenForShutdown : public display::Screen { | 32 class ScreenForShutdown : public display::Screen { |
33 public: | 33 public: |
34 explicit ScreenForShutdown(ScreenAsh* screen_ash) | 34 explicit ScreenForShutdown(ScreenAsh* screen_ash) |
35 : display_list_(screen_ash->GetAllDisplays()), | 35 : display_list_(screen_ash->GetAllDisplays()), |
36 primary_display_(screen_ash->GetPrimaryDisplay()) { | 36 primary_display_(screen_ash->GetPrimaryDisplay()) { |
37 } | 37 } |
38 | 38 |
39 // display::Screen overrides: | 39 // display::Screen overrides: |
40 gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } | 40 gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } |
41 gfx::NativeWindow GetWindowUnderCursor() override { return NULL; } | 41 bool IsWindowUnderCursor(gfx::NativeWindow window) override { return false; } |
42 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override { | 42 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override { |
43 return NULL; | 43 return NULL; |
44 } | 44 } |
45 int GetNumDisplays() const override { return display_list_.size(); } | 45 int GetNumDisplays() const override { return display_list_.size(); } |
46 std::vector<display::Display> GetAllDisplays() const override { | 46 std::vector<display::Display> GetAllDisplays() const override { |
47 return display_list_; | 47 return display_list_; |
48 } | 48 } |
49 display::Display GetDisplayNearestWindow( | 49 display::Display GetDisplayNearestWindow( |
50 gfx::NativeView view) const override { | 50 gfx::NativeView view) const override { |
51 return primary_display_; | 51 return primary_display_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void ScreenAsh::NotifyDisplayRemoved(const display::Display& display) { | 98 void ScreenAsh::NotifyDisplayRemoved(const display::Display& display) { |
99 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 99 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, |
100 OnDisplayRemoved(display)); | 100 OnDisplayRemoved(display)); |
101 } | 101 } |
102 | 102 |
103 gfx::Point ScreenAsh::GetCursorScreenPoint() { | 103 gfx::Point ScreenAsh::GetCursorScreenPoint() { |
104 return aura::Env::GetInstance()->last_mouse_location(); | 104 return aura::Env::GetInstance()->last_mouse_location(); |
105 } | 105 } |
106 | 106 |
107 gfx::NativeWindow ScreenAsh::GetWindowUnderCursor() { | 107 bool ScreenAsh::IsWindowUnderCursor(gfx::NativeWindow window) { |
108 return GetWindowAtScreenPoint( | 108 return GetWindowAtScreenPoint( |
109 display::Screen::GetScreen()->GetCursorScreenPoint()); | 109 display::Screen::GetScreen()->GetCursorScreenPoint()) == window; |
110 } | 110 } |
111 | 111 |
112 gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) { | 112 gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) { |
113 aura::Window* root_window = | 113 aura::Window* root_window = |
114 wm::WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(point)); | 114 wm::WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(point)); |
115 aura::client::ScreenPositionClient* position_client = | 115 aura::client::ScreenPositionClient* position_client = |
116 aura::client::GetScreenPositionClient(root_window); | 116 aura::client::GetScreenPositionClient(root_window); |
117 | 117 |
118 gfx::Point local_point = point; | 118 gfx::Point local_point = point; |
119 if (position_client) | 119 if (position_client) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 void ScreenAsh::RemoveObserver(display::DisplayObserver* observer) { | 189 void ScreenAsh::RemoveObserver(display::DisplayObserver* observer) { |
190 observers_.RemoveObserver(observer); | 190 observers_.RemoveObserver(observer); |
191 } | 191 } |
192 | 192 |
193 display::Screen* ScreenAsh::CloneForShutdown() { | 193 display::Screen* ScreenAsh::CloneForShutdown() { |
194 return new ScreenForShutdown(this); | 194 return new ScreenForShutdown(this); |
195 } | 195 } |
196 | 196 |
197 } // namespace ash | 197 } // namespace ash |
OLD | NEW |