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

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

Issue 553243002: Track the active ExtensionKeybindingRegistry and make it available to EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years, 3 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
(Empty)
1 // Copyright 2014 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_TRACKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_TRACKER_H_
7
8 #include "chrome/browser/extensions/extension_keybinding_registry.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
10
11 namespace content {
12 class BrowserContext;
13 }
14
15 namespace extensions {
16
17 // ExtensionKeybindingRegistryTracker holds the active BrowserWindow's
18 // ExtensionKeybindingRegistry.
19 class ExtensionKeybindingRegistryTracker : public BrowserContextKeyedAPI {
20 public:
21 explicit ExtensionKeybindingRegistryTracker(content::BrowserContext* context);
22 virtual ~ExtensionKeybindingRegistryTracker();
23
24 // BrowserContextKeyedAPI implementation.
25 static BrowserContextKeyedAPIFactory<ExtensionKeybindingRegistryTracker>*
26 GetFactoryInstance();
27
28 // Convenience method to get the ExtensionKeybindingRegistryTracker for a
29 // browser context.
30 static ExtensionKeybindingRegistryTracker* Get(
31 content::BrowserContext* context);
32
33 // Sets the active ExtensionKeybindingRegistry.
34 void SetActiveRegistry(ExtensionKeybindingRegistry* registry);
35
36 // Gets the active ExtensionKeybindingRegistry.
37 ExtensionKeybindingRegistry* GetActiveRegistry();
38
39 private:
40 friend class BrowserContextKeyedAPIFactory<
41 ExtensionKeybindingRegistryTracker>;
42
43 // BrowserContextKeyedAPI implementation.
44 static const char* service_name() {
45 return "ExtensionKeybindingRegistryTracker";
46 }
47
48 // Weak pointer to our browser context. Not owned by us.
49 content::BrowserContext* browser_context_;
50
51 // The active ExtensionKeybindingRegistry.
52 ExtensionKeybindingRegistry* registry_;
53
54 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryTracker);
55 };
56
57 } // namespace extensions
58
59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698