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 "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 } | 573 } |
574 return NULL; // Not created by NativeWidgetMac. | 574 return NULL; // Not created by NativeWidgetMac. |
575 } | 575 } |
576 | 576 |
577 // static | 577 // static |
578 NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( | 578 NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( |
579 gfx::NativeView native_view) { | 579 gfx::NativeView native_view) { |
580 BridgedNativeWidget* bridge = | 580 BridgedNativeWidget* bridge = |
581 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); | 581 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); |
582 if (!bridge) | 582 if (!bridge) |
583 return NULL; | 583 return nullptr; |
584 | 584 |
585 for (BridgedNativeWidget* parent; | 585 NativeWidgetPrivate* ancestor = |
586 (parent = bridge->parent()); | 586 bridge->parent() ? GetTopLevelNativeWidget( |
587 bridge = parent) { | 587 [bridge->parent()->GetNSWindow() contentView]) |
588 } | 588 : nullptr; |
589 return bridge->native_widget_mac(); | 589 return ancestor ? ancestor : bridge->native_widget_mac(); |
590 } | 590 } |
591 | 591 |
592 // static | 592 // static |
593 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, | 593 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, |
594 Widget::Widgets* children) { | 594 Widget::Widgets* children) { |
595 BridgedNativeWidget* bridge = | 595 BridgedNativeWidget* bridge = |
596 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); | 596 NativeWidgetMac::GetBridgeForNativeWindow([native_view window]); |
597 if (!bridge) | 597 if (!bridge) |
598 return; | 598 return; |
599 | 599 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 632 } |
633 | 633 |
634 // static | 634 // static |
635 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | 635 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { |
636 NOTIMPLEMENTED(); | 636 NOTIMPLEMENTED(); |
637 return gfx::FontList(); | 637 return gfx::FontList(); |
638 } | 638 } |
639 | 639 |
640 } // namespace internal | 640 } // namespace internal |
641 } // namespace views | 641 } // namespace views |
OLD | NEW |