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 <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // position and avoid being affected by the true mouse position. | 67 // position and avoid being affected by the true mouse position. |
68 class StatusBubbleMacIgnoreMouseMoved : public StatusBubbleMac { | 68 class StatusBubbleMacIgnoreMouseMoved : public StatusBubbleMac { |
69 public: | 69 public: |
70 StatusBubbleMacIgnoreMouseMoved(NSWindow* parent, id delegate) | 70 StatusBubbleMacIgnoreMouseMoved(NSWindow* parent, id delegate) |
71 : StatusBubbleMac(parent, delegate), mouseLocation_(0, 0) { | 71 : StatusBubbleMac(parent, delegate), mouseLocation_(0, 0) { |
72 // Set the fake mouse position to the top right of the content area. | 72 // Set the fake mouse position to the top right of the content area. |
73 NSRect contentBounds = [[parent contentView] bounds]; | 73 NSRect contentBounds = [[parent contentView] bounds]; |
74 mouseLocation_.SetPoint(NSMaxX(contentBounds), NSMaxY(contentBounds)); | 74 mouseLocation_.SetPoint(NSMaxX(contentBounds), NSMaxY(contentBounds)); |
75 } | 75 } |
76 | 76 |
77 virtual void MouseMoved( | 77 void MouseMoved(const gfx::Point& location, bool left_content) override {} |
78 const gfx::Point& location, | |
79 bool left_content) override { | |
80 } | |
81 | 78 |
82 virtual gfx::Point GetMouseLocation() override { | 79 gfx::Point GetMouseLocation() override { return mouseLocation_; } |
83 return mouseLocation_; | |
84 } | |
85 | 80 |
86 void SetMouseLocationForTesting(int x, int y) { | 81 void SetMouseLocationForTesting(int x, int y) { |
87 mouseLocation_.SetPoint(x, y); | 82 mouseLocation_.SetPoint(x, y); |
88 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); | 83 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); |
89 } | 84 } |
90 | 85 |
91 private: | 86 private: |
92 gfx::Point mouseLocation_; | 87 gfx::Point mouseLocation_; |
93 }; | 88 }; |
94 | 89 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 int windowWidth = NSWidth([window frame]); | 660 int windowWidth = NSWidth([window frame]); |
666 for (int x = 0; x < windowWidth; x += smallValue) { | 661 for (int x = 0; x < windowWidth; x += smallValue) { |
667 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 662 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
668 } | 663 } |
669 | 664 |
670 // Simulate moving the mouse from right to left. | 665 // Simulate moving the mouse from right to left. |
671 for (int x = windowWidth; x >= 0; x -= smallValue) { | 666 for (int x = windowWidth; x >= 0; x -= smallValue) { |
672 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 667 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
673 } | 668 } |
674 } | 669 } |
OLD | NEW |