Chromium Code Reviews| Index: chrome/browser/extensions/extension_keybinding_registry_tracker.h |
| diff --git a/chrome/browser/extensions/extension_keybinding_registry_tracker.h b/chrome/browser/extensions/extension_keybinding_registry_tracker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..82594a92911e321ab4c3aac2bf1c6fcfe6cceb06 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/extension_keybinding_registry_tracker.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
|
Devlin
2014/09/11 18:41:01
no (c), and not 2013 anymore :)
David Tseng
2014/09/11 19:34:20
Done.
|
| +// 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_TRACKER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_TRACKER_H_ |
| + |
| +#include "chrome/browser/extensions/extension_keybinding_registry.h" |
| +#include "extensions/browser/browser_context_keyed_api_factory.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace extensions { |
| + |
| +// ExtensionKeybindingRegistryTracker holds the active BrowserWindow's |
| +// ExtensionKeybindingRegistry. |
| +class ExtensionKeybindingRegistryTracker : public BrowserContextKeyedAPI { |
|
Devlin
2014/09/11 18:41:01
After seeing the whole of this patch, I think this
David Tseng
2014/09/11 18:58:50
I'd prefer to keep these separated since I think w
Devlin
2014/09/11 19:48:48
I don't think that making an accessor to an active
David Tseng
2014/09/11 20:38:41
Example of the confusion here...you meant Extensio
Devlin
2014/09/11 20:52:45
I think I named them all correctly in my comments
Finnur
2014/09/12 11:25:43
Thanks Devlin, for weighing in. It was good to get
|
| + public: |
| + // BrowserContextKeyedAPI implementation. |
| + static BrowserContextKeyedAPIFactory<ExtensionKeybindingRegistryTracker>* |
| + GetFactoryInstance(); |
| + |
| + // Convenience method to get the ExtensionKeybindingRegistryTracker for a |
| + // profile. |
|
Devlin
2014/09/11 18:41:01
nit: s/profile/browser context.
David Tseng
2014/09/11 19:34:20
Done.
|
| + static ExtensionKeybindingRegistryTracker* Get( |
| + content::BrowserContext* context); |
| + |
| + // Updates the active ExtensionKeybindingRegistry. |
| + void Update(ExtensionKeybindingRegistry* registry); |
| + |
| + // Gets the active ExtensionKeybindingRegistry. |
| + ExtensionKeybindingRegistry* GetActiveRegistry(); |
| + |
| + explicit ExtensionKeybindingRegistryTracker(content::BrowserContext* context); |
|
Devlin
2014/09/11 18:41:01
nit: Prefer these at the top (right below public:)
David Tseng
2014/09/11 19:34:20
Done.
|
| + virtual ~ExtensionKeybindingRegistryTracker(); |
| + |
| + private: |
| + friend class BrowserContextKeyedAPIFactory< |
| + ExtensionKeybindingRegistryTracker>; |
| + |
| + // BrowserContextKeyedAPI implementation. |
| + static const char* service_name() { |
| + return "ExtensionKeybindingRegistryTracker"; |
| + } |
| + |
| + // Weak pointer to our browser context. Not owned by us. |
| + content::BrowserContext* browser_context_; |
| + |
| + // The active ExtensionKeybindingRegistry. |
| + ExtensionKeybindingRegistry* registry_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryTracker); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_TRACKER_H_ |