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 |
11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" | 14 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" |
15 #import "ui/base/cocoa/window_size_constants.h" | 15 #import "ui/base/cocoa/window_size_constants.h" |
16 #include "ui/gfx/font_list.h" | 16 #include "ui/gfx/font_list.h" |
17 #import "ui/gfx/mac/coordinate_conversion.h" | 17 #import "ui/gfx/mac/coordinate_conversion.h" |
18 #import "ui/gfx/mac/nswindow_frame_controls.h" | 18 #import "ui/gfx/mac/nswindow_frame_controls.h" |
19 #include "ui/native_theme/native_theme.h" | 19 #include "ui/native_theme/native_theme.h" |
20 #include "ui/native_theme/native_theme_mac.h" | 20 #include "ui/native_theme/native_theme_mac.h" |
21 #import "ui/views/cocoa/bridged_content_view.h" | 21 #import "ui/views/cocoa/bridged_content_view.h" |
22 #import "ui/views/cocoa/bridged_native_widget.h" | 22 #import "ui/views/cocoa/bridged_native_widget.h" |
| 23 #include "ui/views/cocoa/drag_drop_client_mac.h" |
23 #import "ui/views/cocoa/native_widget_mac_nswindow.h" | 24 #import "ui/views/cocoa/native_widget_mac_nswindow.h" |
24 #import "ui/views/cocoa/views_nswindow_delegate.h" | 25 #import "ui/views/cocoa/views_nswindow_delegate.h" |
25 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
26 #include "ui/views/window/native_frame_view.h" | 27 #include "ui/views/window/native_frame_view.h" |
27 | 28 |
28 // Self-owning animation delegate that starts a hide animation, then calls | 29 // Self-owning animation delegate that starts a hide animation, then calls |
29 // -[NSWindow close] when the animation ends, releasing itself. | 30 // -[NSWindow close] when the animation ends, releasing itself. |
30 @interface ViewsNSWindowCloseAnimator : NSObject<NSAnimationDelegate> { | 31 @interface ViewsNSWindowCloseAnimator : NSObject<NSAnimationDelegate> { |
31 @private | 32 @private |
32 base::scoped_nsobject<NSWindow> window_; | 33 base::scoped_nsobject<NSWindow> window_; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 501 |
501 void NativeWidgetMac::FlashFrame(bool flash_frame) { | 502 void NativeWidgetMac::FlashFrame(bool flash_frame) { |
502 NOTIMPLEMENTED(); | 503 NOTIMPLEMENTED(); |
503 } | 504 } |
504 | 505 |
505 void NativeWidgetMac::RunShellDrag(View* view, | 506 void NativeWidgetMac::RunShellDrag(View* view, |
506 const ui::OSExchangeData& data, | 507 const ui::OSExchangeData& data, |
507 const gfx::Point& location, | 508 const gfx::Point& location, |
508 int operation, | 509 int operation, |
509 ui::DragDropTypes::DragEventSource source) { | 510 ui::DragDropTypes::DragEventSource source) { |
510 NOTIMPLEMENTED(); | 511 bridge_->drag_drop_client()->StartDragAndDrop(view, data, location, operation, |
| 512 source); |
511 } | 513 } |
512 | 514 |
513 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { | 515 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { |
514 // |rect| is relative to client area of the window. | 516 // |rect| is relative to client area of the window. |
515 NSWindow* window = GetNativeWindow(); | 517 NSWindow* window = GetNativeWindow(); |
516 NSRect client_rect = [window contentRectForFrameRect:[window frame]]; | 518 NSRect client_rect = [window contentRectForFrameRect:[window frame]]; |
517 NSRect target_rect = rect.ToCGRect(); | 519 NSRect target_rect = rect.ToCGRect(); |
518 | 520 |
519 // Convert to Appkit coordinate system (origin at bottom left). | 521 // Convert to Appkit coordinate system (origin at bottom left). |
520 target_rect.origin.y = | 522 target_rect.origin.y = |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 742 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
741 } | 743 } |
742 | 744 |
743 - (void)animationDidEnd:(NSAnimation*)animation { | 745 - (void)animationDidEnd:(NSAnimation*)animation { |
744 [window_ close]; | 746 [window_ close]; |
745 [animation_ setDelegate:nil]; | 747 [animation_ setDelegate:nil]; |
746 [self release]; | 748 [self release]; |
747 } | 749 } |
748 | 750 |
749 @end | 751 @end |
OLD | NEW |