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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 edit_commands_->push_back( | 467 edit_commands_->push_back( |
468 EditCommand(base::SysNSStringToUTF8(editCommand), "")); | 468 EditCommand(base::SysNSStringToUTF8(editCommand), "")); |
469 } | 469 } |
470 | 470 |
471 - (void)insertText:(id)string { | 471 - (void)insertText:(id)string { |
472 // If we don't ignore this, then sometimes we get a bell. | 472 // If we don't ignore this, then sometimes we get a bell. |
473 } | 473 } |
474 | 474 |
475 + (void)matchEditCommands:(EditCommands*)edit_commands | 475 + (void)matchEditCommands:(EditCommands*)edit_commands |
476 forEvent:(NSEvent*)theEvent { | 476 forEvent:(NSEvent*)theEvent { |
477 if ([theEvent type] != NSKeyDown) return; | 477 if ([theEvent type] != NSKeyDown) |
| 478 return; |
478 // Don't interpret plain key presses. This screws up things like <Tab>. | 479 // Don't interpret plain key presses. This screws up things like <Tab>. |
479 NSUInteger flags = [theEvent modifierFlags]; | 480 NSUInteger flags = [theEvent modifierFlags]; |
480 flags &= (NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask); | 481 flags &= (NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask); |
481 if (flags == 0) return; | 482 if (!flags) |
| 483 return; |
482 scoped_nsobject<EditCommandMatcher> matcher( | 484 scoped_nsobject<EditCommandMatcher> matcher( |
483 [[EditCommandMatcher alloc] initWithEditCommands:edit_commands]); | 485 [[EditCommandMatcher alloc] initWithEditCommands:edit_commands]); |
484 [matcher.get() interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; | 486 [matcher.get() interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; |
485 } | 487 } |
486 | 488 |
487 @end | 489 @end |
488 | 490 |
489 // RenderWidgetHostViewCocoa --------------------------------------------------- | 491 // RenderWidgetHostViewCocoa --------------------------------------------------- |
490 | 492 |
491 @implementation RenderWidgetHostViewCocoa | 493 @implementation RenderWidgetHostViewCocoa |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); | 1222 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); |
1221 } else { | 1223 } else { |
1222 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( | 1224 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( |
1223 UTF8ToUTF16([im_text UTF8String])); | 1225 UTF8ToUTF16([im_text UTF8String])); |
1224 } | 1226 } |
1225 renderWidgetHostView_->im_composing_ = false; | 1227 renderWidgetHostView_->im_composing_ = false; |
1226 } | 1228 } |
1227 | 1229 |
1228 @end | 1230 @end |
1229 | 1231 |
OLD | NEW |