Chromium Code Reviews| Index: chrome/browser/extensions/extension_keybinding_registry.h |
| =================================================================== |
| --- chrome/browser/extensions/extension_keybinding_registry.h (revision 0) |
| +++ chrome/browser/extensions/extension_keybinding_registry.h (revision 0) |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
| +#pragma once |
| + |
| +#include <map> |
| +#include <string> |
| +#include <utility> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "content/public/browser/notification_details.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "content/public/browser/notification_source.h" |
| +#include "ui/base/accelerators/accelerator.h" |
| + |
| +class Extension; |
| +class Profile; |
| + |
| +namespace views { |
| +class FocusManager; |
| +} |
| + |
| +class ExtensionKeybindingRegistry : ui::AcceleratorTarget, |
|
Matt Perry
2012/02/21 23:13:39
Please add a class comment.
|
| + public content::NotificationObserver { |
| + public: |
| + ExtensionKeybindingRegistry(Profile* profile, |
| + views::FocusManager* focus_manager); |
| + virtual ~ExtensionKeybindingRegistry(); |
| + |
| + // Overridden from ui::AcceleratorTarget. |
| + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| + virtual bool CanHandleAccelerators() const OVERRIDE; |
| + |
| + // Overridden from content::NotificationObserver: |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + private: |
| + void AddExtensionKeybinding(const Extension* extension); |
| + void RemoveExtensionKeybinding(const Extension* extension); |
| + |
| + // Whether to ignore this command. |
| + bool IgnoreCommand(const std::string& command) const; |
|
Matt Perry
2012/02/21 23:13:39
I think ShouldIgnoreCommand would be clearer.
|
| + |
| + // Weak pointer back to parent profile. |
| + Profile* profile_; |
| + |
| + // Weak pointer back to the focus manager to use to register and unregister |
| + // accelerators with. |
| + views::FocusManager* focus_manager_; |
| + |
| + // Maps an accelerator to a string pair (extension id, event name). |
|
Matt Perry
2012/02/21 23:13:39
"event name" => "command name"
|
| + typedef std::map< ui::Accelerator, |
| + std::pair<std::string, std::string> > EventTargets; |
| + EventTargets event_targets_; |
| + |
| + // The content notification registrar for listening to extension events. |
| + content::NotificationRegistrar registrar_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
| Property changes on: chrome\browser\extensions\extension_keybinding_registry.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |