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

Unified Diff: ui/views/controls/webview/web_dialog_view.cc

Issue 2871073002: cros: Bind hangup red button on remote controller to close web dialog (Closed)
Patch Set: for discussion Created 3 years, 7 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: ui/views/controls/webview/web_dialog_view.cc
diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc
index 81e1882f67fe0d694f37fa2c30a1c53b60a69f14..b0795b10de10e10fa467843fd8ae119acb1a8156 100644
--- a/ui/views/controls/webview/web_dialog_view.cc
+++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -54,6 +54,12 @@ WebDialogView::WebDialogView(
SetLayoutManager(new views::FillLayout);
// Pressing the ESC key will close the dialog.
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
+
+ // For Chrome OS/CFM, Shift + Browser Back is mapped to hangup button, which
+ // can be used to close the web dialog.
+ ui::Accelerator shift_browser_back(ui::VKEY_BROWSER_BACK, ui::EF_SHIFT_DOWN);
+ if (AdditionalAccelerator(shift_browser_back))
+ AddAccelerator(shift_browser_back);
}
WebDialogView::~WebDialogView() {
@@ -81,8 +87,8 @@ gfx::Size WebDialogView::GetMinimumSize() const {
}
bool WebDialogView::AcceleratorPressed(const ui::Accelerator& accelerator) {
- // Pressing ESC closes the dialog.
- DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code());
+ DCHECK(ui::VKEY_ESCAPE == accelerator.key_code() ||
+ AdditionalAccelerator(accelerator));
if (GetWidget())
GetWidget()->Close();
return true;
@@ -265,6 +271,13 @@ bool WebDialogView::HandleContextMenu(
return WebDialogWebContentsDelegate::HandleContextMenu(params);
}
+bool WebDialogView::AdditionalAccelerator(
+ const ui::Accelerator& accelerator) const {
+ if (delegate_)
+ return delegate_->AdditionalAccelerator(accelerator);
+ return false;
+}
+
////////////////////////////////////////////////////////////////////////////////
// content::WebContentsDelegate implementation:

Powered by Google App Engine
This is Rietveld 408576698