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

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,43 @@
extensions::CommandService::ACTIVE_ONLY,
&page_action_command,
NULL)) {
- keybinding_.reset(new ui::Accelerator(page_action_command.accelerator()));
+ keybinding_page_action_.reset(
+ new ui::Accelerator(page_action_command.accelerator()));
owner_->GetFocusManager()->RegisterAccelerator(
- *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this);
+ *keybinding_page_action_.get(),
+ ui::AcceleratorManager::kHighPriority,
+ this);
}
+
+ extensions::Command script_badge_command;
+ if (command_service->GetScriptBadgeCommand(
+ extension->id(),
+ extensions::CommandService::ACTIVE_ONLY,
+ &script_badge_command,
+ NULL)) {
+
+ keybinding_script_badge_.reset(
+ new ui::Accelerator(script_badge_command.accelerator()));
+ owner_->GetFocusManager()->RegisterAccelerator(
+ *keybinding_script_badge_.get(),
+ ui::AcceleratorManager::kHighPriority,
+ this);
+ }
}
PageActionImageView::~PageActionImageView() {
- if (keybinding_.get() && owner_->GetFocusManager())
- owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
+ if (owner_->GetFocusManager()) {
+ if (keybinding_page_action_.get()) {
+ owner_->GetFocusManager()->UnregisterAccelerator(
+ *keybinding_page_action_.get(), this);
+ }
+ if (keybinding_script_badge_.get()) {
+ owner_->GetFocusManager()->UnregisterAccelerator(
+ *keybinding_script_badge_.get(), this);
+ }
+ }
+
if (popup_)
popup_->GetWidget()->RemoveObserver(this);
HidePopup();

Powered by Google App Engine
This is Rietveld 408576698