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