OLD | NEW |
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 #include "content/browser/cocoa/system_hotkey_helper_mac.h" | 5 #include "content/browser/cocoa/system_hotkey_helper_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "content/browser/cocoa/system_hotkey_map.h" | 12 #include "content/browser/cocoa/system_hotkey_map.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 NSString* kSystemHotkeyPlistExtension = | 17 NSString* kSystemHotkeyPlistExtension = |
18 @"/Preferences/com.apple.symbolichotkeys.plist"; | 18 @"/Preferences/com.apple.symbolichotkeys.plist"; |
19 | 19 |
20 // Amount of time to delay loading the hotkeys in seconds. | 20 // Amount of time to delay loading the hotkeys in seconds. |
21 const int kLoadHotkeysDelaySeconds = 10; | 21 const int kLoadHotkeysDelaySeconds = 10; |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 // static | 27 // static |
28 SystemHotkeyHelperMac* SystemHotkeyHelperMac::GetInstance() { | 28 SystemHotkeyHelperMac* SystemHotkeyHelperMac::GetInstance() { |
29 return Singleton<SystemHotkeyHelperMac>::get(); | 29 return base::Singleton<SystemHotkeyHelperMac>::get(); |
30 } | 30 } |
31 | 31 |
32 void SystemHotkeyHelperMac::DeferredLoadSystemHotkeys() { | 32 void SystemHotkeyHelperMac::DeferredLoadSystemHotkeys() { |
33 BrowserThread::PostDelayedTask( | 33 BrowserThread::PostDelayedTask( |
34 BrowserThread::FILE, | 34 BrowserThread::FILE, |
35 FROM_HERE, | 35 FROM_HERE, |
36 base::Bind(&SystemHotkeyHelperMac::LoadSystemHotkeys, | 36 base::Bind(&SystemHotkeyHelperMac::LoadSystemHotkeys, |
37 base::Unretained(this)), | 37 base::Unretained(this)), |
38 base::TimeDelta::FromSeconds(kLoadHotkeysDelaySeconds)); | 38 base::TimeDelta::FromSeconds(kLoadHotkeysDelaySeconds)); |
39 } | 39 } |
(...skipping 28 matching lines...) Expand all Loading... |
68 | 68 |
69 void SystemHotkeyHelperMac::FileDidLoad(NSDictionary* dictionary) { | 69 void SystemHotkeyHelperMac::FileDidLoad(NSDictionary* dictionary) { |
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 70 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
71 | 71 |
72 bool success = map()->ParseDictionary(dictionary); | 72 bool success = map()->ParseDictionary(dictionary); |
73 UMA_HISTOGRAM_BOOLEAN("OSX.SystemHotkeyMap.LoadSuccess", success); | 73 UMA_HISTOGRAM_BOOLEAN("OSX.SystemHotkeyMap.LoadSuccess", success); |
74 [dictionary release]; | 74 [dictionary release]; |
75 } | 75 } |
76 | 76 |
77 } // namespace content | 77 } // namespace content |
OLD | NEW |