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

Side by Side Diff: chrome/browser/extensions/extension_keybinding_registry.h

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11 #include <utility>
12
13 #include "base/compiler_specific.h"
14 #include "content/public/browser/notification_details.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_source.h"
18 #include "ui/base/accelerators/accelerator.h"
19
20 class Extension;
21 class Profile;
22
23 namespace views {
24 class FocusManager;
25 }
26
27 class ExtensionKeybindingRegistry : ui::AcceleratorTarget,
Matt Perry 2012/02/21 23:13:39 Please add a class comment.
28 public content::NotificationObserver {
29 public:
30 ExtensionKeybindingRegistry(Profile* profile,
31 views::FocusManager* focus_manager);
32 virtual ~ExtensionKeybindingRegistry();
33
34 // Overridden from ui::AcceleratorTarget.
35 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
36 virtual bool CanHandleAccelerators() const OVERRIDE;
37
38 // Overridden from content::NotificationObserver:
39 virtual void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) OVERRIDE;
42
43 private:
44 void AddExtensionKeybinding(const Extension* extension);
45 void RemoveExtensionKeybinding(const Extension* extension);
46
47 // Whether to ignore this command.
48 bool IgnoreCommand(const std::string& command) const;
Matt Perry 2012/02/21 23:13:39 I think ShouldIgnoreCommand would be clearer.
49
50 // Weak pointer back to parent profile.
51 Profile* profile_;
52
53 // Weak pointer back to the focus manager to use to register and unregister
54 // accelerators with.
55 views::FocusManager* focus_manager_;
56
57 // Maps an accelerator to a string pair (extension id, event name).
Matt Perry 2012/02/21 23:13:39 "event name" => "command name"
58 typedef std::map< ui::Accelerator,
59 std::pair<std::string, std::string> > EventTargets;
60 EventTargets event_targets_;
61
62 // The content notification registrar for listening to extension events.
63 content::NotificationRegistrar registrar_;
64
65 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry);
66 };
67
68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698