Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H _ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H _
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H _ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEWS_H _
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/extensions/extension_keybinding_registry.h" 13 #include "chrome/browser/extensions/extension_keybinding_registry.h"
14 #include "ui/base/accelerators/accelerator.h" 14 #include "ui/base/accelerators/accelerator.h"
15 15
16 class Profile;
17
18 namespace extensions {
16 class Extension; 19 class Extension;
17 class Profile; 20 }
18 21
19 namespace views { 22 namespace views {
20 class FocusManager; 23 class FocusManager;
21 } 24 }
22 25
23 // ExtensionKeybindingRegistryViews is a class that handles Views-specific 26 // ExtensionKeybindingRegistryViews is a class that handles Views-specific
24 // implementation of the Extension Keybinding shortcuts (keyboard accelerators). 27 // implementation of the Extension Keybinding shortcuts (keyboard accelerators).
25 // Note: It handles regular extension commands (not browserAction and pageAction 28 // Note: It handles regular extension commands (not browserAction and pageAction
26 // popups, which are handled elsewhere). This class registers the accelerators 29 // popups, which are handled elsewhere). This class registers the accelerators
27 // on behalf of the extensions and routes the commands to them via the 30 // on behalf of the extensions and routes the commands to them via the
28 // BrowserEventRouter. 31 // BrowserEventRouter.
29 class ExtensionKeybindingRegistryViews 32 class ExtensionKeybindingRegistryViews
30 : public extensions::ExtensionKeybindingRegistry, 33 : public extensions::ExtensionKeybindingRegistry,
31 public ui::AcceleratorTarget { 34 public ui::AcceleratorTarget {
32 public: 35 public:
33 ExtensionKeybindingRegistryViews(Profile* profile, 36 ExtensionKeybindingRegistryViews(Profile* profile,
34 views::FocusManager* focus_manager); 37 views::FocusManager* focus_manager);
35 virtual ~ExtensionKeybindingRegistryViews(); 38 virtual ~ExtensionKeybindingRegistryViews();
36 39
37 // Overridden from ui::AcceleratorTarget. 40 // Overridden from ui::AcceleratorTarget.
38 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 41 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
39 virtual bool CanHandleAccelerators() const OVERRIDE; 42 virtual bool CanHandleAccelerators() const OVERRIDE;
40 43
41 private: 44 private:
42 // Overridden from ExtensionKeybindingRegistry: 45 // Overridden from ExtensionKeybindingRegistry:
43 virtual void AddExtensionKeybinding(const Extension* extension) OVERRIDE; 46 virtual void AddExtensionKeybinding(
44 virtual void RemoveExtensionKeybinding(const Extension* extension) OVERRIDE; 47 const extensions::Extension* extension) OVERRIDE;
48 virtual void RemoveExtensionKeybinding(
49 const extensions::Extension* extension) OVERRIDE;
45 50
46 // Weak pointer to the our profile. Not owned by us. 51 // Weak pointer to the our profile. Not owned by us.
47 Profile* profile_; 52 Profile* profile_;
48 53
49 // Weak pointer back to the focus manager to use to register and unregister 54 // Weak pointer back to the focus manager to use to register and unregister
50 // accelerators with. Not owned by us. 55 // accelerators with. Not owned by us.
51 views::FocusManager* focus_manager_; 56 views::FocusManager* focus_manager_;
52 57
53 // Maps an accelerator to a string pair (extension id, command name) for 58 // Maps an accelerator to a string pair (extension id, command name) for
54 // commands that have been registered. Unlike its GTK counterpart, this map 59 // commands that have been registered. Unlike its GTK counterpart, this map
55 // contains no registration for pageAction and browserAction commands. 60 // contains no registration for pageAction and browserAction commands.
56 typedef std::map< ui::Accelerator, 61 typedef std::map< ui::Accelerator,
57 std::pair<std::string, std::string> > EventTargets; 62 std::pair<std::string, std::string> > EventTargets;
58 EventTargets event_targets_; 63 EventTargets event_targets_;
59 64
60 // The content notification registrar for listening to extension events. 65 // The content notification registrar for listening to extension events.
61 content::NotificationRegistrar registrar_; 66 content::NotificationRegistrar registrar_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryViews); 68 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryViews);
64 }; 69 };
65 70
66 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEW S_H_ 71 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_VIEW S_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698