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

Side by Side Diff: ui/views/test/event_generator_delegate_mac.mm

Issue 1779743004: MacViews: Fix MenuRunnerTest.NonLatinMnemonic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 9 months 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 | « ui/events/test/cocoa_test_event_utils.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 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 7
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #import "base/mac/scoped_objc_class_swizzler.h" 9 #import "base/mac/scoped_objc_class_swizzler.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (owner_->targeting_application()) 356 if (owner_->targeting_application())
357 [NSApp sendEvent:ns_event]; 357 [NSApp sendEvent:ns_event];
358 else 358 else
359 EmulateSendEvent(window_, ns_event); 359 EmulateSendEvent(window_, ns_event);
360 } 360 }
361 361
362 void EventGeneratorDelegateMac::OnKeyEvent(ui::KeyEvent* event) { 362 void EventGeneratorDelegateMac::OnKeyEvent(ui::KeyEvent* event) {
363 NSUInteger modifiers = EventFlagsToModifiers(event->flags()); 363 NSUInteger modifiers = EventFlagsToModifiers(event->flags());
364 NSEvent* ns_event = cocoa_test_event_utils::SynthesizeKeyEvent( 364 NSEvent* ns_event = cocoa_test_event_utils::SynthesizeKeyEvent(
365 window_, event->type() == ui::ET_KEY_PRESSED, event->key_code(), 365 window_, event->type() == ui::ET_KEY_PRESSED, event->key_code(),
366 modifiers); 366 modifiers, event->is_char() ? event->GetDomKey() : ui::DomKey::NONE);
367 if (owner_->targeting_application()) { 367 if (owner_->targeting_application()) {
368 [NSApp sendEvent:ns_event]; 368 [NSApp sendEvent:ns_event];
369 return; 369 return;
370 } 370 }
371 371
372 if ([fake_menu_ performKeyEquivalent:ns_event]) 372 if ([fake_menu_ performKeyEquivalent:ns_event])
373 return; 373 return;
374 374
375 EmulateSendEvent(window_, ns_event); 375 EmulateSendEvent(window_, ns_event);
376 } 376 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 - (NSEvent*)currentEvent { 484 - (NSEvent*)currentEvent {
485 if (g_current_event) 485 if (g_current_event)
486 return g_current_event; 486 return g_current_event;
487 487
488 // Find the original implementation and invoke it. 488 // Find the original implementation and invoke it.
489 IMP original = EventGeneratorDelegateMac::GetInstance()->CurrentEventMethod(); 489 IMP original = EventGeneratorDelegateMac::GetInstance()->CurrentEventMethod();
490 return original(self, _cmd); 490 return original(self, _cmd);
491 } 491 }
492 492
493 @end 493 @end
OLDNEW
« no previous file with comments | « ui/events/test/cocoa_test_event_utils.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698