OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views_x11.h" | 5 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views_x11.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/javascript_app_modal_event_blocker_x11.h" | 7 #include "chrome/browser/ui/views/javascript_app_modal_event_blocker_x11.h" |
8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
9 | 9 |
10 JavaScriptAppModalDialogViewsX11::JavaScriptAppModalDialogViewsX11( | 10 JavaScriptAppModalDialogViewsX11::JavaScriptAppModalDialogViewsX11( |
11 JavaScriptAppModalDialog* parent) | 11 app_modal::JavaScriptAppModalDialog* parent) |
12 : JavaScriptAppModalDialogViews(parent) {} | 12 : app_modal::JavaScriptAppModalDialogViews(parent) {} |
13 | 13 |
14 JavaScriptAppModalDialogViewsX11::~JavaScriptAppModalDialogViewsX11() { | 14 JavaScriptAppModalDialogViewsX11::~JavaScriptAppModalDialogViewsX11() { |
15 } | 15 } |
16 | 16 |
17 void JavaScriptAppModalDialogViewsX11::ShowAppModalDialog() { | 17 void JavaScriptAppModalDialogViewsX11::ShowAppModalDialog() { |
18 // BrowserView::CanActivate() ensures that other browser windows cannot be | 18 // BrowserView::CanActivate() ensures that other browser windows cannot be |
19 // activated for long while the dialog is visible. Block events to other | 19 // activated for long while the dialog is visible. Block events to other |
20 // browser windows so that the user cannot interact with other browser windows | 20 // browser windows so that the user cannot interact with other browser windows |
21 // in the short time that the other browser windows are active. This hack is | 21 // in the short time that the other browser windows are active. This hack is |
22 // unnecessary on Windows and Chrome OS. | 22 // unnecessary on Windows and Chrome OS. |
23 // TODO(pkotwicz): Find a better way of doing this and remove this hack. | 23 // TODO(pkotwicz): Find a better way of doing this and remove this hack. |
24 if (!event_blocker_x11_.get()) { | 24 if (!event_blocker_x11_.get()) { |
25 event_blocker_x11_.reset( | 25 event_blocker_x11_.reset( |
26 new JavascriptAppModalEventBlockerX11(GetWidget()->GetNativeView())); | 26 new JavascriptAppModalEventBlockerX11(GetWidget()->GetNativeView())); |
27 } | 27 } |
28 GetWidget()->Show(); | 28 GetWidget()->Show(); |
29 } | 29 } |
30 | 30 |
31 void JavaScriptAppModalDialogViewsX11::WindowClosing() { | 31 void JavaScriptAppModalDialogViewsX11::WindowClosing() { |
32 event_blocker_x11_.reset(); | 32 event_blocker_x11_.reset(); |
33 } | 33 } |
OLD | NEW |