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

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

Issue 866263008: MacViews: Unify web contents modal dialog types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ValidationMessageBubble
Patch Set: Fixes for tapted Created 5 years, 9 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" 10 #import "chrome/browser/ui/cocoa/modal_dialog_client_cocoa.h"
11 #include "components/web_modal/native_web_contents_modal_dialog.h"
12 11
13 namespace content { 12 namespace content {
14 class WebContents; 13 class WebContents;
15 } 14 }
16 class ConstrainedWindowMac; 15 class ConstrainedWindowMac;
17 @protocol ConstrainedWindowSheet; 16 @protocol ConstrainedWindowSheet;
18 17
19 // A delegate for a constrained window. The delegate is notified when the 18 // A delegate for a constrained window. The delegate is notified when the
20 // window closes. 19 // window closes.
21 class ConstrainedWindowMacDelegate { 20 class ConstrainedWindowMacDelegate {
22 public: 21 public:
23 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; 22 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0;
24 }; 23 };
25 24
26 // Constrained window implementation for Mac. 25 // Constrained window implementation for Mac.
27 // Normally an instance of this class is owned by the delegate. The delegate 26 // Normally an instance of this class is owned by the delegate. The delegate
28 // should delete the instance when the window is closed. 27 // should delete the instance when the window is closed.
29 class ConstrainedWindowMac { 28 class ConstrainedWindowMac : public ModalDialogClientCocoa {
30 public: 29 public:
31 ConstrainedWindowMac( 30 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate,
32 ConstrainedWindowMacDelegate* delegate, 31 content::WebContents* web_contents,
33 content::WebContents* web_contents, 32 id<ConstrainedWindowSheet> sheet);
34 id<ConstrainedWindowSheet> sheet); 33 ~ConstrainedWindowMac() override;
35 virtual ~ConstrainedWindowMac();
36 34
37 void ShowWebContentsModalDialog(); 35 // Closes the constrained window.
38 // Closes the constrained window and deletes this instance.
39 void CloseWebContentsModalDialog(); 36 void CloseWebContentsModalDialog();
40 void FocusWebContentsModalDialog(); 37
41 void PulseWebContentsModalDialog(); 38 // ModalDialogClientCocoa overrides.
42 web_modal::NativeWebContentsModalDialog GetNativeDialog(); 39 void OnDialogClosing() override;
43 40
44 private: 41 private:
45 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. 42 ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
46
47 // The WebContents that owns and constrains this ConstrainedWindowMac. Weak.
48 content::WebContents* web_contents_;
49
50 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_;
51
52 // This is true if the constrained window has been shown.
53 bool shown_;
54 }; 43 };
55 44
56 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ 45 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698