| Index: chrome/browser/ui/views/app_modal_dialog_queue_wrapper.cc
|
| diff --git a/chrome/browser/ui/views/app_modal_dialog_queue_wrapper.cc b/chrome/browser/ui/views/app_modal_dialog_queue_wrapper.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5e88a85f8b81862bad6abd7d7fd5362335a1b917
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/app_modal_dialog_queue_wrapper.cc
|
| @@ -0,0 +1,50 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/views/app_modal_dialog_queue_wrapper.h"
|
| +
|
| +#include <algorithm>
|
| +
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_finder.h"
|
| +#include "chrome/browser/ui/browser_window.h"
|
| +#include "components/app_modal/app_modal_dialog.h"
|
| +#include "components/app_modal/app_modal_dialog_queue.h"
|
| +#include "components/app_modal/native_app_modal_dialog.h"
|
| +
|
| +AppModalDialogQueueWrapper::AppModalDialogQueueWrapper() {}
|
| +
|
| +AppModalDialogQueueWrapper::~AppModalDialogQueueWrapper() {}
|
| +
|
| +void AppModalDialogQueueWrapper::ActivateModalDialog(Browser* browser) {
|
| + app_modal::AppModalDialogQueue* queue =
|
| + app_modal::AppModalDialogQueue::GetInstance();
|
| +// Javascript dialog will be activaed with PostTask on all platforms except
|
| +// Aura.
|
| +#if defined(USE_AURA) && defined(OS_CHROMEOS)
|
| + queue->ActivateModalDialog();
|
| +#else
|
| + // Flash and activate the modal browser.
|
| + app_modal::AppModalDialog* active_dialog =
|
| + app_modal::AppModalDialogQueue::GetInstance()->active_dialog();
|
| + if (!active_dialog)
|
| + return;
|
| +
|
| + Browser* modal_browser =
|
| + chrome::FindBrowserWithWebContents(active_dialog->web_contents());
|
| + if (modal_browser && (browser != modal_browser)) {
|
| + modal_browser->window()->FlashFrame(true);
|
| + modal_browser->window()->Activate();
|
| + }
|
| +
|
| + queue->ActivateModalDialog();
|
| +#endif
|
| +}
|
| +
|
| +bool AppModalDialogQueueWrapper::IsShowing() {
|
| + app_modal::AppModalDialogQueue* queue =
|
| + app_modal::AppModalDialogQueue::GetInstance();
|
| + return queue->active_dialog() && queue->active_dialog()->native_dialog() &&
|
| + queue->active_dialog()->native_dialog()->IsShowing();
|
| +}
|
|
|