| 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // position and avoid being affected by the true mouse position. | 64 // position and avoid being affected by the true mouse position. |
| 65 class StatusBubbleMacIgnoreMouseMoved : public StatusBubbleMac { | 65 class StatusBubbleMacIgnoreMouseMoved : public StatusBubbleMac { |
| 66 public: | 66 public: |
| 67 StatusBubbleMacIgnoreMouseMoved(NSWindow* parent, id delegate) | 67 StatusBubbleMacIgnoreMouseMoved(NSWindow* parent, id delegate) |
| 68 : StatusBubbleMac(parent, delegate), mouseLocation_(0, 0) { | 68 : StatusBubbleMac(parent, delegate), mouseLocation_(0, 0) { |
| 69 // Set the fake mouse position to the top right of the content area. | 69 // Set the fake mouse position to the top right of the content area. |
| 70 NSRect contentBounds = [[parent contentView] bounds]; | 70 NSRect contentBounds = [[parent contentView] bounds]; |
| 71 mouseLocation_.SetPoint(NSMaxX(contentBounds), NSMaxY(contentBounds)); | 71 mouseLocation_.SetPoint(NSMaxX(contentBounds), NSMaxY(contentBounds)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void MouseMoved(const gfx::Point& location, bool left_content) {} | 74 virtual void MouseMoved( |
| 75 const gfx::Point& location, |
| 76 bool left_content) OVERRIDE { |
| 77 } |
| 75 | 78 |
| 76 virtual gfx::Point GetMouseLocation() { | 79 virtual gfx::Point GetMouseLocation() OVERRIDE { |
| 77 return mouseLocation_; | 80 return mouseLocation_; |
| 78 } | 81 } |
| 79 | 82 |
| 80 void SetMouseLocationForTesting(int x, int y) { | 83 void SetMouseLocationForTesting(int x, int y) { |
| 81 mouseLocation_.SetPoint(x, y); | 84 mouseLocation_.SetPoint(x, y); |
| 82 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); | 85 StatusBubbleMac::MouseMoved(gfx::Point(x, y), false); |
| 83 } | 86 } |
| 84 | 87 |
| 85 private: | 88 private: |
| 86 gfx::Point mouseLocation_; | 89 gfx::Point mouseLocation_; |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 int windowWidth = NSWidth([window frame]); | 654 int windowWidth = NSWidth([window frame]); |
| 652 for (int x = 0; x < windowWidth; x += smallValue) { | 655 for (int x = 0; x < windowWidth; x += smallValue) { |
| 653 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 656 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
| 654 } | 657 } |
| 655 | 658 |
| 656 // Simulate moving the mouse from right to left. | 659 // Simulate moving the mouse from right to left. |
| 657 for (int x = windowWidth; x >= 0; x -= smallValue) { | 660 for (int x = windowWidth; x >= 0; x -= smallValue) { |
| 658 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); | 661 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); |
| 659 } | 662 } |
| 660 } | 663 } |
| OLD | NEW |