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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual void MouseMoved( |
78 const gfx::Point& location, | 78 const gfx::Point& location, |
79 bool left_content) OVERRIDE { | 79 bool left_content) override { |
80 } | 80 } |
81 | 81 |
82 virtual gfx::Point GetMouseLocation() OVERRIDE { | 82 virtual gfx::Point GetMouseLocation() override { |
83 return mouseLocation_; | 83 return mouseLocation_; |
84 } | 84 } |
85 | 85 |
86 void SetMouseLocationForTesting(int x, int y) { | 86 void SetMouseLocationForTesting(int x, int y) { |
87 mouseLocation_.SetPoint(x, y); | 87 mouseLocation_.SetPoint(x, y); |
88 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); | 88 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 gfx::Point mouseLocation_; | 92 gfx::Point mouseLocation_; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 int windowWidth = NSWidth([window frame]); | 665 int windowWidth = NSWidth([window frame]); |
666 for (int x = 0; x < windowWidth; x += smallValue) { | 666 for (int x = 0; x < windowWidth; x += smallValue) { |
667 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 667 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
668 } | 668 } |
669 | 669 |
670 // Simulate moving the mouse from right to left. | 670 // Simulate moving the mouse from right to left. |
671 for (int x = windowWidth; x >= 0; x -= smallValue) { | 671 for (int x = windowWidth; x >= 0; x -= smallValue) { |
672 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 672 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
673 } | 673 } |
674 } | 674 } |
OLD | NEW |