Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: chrome/browser/ui/views/browser_modal_dialog.h

Issue 2862653002: If force-sign-in policy is enabled, popup warning dialog before window closing if auth token becom… (Closed)
Patch Set: refactor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3c37dc8603ba00256994b397abed28f17f73ff32
--- /dev/null
+++ b/chrome/browser/ui/views/browser_modal_dialog.h
@@ -0,0 +1,58 @@
+// 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 "base/macros.h"
+
+namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+} // namespace base
+
+// A browser modal dialog that will prevent the browser windows that does not
+// 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();
+ ~BrowserModalDialog();
+
+ // Activate the modal dialog.
+ virtual void ActivateModalDialog() = 0;
+ // Return true if modal dialog is visible.
+ virtual bool IsShowing() = 0;
+};
+
+// The list of BrowserModalDialog.
+class BrowserModalDialogList {
+ public:
+ static BrowserModalDialogList* GetInstance();
+ 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.
+ void RemoveDialog(BrowserModalDialog* dialog);
+
+ // Activate the oldest BrowserModalDialog and return true. Return false if
+ // there is no visible dialog.
+ bool ActivateModalDialog();
+
+ // Return true if there is any BrowserModalDialog is visible.
+ bool IsShowing();
+
+ BrowserModalDialogList();
sky 2017/05/16 12:40:32 style guide says constructor/destructor before oth
zmin 2017/05/16 22:22:02 Done.
+ ~BrowserModalDialogList();
+
+ private:
+ friend struct base::DefaultSingletonTraits<BrowserModalDialogList>;
+
+ std::list<BrowserModalDialog*> dialogs_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogList);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_BROWSER_MODAL_DIALOG_H_

Powered by Google App Engine
This is Rietveld 408576698