| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 8 | 8 |
| 9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
| 10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 renderWidgetHostView_->render_widget_host_->Focus(); | 1660 renderWidgetHostView_->render_widget_host_->Focus(); |
| 1661 renderWidgetHostView_->render_widget_host_->SetInputMethodActive(true); | 1661 renderWidgetHostView_->render_widget_host_->SetInputMethodActive(true); |
| 1662 renderWidgetHostView_->SetTextInputActive(true); | 1662 renderWidgetHostView_->SetTextInputActive(true); |
| 1663 | 1663 |
| 1664 // Cancel any onging composition text which was left before we lost focus. | 1664 // Cancel any onging composition text which was left before we lost focus. |
| 1665 // TODO(suzhe): We should do it in -resignFirstResponder: method, but | 1665 // TODO(suzhe): We should do it in -resignFirstResponder: method, but |
| 1666 // somehow that method won't be called when switching among different tabs. | 1666 // somehow that method won't be called when switching among different tabs. |
| 1667 // See http://crbug.com/47209 | 1667 // See http://crbug.com/47209 |
| 1668 [self cancelComposition]; | 1668 [self cancelComposition]; |
| 1669 | 1669 |
| 1670 NSNumber* direction = [NSNumber numberWithUnsignedInteger: |
| 1671 [[self window] keyViewSelectionDirection]]; |
| 1672 NSDictionary* userInfo = |
| 1673 [NSDictionary dictionaryWithObject:direction |
| 1674 forKey:kSelectionDirection]; |
| 1675 [[NSNotificationCenter defaultCenter] |
| 1676 postNotificationName:kViewDidBecomeFirstResponder |
| 1677 object:self |
| 1678 userInfo:userInfo]; |
| 1679 |
| 1670 return YES; | 1680 return YES; |
| 1671 } | 1681 } |
| 1672 | 1682 |
| 1673 - (BOOL)resignFirstResponder { | 1683 - (BOOL)resignFirstResponder { |
| 1674 renderWidgetHostView_->SetTextInputActive(false); | 1684 renderWidgetHostView_->SetTextInputActive(false); |
| 1675 if (!renderWidgetHostView_->render_widget_host_) | 1685 if (!renderWidgetHostView_->render_widget_host_) |
| 1676 return YES; | 1686 return YES; |
| 1677 | 1687 |
| 1678 if (closeOnDeactivate_) | 1688 if (closeOnDeactivate_) |
| 1679 renderWidgetHostView_->KillSelf(); | 1689 renderWidgetHostView_->KillSelf(); |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 if (!string) return NO; | 2523 if (!string) return NO; |
| 2514 | 2524 |
| 2515 // If the user is currently using an IME, confirm the IME input, | 2525 // If the user is currently using an IME, confirm the IME input, |
| 2516 // and then insert the text from the service, the same as TextEdit and Safari. | 2526 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2517 [self confirmComposition]; | 2527 [self confirmComposition]; |
| 2518 [self insertText:string]; | 2528 [self insertText:string]; |
| 2519 return YES; | 2529 return YES; |
| 2520 } | 2530 } |
| 2521 | 2531 |
| 2522 @end | 2532 @end |
| OLD | NEW |