[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / extensions / extension_keybinding_registry_views.h
blob4e2fc87addb077ee095b2ade0b839f72c47f2f48
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/extension_keybinding_registry.h"
12 #include "ui/base/accelerators/accelerator.h"
14 class Profile;
16 namespace extensions {
17 class Extension;
20 namespace views {
21 class FocusManager;
24 // ExtensionKeybindingRegistryViews is a class that handles Views-specific
25 // implementation of the Extension Keybinding shortcuts (keyboard accelerators).
26 // Note: It handles regular extension commands (not browserAction and pageAction
27 // popups, which are handled elsewhere). This class registers the accelerators
28 // on behalf of the extensions and routes the commands to them via the
29 // BrowserEventRouter.
30 class ExtensionKeybindingRegistryViews
31 : public extensions::ExtensionKeybindingRegistry,
32 public ui::AcceleratorTarget {
33 public:
34 ExtensionKeybindingRegistryViews(Profile* profile,
35 views::FocusManager* focus_manager,
36 ExtensionFilter extension_filter,
37 Delegate* delegate);
38 virtual ~ExtensionKeybindingRegistryViews();
40 // Overridden from ui::AcceleratorTarget.
41 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
42 virtual bool CanHandleAccelerators() const OVERRIDE;
44 private:
45 // Overridden from ExtensionKeybindingRegistry:
46 virtual void AddExtensionKeybinding(
47 const extensions::Extension* extension,
48 const std::string& command_name) OVERRIDE;
49 virtual void RemoveExtensionKeybindingImpl(
50 const ui::Accelerator& accelerator,
51 const std::string& command_name) OVERRIDE;
53 // Weak pointer to the our profile. Not owned by us.
54 Profile* profile_;
56 // Weak pointer back to the focus manager to use to register and unregister
57 // accelerators with. Not owned by us.
58 views::FocusManager* focus_manager_;
60 // The content notification registrar for listening to extension events.
61 content::NotificationRegistrar registrar_;
63 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryViews);
66 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H_