| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" | 5 #include "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 497 |
| 498 void NativeWidgetMac::RunShellDrag(View* view, | 498 void NativeWidgetMac::RunShellDrag(View* view, |
| 499 const ui::OSExchangeData& data, | 499 const ui::OSExchangeData& data, |
| 500 const gfx::Point& location, | 500 const gfx::Point& location, |
| 501 int operation, | 501 int operation, |
| 502 ui::DragDropTypes::DragEventSource source) { | 502 ui::DragDropTypes::DragEventSource source) { |
| 503 NOTIMPLEMENTED(); | 503 NOTIMPLEMENTED(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { | 506 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { |
| 507 // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate | 507 // |rect| is relative to client area of the window. |
| 508 // system of |rect| has been converted. | 508 NSWindow* window = GetNativeWindow(); |
| 509 [GetNativeView() setNeedsDisplay:YES]; | 509 NSRect client_rect = [window contentRectForFrameRect:[window frame]]; |
| 510 NSRect target_rect = rect.ToCGRect(); |
| 511 |
| 512 // Convert to Appkit coordinate system (origin at bottom left). |
| 513 target_rect.origin.y = |
| 514 NSHeight(client_rect) - target_rect.origin.y - NSHeight(target_rect); |
| 515 [GetNativeView() setNeedsDisplayInRect:target_rect]; |
| 510 if (bridge_ && bridge_->layer()) | 516 if (bridge_ && bridge_->layer()) |
| 511 bridge_->layer()->SchedulePaint(rect); | 517 bridge_->layer()->SchedulePaint(rect); |
| 512 } | 518 } |
| 513 | 519 |
| 514 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { | 520 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { |
| 515 if (bridge_) | 521 if (bridge_) |
| 516 bridge_->SetCursor(cursor); | 522 bridge_->SetCursor(cursor); |
| 517 } | 523 } |
| 518 | 524 |
| 519 bool NativeWidgetMac::IsMouseEventsEnabled() const { | 525 bool NativeWidgetMac::IsMouseEventsEnabled() const { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 729 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 724 } | 730 } |
| 725 | 731 |
| 726 - (void)animationDidEnd:(NSAnimation*)animation { | 732 - (void)animationDidEnd:(NSAnimation*)animation { |
| 727 [window_ close]; | 733 [window_ close]; |
| 728 [animation_ setDelegate:nil]; | 734 [animation_ setDelegate:nil]; |
| 729 [self release]; | 735 [self release]; |
| 730 } | 736 } |
| 731 | 737 |
| 732 @end | 738 @end |
| OLD | NEW |