Index: content/shell/browser/shell_views.cc |
diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc |
index f66df86fa0494c7cba514e512b9d634cafa304a7..c6b09e474a704e024ee2dbbdf3c320227a329d25 100644 |
--- a/content/shell/browser/shell_views.cc |
+++ b/content/shell/browser/shell_views.cc |
@@ -209,6 +209,19 @@ class ShellWindowDelegateView : public views::WidgetDelegateView, |
} |
layout->AddPaddingRow(0, 5); |
+ |
+ InitAccelerators(); |
+ } |
+ void InitAccelerators() { |
+ static const ui::KeyboardCode keys[] = { ui::VKEY_F5, |
+ ui::VKEY_BROWSER_BACK, |
+ ui::VKEY_BROWSER_FORWARD }; |
+ for (size_t i = 0; i < arraysize(keys); ++i) { |
+ GetFocusManager()->RegisterAccelerator( |
+ ui::Accelerator(keys[i], ui::EF_NONE), |
+ ui::AcceleratorManager::kNormalPriority, |
+ this); |
+ } |
} |
// Overridden from TextfieldController |
virtual void ContentsChanged(views::Textfield* sender, |
@@ -264,6 +277,23 @@ class ShellWindowDelegateView : public views::WidgetDelegateView, |
} |
} |
+ // Overridden from AcceleratorTarget: |
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { |
+ switch (accelerator.key_code()) { |
+ case ui::VKEY_F5: |
+ shell_->Reload(); |
+ return true; |
+ case ui::VKEY_BROWSER_BACK: |
+ shell_->GoBackOrForward(-1); |
+ return true; |
+ case ui::VKEY_BROWSER_FORWARD: |
+ shell_->GoBackOrForward(1); |
+ return true; |
+ default: |
+ return views::WidgetDelegateView::AcceleratorPressed(accelerator); |
+ } |
+ } |
+ |
private: |
// Hold a reference of Shell for deleting it when the window is closing |
Shell* shell_; |