| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/global_shortcut_listener_mac.h" | |
| 6 | |
| 7 #include "content/public/browser/browser_thread.h" | |
| 8 | |
| 9 using content::BrowserThread; | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 static base::LazyInstance<extensions::GlobalShortcutListenerMac> instance = | |
| 14 LAZY_INSTANCE_INITIALIZER; | |
| 15 | |
| 16 } // namespace | |
| 17 | |
| 18 namespace extensions { | |
| 19 | |
| 20 // static | |
| 21 GlobalShortcutListener* GlobalShortcutListener::GetInstance() { | |
| 22 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 23 return instance.Pointer(); | |
| 24 } | |
| 25 | |
| 26 GlobalShortcutListenerMac::GlobalShortcutListenerMac() | |
| 27 : is_listening_(false) { | |
| 28 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 29 | |
| 30 // TODO(implementor): Remove this. | |
| 31 LOG(ERROR) << "GlobalShortcutListenerMac object created"; | |
| 32 } | |
| 33 | |
| 34 GlobalShortcutListenerMac::~GlobalShortcutListenerMac() { | |
| 35 if (is_listening_) | |
| 36 StopListening(); | |
| 37 } | |
| 38 | |
| 39 void GlobalShortcutListenerMac::StartListening() { | |
| 40 DCHECK(!is_listening_); // Don't start twice. | |
| 41 NOTIMPLEMENTED(); | |
| 42 is_listening_ = true; | |
| 43 } | |
| 44 | |
| 45 void GlobalShortcutListenerMac::StopListening() { | |
| 46 DCHECK(is_listening_); // No point if we are not already listening. | |
| 47 NOTIMPLEMENTED(); | |
| 48 is_listening_ = false; | |
| 49 } | |
| 50 | |
| 51 void GlobalShortcutListenerMac::RegisterAccelerator( | |
| 52 const ui::Accelerator& accelerator, | |
| 53 GlobalShortcutListener::Observer* observer) { | |
| 54 NOTIMPLEMENTED(); | |
| 55 // To implement: | |
| 56 // 1) Convert modifiers to platform specific modifiers. | |
| 57 // 2) Register for the hotkey. | |
| 58 // 3) If not successful, log why. | |
| 59 // 4) Else, call base class RegisterAccelerator. | |
| 60 | |
| 61 GlobalShortcutListener::RegisterAccelerator(accelerator, observer); | |
| 62 } | |
| 63 | |
| 64 void GlobalShortcutListenerMac::UnregisterAccelerator( | |
| 65 const ui::Accelerator& accelerator, | |
| 66 GlobalShortcutListener::Observer* observer) { | |
| 67 NOTIMPLEMENTED(); | |
| 68 // To implement: | |
| 69 // 1) Unregister for the hotkey. | |
| 70 // 2) Call base class UnregisterAccelerator. | |
| 71 | |
| 72 GlobalShortcutListener::UnregisterAccelerator(accelerator, observer); | |
| 73 } | |
| 74 | |
| 75 } // namespace extensions | |
| OLD | NEW |