| 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..cb172f51c4d7035a3bd5486318b8513f8c801282
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/browser_modal_dialog.h
|
| @@ -0,0 +1,66 @@
|
| +// 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;
|
| +
|
| +// BrowserModalDialog prevents all browser windows from being actived. If there
|
| +// are multiple BrowserModalDialog, only the browser window owns the oldest
|
| +// dialog will get focus. Note that this dialog doesn't block other
|
| +// non-browser windows like app window.
|
| +class BrowserModalDialog {
|
| + public:
|
| + BrowserModalDialog();
|
| + virtual ~BrowserModalDialog();
|
| +
|
| + // Activates the modal dialog when the window of |browser| tries to get focus.
|
| + virtual void ActivateModalDialog(Browser* browser) = 0;
|
| +
|
| + // Returns true if modal dialog is visible.
|
| + virtual bool IsShowing() = 0;
|
| +};
|
| +
|
| +// The list of BrowserModalDialogs.
|
| +class BrowserModalDialogList {
|
| + public:
|
| + static BrowserModalDialogList* GetInstance();
|
| +
|
| + // BrowserModalDialogList will not take the ownership of the dialog instance.
|
| + void AddDialog(BrowserModalDialog* dialog);
|
| +
|
| + void RemoveDialog(BrowserModalDialog* dialog);
|
| +
|
| + // Activates the oldest BrowserModalDialog when the window of |browser| tries
|
| + // to get focus.
|
| + void ActivateModalDialog(Browser* browser);
|
| +
|
| + // Returns true if any BrowserModalDialogs are visible.
|
| + bool IsShowing();
|
| +
|
| + private:
|
| + friend struct base::DefaultSingletonTraits<BrowserModalDialogList>;
|
| +
|
| + BrowserModalDialogList();
|
| + ~BrowserModalDialogList();
|
| +
|
| + std::list<BrowserModalDialog*> dialogs_;
|
| + std::unique_ptr<AppModalDialogQueueWrapper> wrapper_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogList);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_
|
|
|