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 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "base/macros.h" | |
11 | |
12 namespace base { | |
13 template <typename T> | |
14 struct DefaultSingletonTraits; | |
15 } // namespace base | |
16 | |
17 // A browser modal dialog that will prevent the browser windows that does not | |
18 // own the modal dialog being activated. If there are multiple | |
19 // BrowserModalDialog, only the browser window owns the oldest dialog will be | |
20 // activated. Note that this dialog doesn't block other non-browser windows like | |
21 // app window. | |
22 class BrowserModalDialog { | |
23 public: | |
24 BrowserModalDialog(); | |
25 ~BrowserModalDialog(); | |
26 | |
27 // Activate the modal dialog. | |
28 virtual void ActivateModalDialog() = 0; | |
29 // Return true if modal dialog is visible. | |
30 virtual bool IsShowing() = 0; | |
31 }; | |
32 | |
33 // The list of BrowserModalDialog. | |
34 class BrowserModalDialogList { | |
35 public: | |
36 static BrowserModalDialogList* GetInstance(); | |
37 void AddDialog(BrowserModalDialog* dialog); | |
sky
2017/05/16 12:40:32
newline between 37/38. Also, document ownership.
zmin
2017/05/16 22:22:02
Done.
| |
38 void RemoveDialog(BrowserModalDialog* dialog); | |
39 | |
40 // Activate the oldest BrowserModalDialog and return true. Return false if | |
41 // there is no visible dialog. | |
42 bool ActivateModalDialog(); | |
43 | |
44 // Return true if there is any BrowserModalDialog is visible. | |
45 bool IsShowing(); | |
46 | |
47 BrowserModalDialogList(); | |
sky
2017/05/16 12:40:32
style guide says constructor/destructor before oth
zmin
2017/05/16 22:22:02
Done.
| |
48 ~BrowserModalDialogList(); | |
49 | |
50 private: | |
51 friend struct base::DefaultSingletonTraits<BrowserModalDialogList>; | |
52 | |
53 std::list<BrowserModalDialog*> dialogs_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogList); | |
56 }; | |
57 | |
58 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ | |
OLD | NEW |