OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 content::WebContents* web_contents = | 288 content::WebContents* web_contents = |
289 findBarBridge_->GetFindBarController()->web_contents(); | 289 findBarBridge_->GetFindBarController()->web_contents(); |
290 if (!web_contents) | 290 if (!web_contents) |
291 return NO; | 291 return NO; |
292 | 292 |
293 // Sanity-check to make sure we got a keyboard event. | 293 // Sanity-check to make sure we got a keyboard event. |
294 NSEvent* event = [NSApp currentEvent]; | 294 NSEvent* event = [NSApp currentEvent]; |
295 if ([event type] != NSKeyDown && [event type] != NSKeyUp) | 295 if ([event type] != NSKeyDown && [event type] != NSKeyUp) |
296 return NO; | 296 return NO; |
297 | 297 |
298 // Forward the event to the renderer. | 298 // Forward the event to the renderer. TODO(rohitrao): Should this call |
mfomitchev
2017/04/04 14:59:05
TODO should be on a new line?
tdresser
2017/05/01 15:49:21
Done.
| |
299 // TODO(rohitrao): Should this call -[BaseView keyEvent:]? Is there code in | 299 // -[BaseView keyEvent:]? Is there code in that function that we want to |
300 // that function that we want to keep or avoid? Calling | 300 // keep or avoid? Calling |ForwardKeyboardEventWithLatencyInfo()| directly |
301 // |ForwardKeyboardEvent()| directly ignores edit commands, which breaks | 301 // ignores edit commands, which breaks cmd-up/down if we ever decide to |
302 // cmd-up/down if we ever decide to include |moveToBeginningOfDocument:| in | 302 // include |moveToBeginningOfDocument:| in the list above. |
303 // the list above. | |
304 content::RenderViewHost* render_view_host = | 303 content::RenderViewHost* render_view_host = |
305 web_contents->GetRenderViewHost(); | 304 web_contents->GetRenderViewHost(); |
306 render_view_host->GetWidget()->ForwardKeyboardEvent( | 305 render_view_host->GetWidget()->ForwardKeyboardEventWithLatencyInfo( |
307 NativeWebKeyboardEvent(event)); | 306 NativeWebKeyboardEvent(event), ui::LatencyInfo()); |
mfomitchev
2017/04/04 14:59:05
Do we care about latency info on Mac? If yes, mayb
tdresser
2017/05/01 15:49:21
We have terrible coverage currently.
I've added t
| |
308 return YES; | 307 return YES; |
309 } | 308 } |
310 | 309 |
311 return NO; | 310 return NO; |
312 } | 311 } |
313 | 312 |
314 // Methods from FindBar | 313 // Methods from FindBar |
315 - (void)showFindBar:(BOOL)animate { | 314 - (void)showFindBar:(BOOL)animate { |
316 // Save the currently-focused view. |findBarView_| is in the view | 315 // Save the currently-focused view. |findBarView_| is in the view |
317 // hierarchy by now. showFindBar can be called even when the | 316 // hierarchy by now. showFindBar can be called even when the |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 } | 660 } |
662 | 661 |
663 - (BrowserWindowController*)browserWindowController { | 662 - (BrowserWindowController*)browserWindowController { |
664 if (!browser_) | 663 if (!browser_) |
665 return nil; | 664 return nil; |
666 return [BrowserWindowController | 665 return [BrowserWindowController |
667 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; | 666 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; |
668 } | 667 } |
669 | 668 |
670 @end | 669 @end |
OLD | NEW |