Chromium Code Reviews| 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..1c41d482472448a31c6498fcf8487411978fc661 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,34 @@ 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_); |
| + } |
| +} |
| + |
| +void ToolbarView::OnWidgetActivationChanged(views::Widget* widget, |
| + bool active) { |
| + extensions::ExtensionCommandsGlobalRegistry* registry = |
| + extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); |
| + if (registry) { |
| + if (active) { |
| + 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) { |
|
sky
2014/09/16 16:44:35
Is this needed? Won't you get OnWidgetActivationCh
David Tseng
2014/09/16 20:42:57
On digging through some of the views code, I don't
sky
2014/09/16 22:05:49
What case do you think this isn't guaranteed?
David Tseng
2014/09/17 01:01:53
What happens if I close a browser window? Would I
sky
2014/09/17 03:54:44
Your certainly should.
|
| + 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) { |