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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

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: Try meta_l rather than super_l 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/ui/views/toolbar/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index 573795fccd7857eeda603eeecd07b73870235446..2b9d03ea3369877651f30eb598082b8053acc294 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -14,6 +14,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/command_updater.h"
+#include "chrome/browser/extensions/extension_commands_global_registry.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
@@ -270,9 +271,31 @@ void ToolbarView::Init() {
void ToolbarView::OnWidgetVisibilityChanged(views::Widget* widget,
bool visible) {
- // Safe to call multiple times; the bubble will only appear once.
- if (visible)
+ if (visible) {
+ // Safe to call multiple times; the bubble will only appear once.
extension_message_bubble_factory_->MaybeShow(app_menu_);
+ }
+
+ extensions::ExtensionCommandsGlobalRegistry* registry =
+ extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile());
+ if (registry) {
+ if (visible) {
sky 2014/09/16 02:34:48 Isn't it the active state and not the visibility y
David Tseng 2014/09/16 04:11:53 You're right. Added WidgetObserver override.
+ registry->set_registry_for_active_window(
+ browser_actions_->extension_keybinding_registry());
+ } else if (registry->registry_for_active_window() ==
+ browser_actions_->extension_keybinding_registry()) {
+ registry->set_registry_for_active_window(NULL);
+ }
+ }
+}
+
+void ToolbarView::OnWidgetDestroyed(views::Widget* widget) {
+ extensions::ExtensionCommandsGlobalRegistry* registry =
+ extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile());
+ if (registry &&
+ registry->registry_for_active_window() ==
+ browser_actions_->extension_keybinding_registry())
+ registry->set_registry_for_active_window(NULL);
}
void ToolbarView::Update(WebContents* tab) {

Powered by Google App Engine
This is Rietveld 408576698