Index: chrome/browser/ui/cocoa/system_hotkey_map.mm |
diff --git a/chrome/browser/ui/cocoa/system_hotkey_map.mm b/chrome/browser/ui/cocoa/system_hotkey_map.mm |
index 9b649fbc729ca3745f81c1c926c0123543f566db..823fb7965579ded7af1f4853368e9d7baa360593 100644 |
--- a/chrome/browser/ui/cocoa/system_hotkey_map.mm |
+++ b/chrome/browser/ui/cocoa/system_hotkey_map.mm |
@@ -4,8 +4,6 @@ |
#import "chrome/browser/ui/cocoa/system_hotkey_map.h" |
-#import <Cocoa/Cocoa.h> |
- |
#pragma mark - NSDictionary Helper Functions |
namespace { |
@@ -50,6 +48,9 @@ SystemHotkeyMap::~SystemHotkeyMap() { |
bool SystemHotkeyMap::ParseData(NSData* data) { |
system_hotkeys_.clear(); |
+ if (!data) |
+ return false; |
+ |
NSError* error = nil; |
NSPropertyListFormat format; |
NSDictionary* dictionary = |
@@ -103,8 +104,14 @@ bool SystemHotkeyMap::ParseData(NSData* data) { |
return true; |
} |
-bool SystemHotkeyMap::IsHotkeyReserved(int key_code, int modifiers) { |
- std::vector<SystemHotkey>::iterator it; |
+bool SystemHotkeyMap::IsEventReserved(NSEvent* event) const { |
+ NSUInteger modifiers = |
+ NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask; |
+ return IsHotkeyReserved(event.keyCode, event.modifierFlags & modifiers); |
+} |
+ |
+bool SystemHotkeyMap::IsHotkeyReserved(int key_code, int modifiers) const { |
+ std::vector<SystemHotkey>::const_iterator it; |
for (it = system_hotkeys_.begin(); it != system_hotkeys_.end(); ++it) { |
if (it->key_code == key_code && it->modifiers == modifiers) |
return true; |