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

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

Issue 11633052: Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use gtk_widget_get_toplevel for GetNativeWindow Created 7 years, 11 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 | Annotate | Revision Log
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/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
11 #include "chrome/browser/ui/constrained_window.h" 11 #include "chrome/browser/ui/web_contents_modal_dialog.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 14
15 namespace content { 15 namespace content {
16 class WebContents; 16 class WebContents;
17 } 17 }
18 class ConstrainedWindowMac; 18 class ConstrainedWindowMac;
19 @protocol ConstrainedWindowSheet; 19 @protocol ConstrainedWindowSheet;
20 20
21 // A delegate for a constrained window. The delegate is notified when the 21 // A delegate for a constrained window. The delegate is notified when the
22 // window closes. 22 // window closes.
23 class ConstrainedWindowMacDelegate { 23 class ConstrainedWindowMacDelegate {
24 public: 24 public:
25 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; 25 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0;
26 }; 26 };
27 27
28 // Constrained window implementation for Mac. 28 // Constrained window implementation for Mac.
29 // Normally an instance of this class is owned by the delegate. The delegate 29 // Normally an instance of this class is owned by the delegate. The delegate
30 // should delete the instance when the window is closed. 30 // should delete the instance when the window is closed.
31 class ConstrainedWindowMac : public ConstrainedWindow, 31 class ConstrainedWindowMac : public WebContentsModalDialog,
32 public content::NotificationObserver { 32 public content::NotificationObserver {
33 public: 33 public:
34 ConstrainedWindowMac( 34 ConstrainedWindowMac(
35 ConstrainedWindowMacDelegate* delegate, 35 ConstrainedWindowMacDelegate* delegate,
36 content::WebContents* web_contents, 36 content::WebContents* web_contents,
37 id<ConstrainedWindowSheet> sheet); 37 id<ConstrainedWindowSheet> sheet);
38 virtual ~ConstrainedWindowMac(); 38 virtual ~ConstrainedWindowMac();
39 39
40 // ConstrainedWindow implementation. 40 // WebContentsModalDialog implementation.
41 virtual void ShowWebContentsModalDialog() OVERRIDE; 41 virtual void ShowWebContentsModalDialog() OVERRIDE;
42 // Closes the constrained window and deletes this instance. 42 // Closes the constrained window and deletes this instance.
43 virtual void CloseWebContentsModalDialog() OVERRIDE; 43 virtual void CloseWebContentsModalDialog() OVERRIDE;
44 virtual void FocusWebContentsModalDialog() OVERRIDE;
44 virtual void PulseWebContentsModalDialog() OVERRIDE; 45 virtual void PulseWebContentsModalDialog() OVERRIDE;
45 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 46 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
46 virtual bool CanShowWebContentsModalDialog() OVERRIDE; 47 virtual bool CanShowWebContentsModalDialog() OVERRIDE;
47 48
48 // content::NotificationObserver: 49 // content::NotificationObserver:
49 virtual void Observe(int type, 50 virtual void Observe(int type,
50 const content::NotificationSource& source, 51 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE; 52 const content::NotificationDetails& details) OVERRIDE;
52 53
53 private: 54 private:
54 // Gets the parent window of the dialog. 55 // Gets the parent window of the dialog.
55 NSWindow* GetParentWindow() const; 56 NSWindow* GetParentWindow() const;
56 57
57 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. 58 ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
58 59
59 // The WebContents that owns and constrains this ConstrainedWindow. Weak. 60 // The WebContents that owns and constrains this WebContentsModalDialog. Weak.
60 content::WebContents* web_contents_; 61 content::WebContents* web_contents_;
61 62
62 scoped_nsprotocol<id<ConstrainedWindowSheet> > sheet_; 63 scoped_nsprotocol<id<ConstrainedWindowSheet> > sheet_;
63 64
64 // A scoped container for notification registries. 65 // A scoped container for notification registries.
65 content::NotificationRegistrar registrar_; 66 content::NotificationRegistrar registrar_;
66 67
67 // This is true if the constrained window is waiting to be shown. 68 // This is true if the constrained window is waiting to be shown.
68 bool pending_show_; 69 bool pending_show_;
69 }; 70 };
70 71
71 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ 72 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698