OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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. | |
4 | |
5 #include "chrome/browser/ui/views/app_modal_dialog_queue_wrapper.h" | |
6 | |
7 #include <algorithm> | |
8 | |
9 #include "chrome/browser/ui/browser.h" | |
10 #include "chrome/browser/ui/browser_finder.h" | |
11 #include "chrome/browser/ui/browser_window.h" | |
12 #include "components/app_modal/app_modal_dialog.h" | |
13 #include "components/app_modal/app_modal_dialog_queue.h" | |
14 #include "components/app_modal/native_app_modal_dialog.h" | |
15 | |
16 AppModalDialogQueueWrapper::AppModalDialogQueueWrapper() | |
17 : BrowserModalDialog(false) {} | |
18 | |
19 AppModalDialogQueueWrapper::~AppModalDialogQueueWrapper() {} | |
20 | |
21 void AppModalDialogQueueWrapper::ActivateModalDialog(Browser* browser) { | |
22 app_modal::AppModalDialogQueue* queue = | |
23 app_modal::AppModalDialogQueue::GetInstance(); | |
24 #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.
| |
25 queue->ActivateModalDialog(); | |
26 #else | |
27 // Flash and activate the modal browser. | |
28 app_modal::AppModalDialog* active_dialog = | |
29 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); | |
30 if (!active_dialog) | |
31 return; | |
32 | |
33 Browser* modal_browser = | |
34 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); | |
35 if (modal_browser && (browser != modal_browser)) { | |
36 modal_browser->window()->FlashFrame(true); | |
37 modal_browser->window()->Activate(); | |
38 } | |
39 | |
40 queue->ActivateModalDialog(); | |
41 #endif | |
42 } | |
43 | |
44 bool AppModalDialogQueueWrapper::IsShowing() { | |
45 app_modal::AppModalDialogQueue* queue = | |
46 app_modal::AppModalDialogQueue::GetInstance(); | |
47 return queue->active_dialog() && queue->active_dialog()->native_dialog() && | |
48 queue->active_dialog()->native_dialog()->IsShowing(); | |
49 } | |
OLD | NEW |