| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/cocoa/browser_window_utils.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 CGFloat GetPatternVerticalOffsetWithTabStrip(bool tabStripVisible) { | 21 CGFloat GetPatternVerticalOffsetWithTabStrip(bool tabStripVisible) { |
| 22 // Without tab strip, offset an extra pixel (determined by experimentation). | 22 // Without tab strip, offset an extra pixel (determined by experimentation). |
| 23 return tabStripVisible ? -1 : 0; | 23 return tabStripVisible ? -1 : 0; |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 | 28 |
| 29 @implementation BrowserWindowUtils | 29 @implementation BrowserWindowUtils |
| 30 + (BOOL)shouldHandleKeyboardEvent:(const NativeWebKeyboardEvent&)event { | 30 + (BOOL)shouldHandleKeyboardEvent:(const NativeWebKeyboardEvent&)event { |
| 31 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) | 31 if (event.skip_in_browser || event.type() == NativeWebKeyboardEvent::Char) |
| 32 return NO; | 32 return NO; |
| 33 DCHECK(event.os_event != NULL); | 33 DCHECK(event.os_event != NULL); |
| 34 return YES; | 34 return YES; |
| 35 } | 35 } |
| 36 | 36 |
| 37 + (BOOL)isTextEditingEvent:(const content::NativeWebKeyboardEvent&)event { | 37 + (BOOL)isTextEditingEvent:(const content::NativeWebKeyboardEvent&)event { |
| 38 return (event.modifiers & blink::WebInputEvent::MetaKey) && | 38 return (event.modifiers() & blink::WebInputEvent::MetaKey) && |
| 39 (event.windowsKeyCode == ui::VKEY_A || | 39 (event.windowsKeyCode == ui::VKEY_A || |
| 40 event.windowsKeyCode == ui::VKEY_V || | 40 event.windowsKeyCode == ui::VKEY_V || |
| 41 event.windowsKeyCode == ui::VKEY_C || | 41 event.windowsKeyCode == ui::VKEY_C || |
| 42 event.windowsKeyCode == ui::VKEY_X || | 42 event.windowsKeyCode == ui::VKEY_X || |
| 43 event.windowsKeyCode == ui::VKEY_Z); | 43 event.windowsKeyCode == ui::VKEY_Z); |
| 44 } | 44 } |
| 45 | 45 |
| 46 + (int)getCommandId:(const NativeWebKeyboardEvent&)event { | 46 + (int)getCommandId:(const NativeWebKeyboardEvent&)event { |
| 47 return CommandForKeyEvent(event.os_event); | 47 return CommandForKeyEvent(event.os_event); |
| 48 } | 48 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 + (void)activateWindowForController:(NSWindowController*)controller { | 142 + (void)activateWindowForController:(NSWindowController*)controller { |
| 143 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to | 143 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to |
| 144 // properly activate windows if Chrome is not the active application. | 144 // properly activate windows if Chrome is not the active application. |
| 145 [[controller window] makeKeyAndOrderFront:controller]; | 145 [[controller window] makeKeyAndOrderFront:controller]; |
| 146 [NSApp activateIgnoringOtherApps:YES]; | 146 [NSApp activateIgnoringOtherApps:YES]; |
| 147 } | 147 } |
| 148 | 148 |
| 149 @end | 149 @end |
| OLD | NEW |