| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 // static | 581 // static |
| 582 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, | 582 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, |
| 583 Widget::Widgets* owned) { | 583 Widget::Widgets* owned) { |
| 584 NOTIMPLEMENTED(); | 584 NOTIMPLEMENTED(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 // static | 587 // static |
| 588 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, | 588 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, |
| 589 gfx::NativeView new_parent) { | 589 gfx::NativeView new_parent) { |
| 590 NOTIMPLEMENTED(); | 590 DCHECK_NE(native_view, new_parent); |
| 591 |
| 592 gfx::NativeView old_parent = [native_view superview]; |
| 593 if (old_parent == new_parent) |
| 594 return; |
| 595 |
| 596 // On Mac, changing the native view heirarchy will affect at most two Widgets. |
| 597 NativeWidgetPrivate* old_parent_widget = |
| 598 GetNativeWidgetForNativeView(native_view); |
| 599 NativeWidgetPrivate* new_parent_widget = |
| 600 GetNativeWidgetForNativeView(new_parent); |
| 601 |
| 602 if (old_parent_widget == new_parent_widget) |
| 603 old_parent_widget = NULL; |
| 604 if (old_parent_widget) |
| 605 old_parent_widget->GetWidget()->NotifyNativeViewHierarchyWillChange(); |
| 606 if (new_parent_widget) |
| 607 new_parent_widget->GetWidget()->NotifyNativeViewHierarchyWillChange(); |
| 608 |
| 609 [native_view removeFromSuperview]; |
| 610 |
| 611 if (new_parent) |
| 612 [new_parent addSubview:native_view]; |
| 613 |
| 614 if (old_parent_widget) |
| 615 old_parent_widget->GetWidget()->NotifyNativeViewHierarchyChanged(); |
| 616 if (new_parent_widget) |
| 617 new_parent_widget->GetWidget()->NotifyNativeViewHierarchyChanged(); |
| 591 } | 618 } |
| 592 | 619 |
| 593 // static | 620 // static |
| 594 bool NativeWidgetPrivate::IsMouseButtonDown() { | 621 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 595 return [NSEvent pressedMouseButtons] != 0; | 622 return [NSEvent pressedMouseButtons] != 0; |
| 596 } | 623 } |
| 597 | 624 |
| 598 // static | 625 // static |
| 599 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | 626 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { |
| 600 NOTIMPLEMENTED(); | 627 NOTIMPLEMENTED(); |
| 601 return gfx::FontList(); | 628 return gfx::FontList(); |
| 602 } | 629 } |
| 603 | 630 |
| 604 } // namespace internal | 631 } // namespace internal |
| 605 } // namespace views | 632 } // namespace views |
| OLD | NEW |