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

Unified Diff: chrome/browser/ui/cocoa/system_hotkey_map.mm

Issue 374643002: Mac: Enable delegated renderer by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/system_hotkey_map.h ('k') | chrome/browser/ui/cocoa/system_hotkey_map_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/system_hotkey_map.mm
diff --git a/content/browser/cocoa/system_hotkey_map.mm b/chrome/browser/ui/cocoa/system_hotkey_map.mm
similarity index 85%
rename from content/browser/cocoa/system_hotkey_map.mm
rename to chrome/browser/ui/cocoa/system_hotkey_map.mm
index 98a27483bef96e2c14ce01e59387583593b387be..9b649fbc729ca3745f81c1c926c0123543f566db 100644
--- a/content/browser/cocoa/system_hotkey_map.mm
+++ b/chrome/browser/ui/cocoa/system_hotkey_map.mm
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "content/browser/cocoa/system_hotkey_map.h"
+#import "chrome/browser/ui/cocoa/system_hotkey_map.h"
+
+#import <Cocoa/Cocoa.h>
#pragma mark - NSDictionary Helper Functions
@@ -33,8 +35,6 @@ NSNumber* NumberForKey(NSDictionary* dict, NSString* key) {
#pragma mark - SystemHotkey
-namespace content {
-
struct SystemHotkey {
int key_code;
int modifiers;
@@ -47,9 +47,8 @@ SystemHotkeyMap::SystemHotkeyMap() {
SystemHotkeyMap::~SystemHotkeyMap() {
}
-NSDictionary* SystemHotkeyMap::DictionaryFromData(NSData* data) {
- if (!data)
- return nil;
+bool SystemHotkeyMap::ParseData(NSData* data) {
+ system_hotkeys_.clear();
NSError* error = nil;
NSPropertyListFormat format;
@@ -58,17 +57,10 @@ NSDictionary* SystemHotkeyMap::DictionaryFromData(NSData* data) {
options:0
format:&format
error:&error];
+ if (error)
+ return false;
if (![dictionary isKindOfClass:[NSDictionary class]])
- return nil;
-
- return dictionary;
-}
-
-bool SystemHotkeyMap::ParseDictionary(NSDictionary* dictionary) {
- system_hotkeys_.clear();
-
- if (!dictionary)
return false;
NSDictionary* hotkey_dictionaries =
@@ -111,14 +103,8 @@ bool SystemHotkeyMap::ParseDictionary(NSDictionary* dictionary) {
return true;
}
-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;
+bool SystemHotkeyMap::IsHotkeyReserved(int key_code, int modifiers) {
+ std::vector<SystemHotkey>::iterator it;
for (it = system_hotkeys_.begin(); it != system_hotkeys_.end(); ++it) {
if (it->key_code == key_code && it->modifiers == modifiers)
return true;
@@ -143,5 +129,3 @@ void SystemHotkeyMap::ReserveHotkey(int key_code, int modifiers) {
hotkey.modifiers = modifiers;
system_hotkeys_.push_back(hotkey);
}
-
-} // namespace content
« no previous file with comments | « chrome/browser/ui/cocoa/system_hotkey_map.h ('k') | chrome/browser/ui/cocoa/system_hotkey_map_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698