| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 } | 602 } |
| 603 | 603 |
| 604 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { | 604 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { |
| 605 NOTIMPLEMENTED(); | 605 NOTIMPLEMENTED(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 std::string NativeWidgetMac::GetName() const { | 608 std::string NativeWidgetMac::GetName() const { |
| 609 return name_; | 609 return name_; |
| 610 } | 610 } |
| 611 | 611 |
| 612 Widget::Widgets NativeWidgetMac::GetAllOwnedTopLevelWidgets() const { |
| 613 return Widget::Widgets(); |
| 614 } |
| 615 |
| 612 //////////////////////////////////////////////////////////////////////////////// | 616 //////////////////////////////////////////////////////////////////////////////// |
| 613 // NativeWidgetMac, protected: | 617 // NativeWidgetMac, protected: |
| 614 | 618 |
| 615 NativeWidgetMacNSWindow* NativeWidgetMac::CreateNSWindow( | 619 NativeWidgetMacNSWindow* NativeWidgetMac::CreateNSWindow( |
| 616 const Widget::InitParams& params) { | 620 const Widget::InitParams& params) { |
| 617 return [[[NativeWidgetMacNSWindow alloc] | 621 return [[[NativeWidgetMacNSWindow alloc] |
| 618 initWithContentRect:ui::kWindowSizeDeterminedLater | 622 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 619 styleMask:StyleMaskForParams(params) | 623 styleMask:StyleMaskForParams(params) |
| 620 backing:NSBackingStoreBuffered | 624 backing:NSBackingStoreBuffered |
| 621 defer:NO] autorelease]; | 625 defer:NO] autorelease]; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 // When the NSWindow *is* a Widget, only consider child_windows(). I.e. do not | 724 // When the NSWindow *is* a Widget, only consider child_windows(). I.e. do not |
| 721 // look through -[NSWindow childWindows] as done for the (!bridge) case above. | 725 // look through -[NSWindow childWindows] as done for the (!bridge) case above. |
| 722 // -childWindows does not support hidden windows, and anything in there which | 726 // -childWindows does not support hidden windows, and anything in there which |
| 723 // is not in child_windows() would have been added by AppKit. | 727 // is not in child_windows() would have been added by AppKit. |
| 724 for (BridgedNativeWidget* child : bridge->child_windows()) | 728 for (BridgedNativeWidget* child : bridge->child_windows()) |
| 725 GetAllChildWidgets(child->ns_view(), children); | 729 GetAllChildWidgets(child->ns_view(), children); |
| 726 } | 730 } |
| 727 | 731 |
| 728 // static | 732 // static |
| 729 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, | 733 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, |
| 730 Widget::Widgets* owned) { | 734 Widget::Widgets* owned, |
| 735 bool include_toplevel) { |
| 736 // All Widgets are toplevel on Mac. |
| 737 if (!include_toplevel) |
| 738 return; |
| 739 |
| 731 BridgedNativeWidget* bridge = | 740 BridgedNativeWidget* bridge = |
| 732 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); | 741 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); |
| 733 if (!bridge) { | 742 if (!bridge) { |
| 734 GetAllChildWidgets(native_view, owned); | 743 GetAllChildWidgets(native_view, owned); |
| 735 return; | 744 return; |
| 736 } | 745 } |
| 737 if (bridge->ns_view() != native_view) | 746 if (bridge->ns_view() != native_view) |
| 738 return; | 747 return; |
| 739 for (BridgedNativeWidget* child : bridge->child_windows()) | 748 for (BridgedNativeWidget* child : bridge->child_windows()) |
| 740 GetAllChildWidgets(child->ns_view(), owned); | 749 GetAllChildWidgets(child->ns_view(), owned); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 800 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 792 } | 801 } |
| 793 | 802 |
| 794 - (void)animationDidEnd:(NSAnimation*)animation { | 803 - (void)animationDidEnd:(NSAnimation*)animation { |
| 795 [window_ close]; | 804 [window_ close]; |
| 796 [animation_ setDelegate:nil]; | 805 [animation_ setDelegate:nil]; |
| 797 [self release]; | 806 [self release]; |
| 798 } | 807 } |
| 799 | 808 |
| 800 @end | 809 @end |
| OLD | NEW |