Chromium Code Reviews| 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..2969ec2758288db12c60181174280780e55206b4 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/app_modal_dialog_queue_wrapper.cc |
| @@ -0,0 +1,49 @@ |
| +// 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() |
| + : BrowserModalDialog(false) {} |
| + |
| +AppModalDialogQueueWrapper::~AppModalDialogQueueWrapper() {} |
| + |
| +void AppModalDialogQueueWrapper::ActivateModalDialog(Browser* browser) { |
| + app_modal::AppModalDialogQueue* queue = |
| + app_modal::AppModalDialogQueue::GetInstance(); |
| +#if defined(USE_AURA) && defined(OS_CHROMEOS) |
|
sky
2017/05/17 18:03:17
Please add description as to why the two are diffe
zmin
2017/05/18 03:31:17
Done.
|
| + 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(); |
| +} |