| 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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 #include "ash/display/display_manager.h" | 6 #include "ash/display/display_manager.h" |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 location_.ToString() + " " + root_location_.ToString(); | 94 location_.ToString() + " " + root_location_.ToString(); |
| 95 reset(); | 95 reset(); |
| 96 return result; | 96 return result; |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 // ui::EventHandler overrides: | 100 // ui::EventHandler overrides: |
| 101 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 101 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
| 102 if (event->type() == ui::ET_MOUSE_MOVED || | 102 if (event->type() == ui::ET_MOUSE_MOVED || |
| 103 event->type() == ui::ET_MOUSE_DRAGGED) { | 103 event->type() == ui::ET_MOUSE_DRAGGED) { |
| 104 location_ = event->location(); | 104 location_ = gfx::ToFlooredPoint(event->location()); |
| 105 root_location_ = event->root_location(); | 105 root_location_ = event->root_location(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 void reset() { | 109 void reset() { |
| 110 location_.SetPoint(-999, -999); | 110 location_.SetPoint(-999, -999); |
| 111 root_location_.SetPoint(-999, -999); | 111 root_location_.SetPoint(-999, -999); |
| 112 } | 112 } |
| 113 | 113 |
| 114 gfx::Point root_location_; | 114 gfx::Point root_location_; |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 generator.ReleaseLeftButton(); | 797 generator.ReleaseLeftButton(); |
| 798 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 798 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
| 799 | 799 |
| 800 generator.MoveMouseTo(400, 150); | 800 generator.MoveMouseTo(400, 150); |
| 801 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 801 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
| 802 | 802 |
| 803 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 803 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 804 } | 804 } |
| 805 | 805 |
| 806 } // namespace ash | 806 } // namespace ash |
| OLD | NEW |