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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h

Issue 1446623003: [Reland] Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 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/cocoa/constrained_window/constrained_window_mac.h
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
index e3d981edd473d5ba63b33dffd050956c2b3e3fe3..3b60a39a20e9e2f41aeefbd42ad8dde78a258b39 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
@@ -7,6 +7,9 @@
#import <Cocoa/Cocoa.h>
+#include "base/mac/scoped_nsobject.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
+
namespace content {
class WebContents;
}
@@ -21,6 +24,18 @@ class ConstrainedWindowMacDelegate {
virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0;
};
+// Creates a ConstrainedWindowMac, shows the dialog, and returns it.
+std::unique_ptr<ConstrainedWindowMac> CreateAndShowWebModalDialogMac(
+ ConstrainedWindowMacDelegate* delegate,
+ content::WebContents* web_contents,
+ id<ConstrainedWindowSheet> sheet);
+
+// Creates a ConstrainedWindowMac and returns it.
+std::unique_ptr<ConstrainedWindowMac> CreateWebModalDialogMac(
+ ConstrainedWindowMacDelegate* delegate,
+ content::WebContents* web_contents,
+ id<ConstrainedWindowSheet> sheet);
+
// Constrained window implementation for Mac.
// Normally an instance of this class is owned by the delegate. The delegate
// should delete the instance when the window is closed.
@@ -31,6 +46,9 @@ class ConstrainedWindowMac {
id<ConstrainedWindowSheet> sheet);
~ConstrainedWindowMac();
+ // Shows the constrained window.
+ void ShowWebContentsModalDialog();
+
// Closes the constrained window.
void CloseWebContentsModalDialog();
@@ -38,13 +56,24 @@ class ConstrainedWindowMac {
void set_manager(SingleWebContentsDialogManagerCocoa* manager) {
manager_ = manager;
}
+ id<ConstrainedWindowSheet> sheet() const { return sheet_.get(); }
// Called by |manager_| when the dialog is closing.
void OnDialogClosing();
+ // Whether or not the dialog was shown. If the dialog is auto-resizable, it
+ // is hidden until its WebContents initially loads.
+ bool DialogWasShown();
+
+ // Gets the dialog manager for |web_contents_|.
+ web_modal::WebContentsModalDialogManager* GetDialogManager();
+
private:
ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM.
+ content::WebContents* web_contents_; // weak, owned by dialog initiator.
+ base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_;
+ scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager_;
};
#endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_

Powered by Google App Engine
This is Rietveld 408576698