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

Unified Diff: content/shell/browser/shell_views.cc

Issue 143983015: Add F5 (reload), back and forward key accelerators to the Aura-based content shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698