OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "ui/aura/aura_switches.h" | 15 #include "ui/aura/aura_switches.h" |
16 #include "ui/aura/client/activation_client.h" | 16 #include "ui/aura/client/activation_client.h" |
17 #include "ui/aura/client/capture_client.h" | 17 #include "ui/aura/client/capture_client.h" |
18 #include "ui/aura/client/cursor_client.h" | 18 #include "ui/aura/client/cursor_client.h" |
19 #include "ui/aura/client/event_client.h" | 19 #include "ui/aura/client/event_client.h" |
20 #include "ui/aura/client/screen_position_client.h" | 20 #include "ui/aura/client/screen_position_client.h" |
21 #include "ui/aura/display_manager.h" | |
22 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
23 #include "ui/aura/event_filter.h" | 22 #include "ui/aura/event_filter.h" |
24 #include "ui/aura/focus_manager.h" | 23 #include "ui/aura/focus_manager.h" |
25 #include "ui/aura/root_window_host.h" | 24 #include "ui/aura/root_window_host.h" |
26 #include "ui/aura/root_window_observer.h" | 25 #include "ui/aura/root_window_observer.h" |
27 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
28 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
29 #include "ui/aura/window_tracker.h" | 28 #include "ui/aura/window_tracker.h" |
30 #include "ui/base/events/event.h" | 29 #include "ui/base/events/event.h" |
31 #include "ui/base/gestures/gesture_recognizer.h" | 30 #include "ui/base/gestures/gesture_recognizer.h" |
(...skipping 30 matching lines...) Expand all Loading... |
62 typedef std::vector<EventFilter*> EventFilters; | 61 typedef std::vector<EventFilter*> EventFilters; |
63 | 62 |
64 void GetEventFiltersToNotify(Window* target, EventFilters* filters) { | 63 void GetEventFiltersToNotify(Window* target, EventFilters* filters) { |
65 while (target) { | 64 while (target) { |
66 if (target->event_filter()) | 65 if (target->event_filter()) |
67 filters->push_back(target->event_filter()); | 66 filters->push_back(target->event_filter()); |
68 target = target->parent(); | 67 target = target->parent(); |
69 } | 68 } |
70 } | 69 } |
71 | 70 |
72 float GetDeviceScaleFactorFromDisplay(const Window* window) { | 71 float GetDeviceScaleFactorFromDisplay(Window* window) { |
73 DisplayManager* display_manager = Env::GetInstance()->display_manager(); | 72 return gfx::Screen::GetScreenFor(window)-> |
74 return display_manager->GetDisplayNearestWindow(window).device_scale_factor(); | 73 GetDisplayNearestWindow(window).device_scale_factor(); |
75 } | 74 } |
76 | 75 |
77 Window* ConsumerToWindow(ui::GestureConsumer* consumer) { | 76 Window* ConsumerToWindow(ui::GestureConsumer* consumer) { |
78 return consumer && !consumer->ignores_events() ? | 77 return consumer && !consumer->ignores_events() ? |
79 static_cast<Window*>(consumer) : NULL; | 78 static_cast<Window*>(consumer) : NULL; |
80 } | 79 } |
81 | 80 |
82 void SetLastMouseLocation(const Window* root_window, | 81 void SetLastMouseLocation(const Window* root_window, |
83 const gfx::Point& location) { | 82 const gfx::Point& location) { |
84 Env::GetInstance()->SetLastMouseLocation(*root_window, location); | 83 Env::GetInstance()->SetLastMouseLocation(*root_window, location); |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1039 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
1041 orig_mouse_location, | 1040 orig_mouse_location, |
1042 orig_mouse_location, | 1041 orig_mouse_location, |
1043 ui::EF_IS_SYNTHESIZED); | 1042 ui::EF_IS_SYNTHESIZED); |
1044 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1043 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
1045 OnHostMouseEvent(&event); | 1044 OnHostMouseEvent(&event); |
1046 #endif | 1045 #endif |
1047 } | 1046 } |
1048 | 1047 |
1049 } // namespace aura | 1048 } // namespace aura |
OLD | NEW |