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

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

Issue 11418304: Revert 170795 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_2_ 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_ 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_
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/constrained_window.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 12
15 namespace content { 13 namespace content {
16 class WebContents; 14 class WebContents;
17 } 15 }
18 class ConstrainedWindowMac2; 16 class ConstrainedWindowMac2;
19 17
20 // 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
21 // window closes. 19 // window closes.
22 class ConstrainedWindowMacDelegate2 { 20 class ConstrainedWindowMacDelegate2 {
23 public: 21 public:
24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac2* window) = 0; 22 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac2* window) = 0;
25 }; 23 };
26 24
27 // Constrained window implementation for Mac. 25 // Constrained window implementation for Mac.
28 // 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
29 // should delete the instance when the window is closed. 27 // should delete the instance when the window is closed.
30 class ConstrainedWindowMac2 : public ConstrainedWindow, 28 class ConstrainedWindowMac2 : public ConstrainedWindow {
31 public content::NotificationObserver {
32 public: 29 public:
33 ConstrainedWindowMac2(ConstrainedWindowMacDelegate2* delegate, 30 ConstrainedWindowMac2(ConstrainedWindowMacDelegate2* delegate,
34 content::WebContents* web_contents, 31 content::WebContents* web_contents,
35 NSWindow* window); 32 NSWindow* window);
36 virtual ~ConstrainedWindowMac2(); 33 virtual ~ConstrainedWindowMac2();
37 34
38 // ConstrainedWindow implementation. 35 // ConstrainedWindow implementation.
39 virtual void ShowConstrainedWindow() OVERRIDE; 36 virtual void ShowConstrainedWindow() OVERRIDE;
40 // Closes the constrained window and deletes this instance. 37 // Closes the constrained window and deletes this instance.
41 virtual void CloseConstrainedWindow() OVERRIDE; 38 virtual void CloseConstrainedWindow() OVERRIDE;
42 virtual void PulseConstrainedWindow() OVERRIDE; 39 virtual void PulseConstrainedWindow() OVERRIDE;
43 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 40 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
44 virtual bool CanShowConstrainedWindow() OVERRIDE; 41 virtual bool CanShowConstrainedWindow() OVERRIDE;
45 42
46 // content::NotificationObserver:
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
51 private: 43 private:
52 // Gets the parent window of the dialog. 44 // Gets the parent window of the dialog.
53 NSWindow* GetParentWindow() const; 45 NSWindow* GetParentWindow() const;
54 46
55 ConstrainedWindowMacDelegate2* delegate_; // weak, owns us. 47 ConstrainedWindowMacDelegate2* delegate_; // weak, owns us.
56 48
57 // The WebContents that owns and constrains this ConstrainedWindow. Weak. 49 // The WebContents that owns and constrains this ConstrainedWindow. Weak.
58 content::WebContents* web_contents_; 50 content::WebContents* web_contents_;
59 51
60 scoped_nsobject<NSWindow> window_; 52 scoped_nsobject<NSWindow> window_;
61
62 // A scoped container for notification registries.
63 content::NotificationRegistrar registrar_;
64
65 // This is true if the constrained window is waiting to be shown.
66 bool pending_show_;
67 }; 53 };
68 54
69 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_ 55 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698