Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / javascript_app_modal_dialog_views_x11.cc
blobaeb72d5f060fcecaa72d8199a297a0f2b9e5b518
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views_x11.h"
7 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h"
8 #include "chrome/browser/ui/views/javascript_app_modal_event_blocker_x11.h"
9 #include "components/app_modal/javascript_app_modal_dialog.h"
10 #include "ui/views/widget/widget.h"
12 JavaScriptAppModalDialogViewsX11::JavaScriptAppModalDialogViewsX11(
13 app_modal::JavaScriptAppModalDialog* parent)
14 : app_modal::JavaScriptAppModalDialogViews(parent),
15 helper_(new AppModalDialogHelper(parent->web_contents())) {
18 JavaScriptAppModalDialogViewsX11::~JavaScriptAppModalDialogViewsX11() {
21 void JavaScriptAppModalDialogViewsX11::ShowAppModalDialog() {
22 // BrowserView::CanActivate() ensures that other browser windows cannot be
23 // activated for long while the dialog is visible. Block events to other
24 // browser windows so that the user cannot interact with other browser windows
25 // in the short time that the other browser windows are active. This hack is
26 // unnecessary on Windows and Chrome OS.
27 // TODO(pkotwicz): Find a better way of doing this and remove this hack.
28 if (!event_blocker_x11_.get()) {
29 event_blocker_x11_.reset(
30 new JavascriptAppModalEventBlockerX11(GetWidget()->GetNativeView()));
32 GetWidget()->Show();
35 void JavaScriptAppModalDialogViewsX11::WindowClosing() {
36 event_blocker_x11_.reset();