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

Unified Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 10834106: Implement Keybinding for script badges. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/location_bar/page_action_image_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/page_action_image_view.cc (revision 149159)
+++ chrome/browser/ui/views/location_bar/page_action_image_view.cc (working copy)
@@ -84,16 +84,42 @@
extensions::CommandService::ACTIVE_ONLY,
&page_action_command,
NULL)) {
- keybinding_.reset(new ui::Accelerator(page_action_command.accelerator()));
+ page_action_keybinding_.reset(
+ new ui::Accelerator(page_action_command.accelerator()));
owner_->GetFocusManager()->RegisterAccelerator(
- *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this);
+ *page_action_keybinding_.get(),
+ ui::AcceleratorManager::kHighPriority,
+ this);
}
+
+ extensions::Command script_badge_command;
+ if (command_service->GetScriptBadgeCommand(
+ extension->id(),
+ extensions::CommandService::ACTIVE_ONLY,
+ &script_badge_command,
+ NULL)) {
+ script_badge_keybinding_.reset(
+ new ui::Accelerator(script_badge_command.accelerator()));
+ owner_->GetFocusManager()->RegisterAccelerator(
+ *script_badge_keybinding_.get(),
+ ui::AcceleratorManager::kHighPriority,
+ this);
+ }
}
PageActionImageView::~PageActionImageView() {
- if (keybinding_.get() && owner_->GetFocusManager())
- owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
+ if (owner_->GetFocusManager()) {
+ if (page_action_keybinding_.get()) {
+ owner_->GetFocusManager()->UnregisterAccelerator(
+ *page_action_keybinding_.get(), this);
+ }
+ if (script_badge_keybinding_.get()) {
+ owner_->GetFocusManager()->UnregisterAccelerator(
+ *script_badge_keybinding_.get(), this);
+ }
+ }
+
if (popup_)
popup_->GetWidget()->RemoveObserver(this);
HidePopup();

Powered by Google App Engine
This is Rietveld 408576698