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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h

Issue 1674063002: Revert of [Reland] Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h"
11 #include "components/web_modal/web_contents_modal_dialog_manager.h"
12
13 namespace content { 10 namespace content {
14 class WebContents; 11 class WebContents;
15 } 12 }
16 class ConstrainedWindowMac; 13 class ConstrainedWindowMac;
17 class SingleWebContentsDialogManagerCocoa; 14 class SingleWebContentsDialogManagerCocoa;
18 @protocol ConstrainedWindowSheet; 15 @protocol ConstrainedWindowSheet;
19 16
20 // A delegate for a constrained window. The delegate is notified when the 17 // A delegate for a constrained window. The delegate is notified when the
21 // window closes. 18 // window closes.
22 class ConstrainedWindowMacDelegate { 19 class ConstrainedWindowMacDelegate {
23 public: 20 public:
24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; 21 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0;
25 }; 22 };
26 23
27 // Creates a ConstrainedWindowMac, shows the dialog, and returns it.
28 std::unique_ptr<ConstrainedWindowMac> CreateAndShowWebModalDialogMac(
29 ConstrainedWindowMacDelegate* delegate,
30 content::WebContents* web_contents,
31 id<ConstrainedWindowSheet> sheet);
32
33 // Creates a ConstrainedWindowMac and returns it.
34 std::unique_ptr<ConstrainedWindowMac> CreateWebModalDialogMac(
35 ConstrainedWindowMacDelegate* delegate,
36 content::WebContents* web_contents,
37 id<ConstrainedWindowSheet> sheet);
38
39 // Constrained window implementation for Mac. 24 // Constrained window implementation for Mac.
40 // Normally an instance of this class is owned by the delegate. The delegate 25 // Normally an instance of this class is owned by the delegate. The delegate
41 // should delete the instance when the window is closed. 26 // should delete the instance when the window is closed.
42 class ConstrainedWindowMac { 27 class ConstrainedWindowMac {
43 public: 28 public:
44 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate, 29 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate,
45 content::WebContents* web_contents, 30 content::WebContents* web_contents,
46 id<ConstrainedWindowSheet> sheet); 31 id<ConstrainedWindowSheet> sheet);
47 ~ConstrainedWindowMac(); 32 ~ConstrainedWindowMac();
48 33
49 // Shows the constrained window.
50 void ShowWebContentsModalDialog();
51
52 // Closes the constrained window. 34 // Closes the constrained window.
53 void CloseWebContentsModalDialog(); 35 void CloseWebContentsModalDialog();
54 36
55 SingleWebContentsDialogManagerCocoa* manager() const { return manager_; } 37 SingleWebContentsDialogManagerCocoa* manager() const { return manager_; }
56 void set_manager(SingleWebContentsDialogManagerCocoa* manager) { 38 void set_manager(SingleWebContentsDialogManagerCocoa* manager) {
57 manager_ = manager; 39 manager_ = manager;
58 } 40 }
59 id<ConstrainedWindowSheet> sheet() const { return sheet_.get(); }
60 41
61 // Called by |manager_| when the dialog is closing. 42 // Called by |manager_| when the dialog is closing.
62 void OnDialogClosing(); 43 void OnDialogClosing();
63 44
64 // Whether or not the dialog was shown. If the dialog is auto-resizable, it
65 // is hidden until its WebContents initially loads.
66 bool DialogWasShown();
67
68 // Gets the dialog manager for |web_contents_|.
69 web_modal::WebContentsModalDialogManager* GetDialogManager();
70
71 private: 45 private:
72 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. 46 ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
73 SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM. 47 SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM.
74 content::WebContents* web_contents_; // weak, owned by dialog initiator.
75 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_;
76 scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager_;
77 }; 48 };
78 49
79 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ 50 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698