| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 NativeWebKeyboardEvent event(theEvent); | 581 NativeWebKeyboardEvent event(theEvent); |
| 582 | 582 |
| 583 // Save the modifier keys so the insertText method can use it when it sends | 583 // Save the modifier keys so the insertText method can use it when it sends |
| 584 // a Char event, which is dispatched as an onkeypress() event of JavaScript. | 584 // a Char event, which is dispatched as an onkeypress() event of JavaScript. |
| 585 renderWidgetHostView_->im_modifiers_ = event.modifiers; | 585 renderWidgetHostView_->im_modifiers_ = event.modifiers; |
| 586 | 586 |
| 587 // To emulate Windows, over-write |event.windowsKeyCode| to VK_PROCESSKEY | 587 // To emulate Windows, over-write |event.windowsKeyCode| to VK_PROCESSKEY |
| 588 // while an input method is composing a text. | 588 // while an input method is composing a text. |
| 589 // Gmail checks this code in its onkeydown handler to stop auto-completing | 589 // Gmail checks this code in its onkeydown handler to stop auto-completing |
| 590 // e-mail addresses while composing a CJK text. | 590 // e-mail addresses while composing a CJK text. |
| 591 if ([theEvent type] == NSKeyDown && renderWidgetHostView_->im_composing_) | 591 if ([theEvent type] == NSKeyDown && renderWidgetHostView_->im_composing_) { |
| 592 event.windowsKeyCode = 0xE5; | 592 event.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY |
| 593 event.setKeyIdentifierFromWindowsKeyCode(); |
| 594 event.skip_in_browser = true; |
| 595 } |
| 593 | 596 |
| 594 // Dispatch this keyboard event to the renderer. | 597 // Dispatch this keyboard event to the renderer. |
| 595 if (renderWidgetHostView_->render_widget_host_) { | 598 if (renderWidgetHostView_->render_widget_host_) { |
| 596 RenderWidgetHost* widgetHost = renderWidgetHostView_->render_widget_host_; | 599 RenderWidgetHost* widgetHost = renderWidgetHostView_->render_widget_host_; |
| 597 // Look up shortcut, if any, for this key combination. | 600 // Look up shortcut, if any, for this key combination. |
| 598 EditCommands editCommands; | 601 EditCommands editCommands; |
| 599 [EditCommandMatcher matchEditCommands:&editCommands forEvent:theEvent]; | 602 [EditCommandMatcher matchEditCommands:&editCommands forEvent:theEvent]; |
| 600 if (!editCommands.empty()) | 603 if (!editCommands.empty()) |
| 601 widgetHost->ForwardEditCommandsForNextKeyEvent(editCommands); | 604 widgetHost->ForwardEditCommandsForNextKeyEvent(editCommands); |
| 602 widgetHost->ForwardKeyboardEvent(event); | 605 widgetHost->ForwardKeyboardEvent(event); |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); | 1267 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); |
| 1265 } else { | 1268 } else { |
| 1266 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( | 1269 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( |
| 1267 UTF8ToUTF16([im_text UTF8String])); | 1270 UTF8ToUTF16([im_text UTF8String])); |
| 1268 } | 1271 } |
| 1269 renderWidgetHostView_->im_composing_ = false; | 1272 renderWidgetHostView_->im_composing_ = false; |
| 1270 } | 1273 } |
| 1271 | 1274 |
| 1272 @end | 1275 @end |
| 1273 | 1276 |
| OLD | NEW |