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

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: nits 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
« no previous file with comments | « ui/views/controls/webview/web_dialog_view.h ('k') | ui/views/test/widget_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2004b24935bab4271a7c0b6470cb1f674140a705 100644
--- a/ui/views/controls/webview/web_dialog_view.cc
+++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -36,24 +36,24 @@ namespace views {
////////////////////////////////////////////////////////////////////////////////
// WebDialogView, public:
-WebDialogView::WebDialogView(
- content::BrowserContext* context,
- WebDialogDelegate* delegate,
- WebContentsHandler* handler)
- : ClientView(NULL, NULL),
+WebDialogView::WebDialogView(content::BrowserContext* context,
+ WebDialogDelegate* delegate,
+ WebContentsHandler* handler)
+ : ClientView(nullptr, nullptr),
WebDialogWebContentsDelegate(context, handler),
delegate_(delegate),
- web_view_(new views::WebView(context)),
- is_attempting_close_dialog_(false),
- before_unload_fired_(false),
- closed_via_webui_(false),
- close_contents_called_(false) {
+ web_view_(new views::WebView(context)) {
web_view_->set_allow_accelerators(true);
AddChildView(web_view_);
set_contents_view(web_view_);
SetLayoutManager(new views::FillLayout);
// Pressing the ESC key will close the dialog.
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
+
+ if (delegate_) {
+ for (const auto& accelerator : delegate_->GetAccelerators())
+ AddAccelerator(accelerator);
+ }
}
WebDialogView::~WebDialogView() {
@@ -81,6 +81,9 @@ gfx::Size WebDialogView::GetMinimumSize() const {
}
bool WebDialogView::AcceleratorPressed(const ui::Accelerator& accelerator) {
+ if (delegate_ && delegate_->AcceleratorPressed(accelerator))
+ return true;
+
// Pressing ESC closes the dialog.
DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code());
if (GetWidget())
@@ -234,7 +237,7 @@ void WebDialogView::OnDialogClosed(const std::string& json_retval) {
if (delegate_) {
delegate_->OnDialogClosed(json_retval);
- delegate_ = NULL; // We will not communicate further with the delegate.
+ delegate_ = nullptr; // We will not communicate further with the delegate.
}
}
@@ -296,7 +299,7 @@ void WebDialogView::CloseContents(WebContents* source) {
content::WebContents* WebDialogView::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
- content::WebContents* new_contents = NULL;
+ content::WebContents* new_contents = nullptr;
if (delegate_ &&
delegate_->HandleOpenURLFromTab(source, params, &new_contents)) {
return new_contents;
« no previous file with comments | « ui/views/controls/webview/web_dialog_view.h ('k') | ui/views/test/widget_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698