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

Unified 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: Address sky's comment. 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698