| 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> |
| 10 |
| 9 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 12 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" | 14 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" |
| 13 #import "ui/base/cocoa/window_size_constants.h" | 15 #import "ui/base/cocoa/window_size_constants.h" |
| 14 #include "ui/gfx/font_list.h" | 16 #include "ui/gfx/font_list.h" |
| 15 #import "ui/gfx/mac/coordinate_conversion.h" | 17 #import "ui/gfx/mac/coordinate_conversion.h" |
| 16 #import "ui/gfx/mac/nswindow_frame_controls.h" | 18 #import "ui/gfx/mac/nswindow_frame_controls.h" |
| 17 #include "ui/native_theme/native_theme.h" | 19 #include "ui/native_theme/native_theme.h" |
| 18 #include "ui/native_theme/native_theme_mac.h" | 20 #include "ui/native_theme/native_theme_mac.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 [window performSelector:@selector(close) withObject:nil afterDelay:0]; | 362 [window performSelector:@selector(close) withObject:nil afterDelay:0]; |
| 361 } | 363 } |
| 362 | 364 |
| 363 void NativeWidgetMac::CloseNow() { | 365 void NativeWidgetMac::CloseNow() { |
| 364 if (!bridge_) | 366 if (!bridge_) |
| 365 return; | 367 return; |
| 366 | 368 |
| 367 // Notify observers while |bridged_| is still valid. | 369 // Notify observers while |bridged_| is still valid. |
| 368 delegate_->OnNativeWidgetDestroying(); | 370 delegate_->OnNativeWidgetDestroying(); |
| 369 // Reset |bridge_| to NULL before destroying it. | 371 // Reset |bridge_| to NULL before destroying it. |
| 370 scoped_ptr<BridgedNativeWidget> bridge(bridge_.Pass()); | 372 scoped_ptr<BridgedNativeWidget> bridge(std::move(bridge_)); |
| 371 } | 373 } |
| 372 | 374 |
| 373 void NativeWidgetMac::Show() { | 375 void NativeWidgetMac::Show() { |
| 374 ShowWithWindowState(ui::SHOW_STATE_NORMAL); | 376 ShowWithWindowState(ui::SHOW_STATE_NORMAL); |
| 375 } | 377 } |
| 376 | 378 |
| 377 void NativeWidgetMac::Hide() { | 379 void NativeWidgetMac::Hide() { |
| 378 if (!bridge_) | 380 if (!bridge_) |
| 379 return; | 381 return; |
| 380 | 382 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 723 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 722 } | 724 } |
| 723 | 725 |
| 724 - (void)animationDidEnd:(NSAnimation*)animation { | 726 - (void)animationDidEnd:(NSAnimation*)animation { |
| 725 [window_ close]; | 727 [window_ close]; |
| 726 [animation_ setDelegate:nil]; | 728 [animation_ setDelegate:nil]; |
| 727 [self release]; | 729 [self release]; |
| 728 } | 730 } |
| 729 | 731 |
| 730 @end | 732 @end |
| OLD | NEW |