Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_window_cocoa.mm |
| diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm |
| index bfb64c41c99ab43b564bf5750e7129d2bb1ef094..958fcd6d86de24be59e0c174e9f28e5160909181 100644 |
| --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm |
| +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm |
| @@ -39,6 +39,16 @@ NSRect ConvertCoordinatesToCocoa(const gfx::Rect& bounds) { |
| bounds.width(), bounds.height()); |
| } |
| +// Converts a point from the platfrom-independent screen coordinates (with the |
| +// (0,0) in the top-left corner of the primary screen) to the Cocoa screen |
| +// coordinates (with (0,0) in the low-left corner). |
| +NSPoint ConvertPointToCocoaCoordinates(const gfx::Point& point) { |
|
jennb
2012/03/03 02:19:33
Instead of defining this twice, please put somewhe
jianli
2012/03/07 19:14:31
Done.
|
| + // Flip coordinates based on the primary screen. |
| + NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| + |
| + return NSMakePoint(point.x(), NSHeight([screen frame]) - point.y()); |
| +} |
| + |
| } // namespace |
| // This creates a shim window class, which in turn creates a Cocoa window |
| @@ -266,6 +276,10 @@ void PanelBrowserWindowCocoa::SetPanelAppIconVisibility(bool visible) { |
| // TODO(dimich): to be implemented. |
| } |
| +void PanelBrowserWindowCocoa::SetPanelAlwaysOnTop(bool on_top) { |
| + [controller_ setAlwaysOnTop:on_top]; |
| +} |
| + |
| void PanelBrowserWindowCocoa::DidCloseNativeWindow() { |
| DCHECK(!isClosed()); |
| panel_->OnNativePanelClosed(); |
| @@ -310,9 +324,10 @@ class NativePanelTestingCocoa : public NativePanelTesting { |
| NativePanelTestingCocoa(NativePanel* native_panel); |
| virtual ~NativePanelTestingCocoa() { } |
| // Overridden from NativePanelTesting |
| - virtual void PressLeftMouseButtonTitlebar(const gfx::Point& point) OVERRIDE; |
| + virtual void PressLeftMouseButtonTitlebar( |
| + const gfx::Point& mouse_location) OVERRIDE; |
| virtual void ReleaseMouseButtonTitlebar() OVERRIDE; |
| - virtual void DragTitlebar(int delta_x, int delta_y) OVERRIDE; |
| + virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE; |
| virtual void CancelDragTitlebar() OVERRIDE; |
| virtual void FinishDragTitlebar() OVERRIDE; |
| virtual bool VerifyDrawingAttention() const OVERRIDE; |
| @@ -340,16 +355,17 @@ PanelTitlebarViewCocoa* NativePanelTestingCocoa::titlebar() const { |
| } |
| void NativePanelTestingCocoa::PressLeftMouseButtonTitlebar( |
| - const gfx::Point& point) { |
| - [titlebar() pressLeftMouseButtonTitlebar]; |
| + const gfx::Point& mouse_location) { |
| + [titlebar() pressLeftMouseButtonTitlebar:ConvertPointToCocoaCoordinates( |
| + mouse_location)]; |
| } |
| void NativePanelTestingCocoa::ReleaseMouseButtonTitlebar() { |
| [titlebar() releaseLeftMouseButtonTitlebar]; |
| } |
| -void NativePanelTestingCocoa::DragTitlebar(int delta_x, int delta_y) { |
| - [titlebar() dragTitlebarDeltaX:delta_x deltaY:delta_y]; |
| +void NativePanelTestingCocoa::DragTitlebar(const gfx::Point& mouse_location) { |
| + [titlebar() dragTitlebar:ConvertPointToCocoaCoordinates(mouse_location)]; |
| } |
| void NativePanelTestingCocoa::CancelDragTitlebar() { |