| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 void NativeWidgetMac::ReleaseCapture() { | 207 void NativeWidgetMac::ReleaseCapture() { |
| 208 if (bridge_) | 208 if (bridge_) |
| 209 bridge_->ReleaseCapture(); | 209 bridge_->ReleaseCapture(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool NativeWidgetMac::HasCapture() const { | 212 bool NativeWidgetMac::HasCapture() const { |
| 213 return bridge_ && bridge_->HasCapture(); | 213 return bridge_ && bridge_->HasCapture(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 InputMethod* NativeWidgetMac::CreateInputMethod() { | 216 ui::InputMethod* NativeWidgetMac::GetInputMethod() { |
| 217 return bridge_ ? bridge_->CreateInputMethod() : NULL; | 217 return bridge_ ? bridge_->GetInputMethod() : NULL; |
| 218 } | |
| 219 | |
| 220 internal::InputMethodDelegate* NativeWidgetMac::GetInputMethodDelegate() { | |
| 221 return bridge_.get(); | |
| 222 } | |
| 223 | |
| 224 ui::InputMethod* NativeWidgetMac::GetHostInputMethod() { | |
| 225 return bridge_ ? bridge_->GetHostInputMethod() : NULL; | |
| 226 } | 218 } |
| 227 | 219 |
| 228 void NativeWidgetMac::CenterWindow(const gfx::Size& size) { | 220 void NativeWidgetMac::CenterWindow(const gfx::Size& size) { |
| 229 SetSize( | 221 SetSize( |
| 230 BridgedNativeWidget::GetWindowSizeForClientSize(GetNativeWindow(), size)); | 222 BridgedNativeWidget::GetWindowSizeForClientSize(GetNativeWindow(), size)); |
| 231 // Note that this is not the precise center of screen, but it is the standard | 223 // Note that this is not the precise center of screen, but it is the standard |
| 232 // location for windows like dialogs to appear on screen for Mac. | 224 // location for windows like dialogs to appear on screen for Mac. |
| 233 // TODO(tapted): If there is a parent window, center in that instead. | 225 // TODO(tapted): If there is a parent window, center in that instead. |
| 234 [GetNativeWindow() center]; | 226 [GetNativeWindow() center]; |
| 235 } | 227 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; | 682 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; |
| 691 } | 683 } |
| 692 | 684 |
| 693 - (void)animationDidEnd:(NSAnimation*)animation { | 685 - (void)animationDidEnd:(NSAnimation*)animation { |
| 694 [window_ close]; | 686 [window_ close]; |
| 695 [animation_ setDelegate:nil]; | 687 [animation_ setDelegate:nil]; |
| 696 [self release]; | 688 [self release]; |
| 697 } | 689 } |
| 698 | 690 |
| 699 @end | 691 @end |
| OLD | NEW |