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 #ifndef UI_AURA_ROOT_WINDOW_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_H_ |
6 #define UI_AURA_ROOT_WINDOW_H_ | 6 #define UI_AURA_ROOT_WINDOW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
15 #include "ui/aura/aura_export.h" | 16 #include "ui/aura/aura_export.h" |
16 #include "ui/aura/client/capture_delegate.h" | 17 #include "ui/aura/client/capture_delegate.h" |
17 #include "ui/aura/root_window_host_delegate.h" | 18 #include "ui/aura/root_window_host_delegate.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/base/cursor/cursor.h" | 20 #include "ui/base/cursor/cursor.h" |
20 #include "ui/base/events/event_constants.h" | 21 #include "ui/base/events/event_constants.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 virtual void ReleaseNativeCapture() OVERRIDE; | 287 virtual void ReleaseNativeCapture() OVERRIDE; |
287 | 288 |
288 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. | 289 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. |
289 bool QueryMouseLocationForTest(gfx::Point* point) const; | 290 bool QueryMouseLocationForTest(gfx::Point* point) const; |
290 | 291 |
291 // Clears internal mouse state (such as mouse ups should be sent to the same | 292 // Clears internal mouse state (such as mouse ups should be sent to the same |
292 // window that ate mouse downs). | 293 // window that ate mouse downs). |
293 void ClearMouseHandlers(); | 294 void ClearMouseHandlers(); |
294 | 295 |
295 private: | 296 private: |
| 297 FRIEND_TEST_ALL_PREFIXES(RootWindowTest, KeepTranslatedEventInRoot); |
| 298 |
296 friend class Window; | 299 friend class Window; |
297 friend class TestScreen; | 300 friend class TestScreen; |
298 | 301 |
299 // The parameter for OnWindowHidden() to specify why window is hidden. | 302 // The parameter for OnWindowHidden() to specify why window is hidden. |
300 enum WindowHiddenReason { | 303 enum WindowHiddenReason { |
301 WINDOW_DESTROYED, // Window is destroyed. | 304 WINDOW_DESTROYED, // Window is destroyed. |
302 WINDOW_HIDDEN, // Window is hidden. | 305 WINDOW_HIDDEN, // Window is hidden. |
303 WINDOW_MOVING, // Window is temporarily marked as hidden due to move | 306 WINDOW_MOVING, // Window is temporarily marked as hidden due to move |
304 // across root windows. | 307 // across root windows. |
305 }; | 308 }; |
306 | 309 |
307 // Updates the event with the appropriate transform for the device scale | 310 // Updates the event with the appropriate transform for the device scale |
308 // factor. The RootWindowHostDelegate dispatches events in the physical pixel | 311 // factor. The RootWindowHostDelegate dispatches events in the physical pixel |
309 // coordinate. But the event processing from RootWindow onwards happen in | 312 // coordinate. But the event processing from RootWindow onwards happen in |
310 // device-independent pixel coordinate. So it is necessary to update the event | 313 // device-independent pixel coordinate. So it is necessary to update the event |
311 // received from the host. | 314 // received from the host. When |keep_inside_root| is true and the event's |
312 void TransformEventForDeviceScaleFactor(ui::LocatedEvent* event); | 315 // system location is inside host window's bounds, the location will be |
| 316 // kept inside the root window's bounds. |
| 317 void TransformEventForDeviceScaleFactor(bool keep_inside_root, |
| 318 ui::LocatedEvent* event); |
313 | 319 |
314 // Called whenever the mouse moves, tracks the current |mouse_moved_handler_|, | 320 // Called whenever the mouse moves, tracks the current |mouse_moved_handler_|, |
315 // sending exited and entered events as its value changes. | 321 // sending exited and entered events as its value changes. |
316 void HandleMouseMoved(const ui::MouseEvent& event, Window* target); | 322 void HandleMouseMoved(const ui::MouseEvent& event, Window* target); |
317 | 323 |
318 // Dispatches the specified event type (intended for enter/exit) to the | 324 // Dispatches the specified event type (intended for enter/exit) to the |
319 // |mouse_moved_handler_|. | 325 // |mouse_moved_handler_|. |
320 void DispatchMouseEnterOrExit(const ui::MouseEvent& event, | 326 void DispatchMouseEnterOrExit(const ui::MouseEvent& event, |
321 ui::EventType type); | 327 ui::EventType type); |
322 | 328 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // Note that this should not be confused with the device scale | 461 // Note that this should not be confused with the device scale |
456 // factor, which specfies the pixel density of the display. | 462 // factor, which specfies the pixel density of the display. |
457 float root_window_scale_; | 463 float root_window_scale_; |
458 | 464 |
459 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 465 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
460 }; | 466 }; |
461 | 467 |
462 } // namespace aura | 468 } // namespace aura |
463 | 469 |
464 #endif // UI_AURA_ROOT_WINDOW_H_ | 470 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |