Index: chrome/browser/ui/views/browser_modal_dialog.h |
diff --git a/chrome/browser/ui/views/browser_modal_dialog.h b/chrome/browser/ui/views/browser_modal_dialog.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..db60bb1bfe73c19b841b17937c50be94f4abc438 |
--- /dev/null |
+++ b/chrome/browser/ui/views/browser_modal_dialog.h |
@@ -0,0 +1,69 @@ |
+// 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. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ |
+#define CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ |
+ |
+#include <list> |
+#include <memory> |
+ |
+#include "base/macros.h" |
+ |
+namespace base { |
+template <typename T> |
+struct DefaultSingletonTraits; |
+} // namespace base |
+ |
+class AppModalDialogQueueWrapper; |
+class Browser; |
+ |
+// 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.
|
+// own the modal dialog being activated. If there are multiple |
+// BrowserModalDialog, only the browser window owns the oldest dialog will be |
+// activated. Note that this dialog doesn't block other non-browser windows like |
+// app window. |
+class BrowserModalDialog { |
+ public: |
+ BrowserModalDialog(); |
+ 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.
|
+ |
+ virtual ~BrowserModalDialog(); |
+ |
+ // Activate the modal dialog. |
+ 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.
|
+ |
+ // Return true if modal dialog is visible. |
+ virtual bool IsShowing() = 0; |
+}; |
+ |
+// The list of BrowserModalDialog. |
sky
2017/05/17 18:03:18
BrowserModalDialog -> BrowserModalDialogs
zmin
2017/05/18 03:31:17
Done.
|
+class BrowserModalDialogList { |
+ public: |
+ BrowserModalDialogList(); |
sky
2017/05/17 18:03:17
Can the constructor/destructor be private as GetIn
zmin
2017/05/18 03:31:18
Done.
|
+ ~BrowserModalDialogList(); |
+ |
+ static BrowserModalDialogList* GetInstance(); |
+ |
+ // BrowserModalDialogList will not take the ownership of the dialog instance. |
+ void AddDialog(BrowserModalDialog* dialog); |
+ |
+ void RemoveDialog(BrowserModalDialog* dialog); |
+ |
+ // 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.
|
+ // there is no visible dialog. |
+ void ActivateModalDialog(Browser* browser); |
sky
2017/05/17 18:03:18
Document what browser is.
zmin
2017/05/18 03:31:17
Done.
|
+ |
+ // 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.
|
+ bool IsShowing(); |
+ |
+ private: |
+ friend struct base::DefaultSingletonTraits<BrowserModalDialogList>; |
+ |
+ std::list<BrowserModalDialog*> dialogs_; |
+ std::unique_ptr<AppModalDialogQueueWrapper> wrapper_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogList); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_ |