Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 389016: Address post-commit comments from codereview.chromium.org/371059 and codereview.chromium.org/293019 (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/download_shelf_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "base/scoped_nsobject.h" 8 #import "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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // 658 //
659 // If this object's retainCount is 1, the only reference is the one held by 659 // If this object's retainCount is 1, the only reference is the one held by
660 // keepSelfAlive. All other references may have been destroyed in the 660 // keepSelfAlive. All other references may have been destroyed in the
661 // RenderWidgetHost::ForwardKeyboardEvent call above if it resulted in tab 661 // RenderWidgetHost::ForwardKeyboardEvent call above if it resulted in tab
662 // closure. Were it not for that single reference, this object would 662 // closure. Were it not for that single reference, this object would
663 // already be deallocated. In that case, there's no point in calling 663 // already be deallocated. In that case, there's no point in calling
664 // -interpretKeyEvents:. 664 // -interpretKeyEvents:.
665 if ([self retainCount] > 1 && [theEvent type] == NSKeyDown) { 665 if ([self retainCount] > 1 && [theEvent type] == NSKeyDown) {
666 [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; 666 [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
667 667
668 // We don't get insertText: calls if ctrl is down, so synthesize a keypress 668 // We don't get insertText: calls if ctrl is down and not even a keyDown:
669 // event for that case. Note that this makes our behavior deviate from the 669 // call if cmd is down, so synthesize a keypress event for these cases.
670 // windows and linux versions of chrome (however, see http://crbug.com/13891 670 // Note that this makes our behavior deviate from the windows and linux
671 // ), but it makes us similar to how Safari behaves. 671 // versions of chrome (however, see http://crbug.com/13891 ), but it makes
672 // us behave similar to how Safari behaves.
672 if ([theEvent modifierFlags] & (NSControlKeyMask | NSCommandKeyMask) && 673 if ([theEvent modifierFlags] & (NSControlKeyMask | NSCommandKeyMask) &&
673 lastKeyPressedEvent_.get() != theEvent && 674 lastKeyPressedEvent_.get() != theEvent &&
674 [[theEvent characters] length] > 0 && 675 [[theEvent characters] length] > 0 &&
675 renderWidgetHostView_->render_widget_host_) { 676 renderWidgetHostView_->render_widget_host_) {
676 NativeWebKeyboardEvent event([[theEvent characters] characterAtIndex:0], 677 NativeWebKeyboardEvent event([[theEvent characters] characterAtIndex:0],
677 ToWebKitModifiers([theEvent modifierFlags]), 678 ToWebKitModifiers([theEvent modifierFlags]),
678 base::Time::Now().ToDoubleT()); 679 base::Time::Now().ToDoubleT());
679 // We fire menu items on keydown, we don't want to activate menu items 680 // We fire menu items on keydown, we don't want to activate menu items
680 // twice. 681 // twice.
681 event.skip_in_browser = true; 682 event.skip_in_browser = true;
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 base::Time::Now().ToDoubleT()); 1340 base::Time::Now().ToDoubleT());
1340 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); 1341 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event);
1341 } else { 1342 } else {
1342 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( 1343 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(
1343 UTF8ToUTF16([im_text UTF8String])); 1344 UTF8ToUTF16([im_text UTF8String]));
1344 } 1345 }
1345 renderWidgetHostView_->im_composing_ = false; 1346 renderWidgetHostView_->im_composing_ = false;
1346 } 1347 }
1347 1348
1348 @end 1349 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/download_shelf_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698