Chromium Code Reviews| 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 #include <memory> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 | |
| 13 namespace base { | |
| 14 template <typename T> | |
| 15 struct DefaultSingletonTraits; | |
| 16 } // namespace base | |
| 17 | |
| 18 class AppModalDialogQueueWrapper; | |
| 19 class Browser; | |
| 20 | |
| 21 // A browser modal dialog that will prevent the browser windows that does not | |
|
sky
2017/05/17 18:03:18
How about: 'BrowserModalDialog prevents all browse
zmin
2017/05/18 03:31:18
Done.
| |
| 22 // own the modal dialog being activated. If there are multiple | |
| 23 // BrowserModalDialog, only the browser window owns the oldest dialog will be | |
| 24 // activated. Note that this dialog doesn't block other non-browser windows like | |
| 25 // app window. | |
| 26 class BrowserModalDialog { | |
| 27 public: | |
| 28 BrowserModalDialog(); | |
| 29 explicit BrowserModalDialog(bool with_list); | |
|
sky
2017/05/17 18:03:18
Doing processing like you have here in the constru
zmin
2017/05/18 03:31:18
Done.
| |
| 30 | |
| 31 virtual ~BrowserModalDialog(); | |
| 32 | |
| 33 // Activate the modal dialog. | |
| 34 virtual void ActivateModalDialog(Browser* other_browser) = 0; | |
|
sky
2017/05/17 18:03:17
Document what browser is.
zmin
2017/05/18 03:31:18
Done.
| |
| 35 | |
| 36 // Return true if modal dialog is visible. | |
| 37 virtual bool IsShowing() = 0; | |
| 38 }; | |
| 39 | |
| 40 // The list of BrowserModalDialog. | |
|
sky
2017/05/17 18:03:18
BrowserModalDialog -> BrowserModalDialogs
zmin
2017/05/18 03:31:17
Done.
| |
| 41 class BrowserModalDialogList { | |
| 42 public: | |
| 43 BrowserModalDialogList(); | |
|
sky
2017/05/17 18:03:17
Can the constructor/destructor be private as GetIn
zmin
2017/05/18 03:31:18
Done.
| |
| 44 ~BrowserModalDialogList(); | |
| 45 | |
| 46 static BrowserModalDialogList* GetInstance(); | |
| 47 | |
| 48 // BrowserModalDialogList will not take the ownership of the dialog instance. | |
| 49 void AddDialog(BrowserModalDialog* dialog); | |
| 50 | |
| 51 void RemoveDialog(BrowserModalDialog* dialog); | |
| 52 | |
| 53 // Activate the oldest BrowserModalDialog and return true. Return false if | |
|
sky
2017/05/17 18:03:18
return -> returns
zmin
2017/05/18 03:31:18
Done.
| |
| 54 // there is no visible dialog. | |
| 55 void ActivateModalDialog(Browser* browser); | |
|
sky
2017/05/17 18:03:18
Document what browser is.
zmin
2017/05/18 03:31:17
Done.
| |
| 56 | |
| 57 // Return true if there is any BrowserModalDialog is visible. | |
|
sky
2017/05/17 18:03:17
Returns true if any BrowserModalDialogs are visibl
zmin
2017/05/18 03:31:17
Done.
| |
| 58 bool IsShowing(); | |
| 59 | |
| 60 private: | |
| 61 friend struct base::DefaultSingletonTraits<BrowserModalDialogList>; | |
| 62 | |
| 63 std::list<BrowserModalDialog*> dialogs_; | |
| 64 std::unique_ptr<AppModalDialogQueueWrapper> wrapper_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogList); | |
| 67 }; | |
| 68 | |
| 69 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ | |
| OLD | NEW |