| Index: chrome/browser/extensions/global_shortcut_listener.h
|
| diff --git a/chrome/browser/extensions/global_shortcut_listener.h b/chrome/browser/extensions/global_shortcut_listener.h
|
| index c61abe65f0c16b91c722c33a1c9b165583e20af3..f79187440749231c72a06b65234fbf9e8b782ae0 100644
|
| --- a/chrome/browser/extensions/global_shortcut_listener.h
|
| +++ b/chrome/browser/extensions/global_shortcut_listener.h
|
| @@ -18,7 +18,7 @@ class Accelerator;
|
| namespace extensions {
|
|
|
| // Platform-neutral implementation of a class that keeps track of observers and
|
| -// monitors keystrokes. It relays messages to the appropriate observers when a
|
| +// monitors keystrokes. It relays messages to the appropriate observer when a
|
| // global shortcut has been struck by the user.
|
| class GlobalShortcutListener {
|
| public:
|
| @@ -32,28 +32,32 @@ class GlobalShortcutListener {
|
|
|
| static GlobalShortcutListener* GetInstance();
|
|
|
| - // Implemented by platform-specific implementations of this class.
|
| - virtual void StartListening() = 0;
|
| - virtual void StopListening() = 0;
|
| -
|
| - // Register an observer for when a certain |accelerator| is struck.
|
| - virtual void RegisterAccelerator(
|
| - const ui::Accelerator& accelerator, Observer* observer);
|
| + // Register an observer for when a certain |accelerator| is struck. Return
|
| + // true if register successfully, false if the specificied |accelerator| has
|
| + // been registered by callers or other native applications.
|
| + bool RegisterAccelerator(const ui::Accelerator& accelerator,
|
| + Observer* observer);
|
| // Stop listening for the given |accelerator|.
|
| - virtual void UnregisterAccelerator(
|
| - const ui::Accelerator& accelerator, Observer* observer);
|
| + void UnregisterAccelerator(const ui::Accelerator& accelerator,
|
| + Observer* observer);
|
|
|
| protected:
|
| GlobalShortcutListener();
|
|
|
| // Called by platform specific implementations of this class whenever a key
|
| - // is struck. Only called for keys that have observers registered.
|
| + // is struck. Only called for keys that have an observer registered.
|
| void NotifyKeyPressed(const ui::Accelerator& accelerator);
|
|
|
| + // Implemented by platform-specific implementations of this class.
|
| + virtual void StartListening() = 0;
|
| + virtual void StopListening() = 0;
|
| + virtual bool RegisterAcceleratorImpl(const ui::Accelerator& accelerator) = 0;
|
| + virtual void UnregisterAcceleratorImpl(
|
| + const ui::Accelerator& accelerator) = 0;
|
| +
|
| // The map of accelerators that have been successfully registered as global
|
| - // shortcuts and their observer lists.
|
| - typedef ObserverList<Observer> Observers;
|
| - typedef std::map< ui::Accelerator, Observers* > AcceleratorMap;
|
| + // shortcuts and their observer.
|
| + typedef std::map< ui::Accelerator, Observer* > AcceleratorMap;
|
| AcceleratorMap accelerator_map_;
|
|
|
| private:
|
|
|