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

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

Issue 11419277: Fix showing constrained window for uninitialized tabs (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"
12 14
13 namespace content { 15 namespace content {
14 class WebContents; 16 class WebContents;
15 } 17 }
16 class ConstrainedWindowMac2; 18 class ConstrainedWindowMac2;
17 19
18 // A delegate for a constrained window. The delegate is notified when the 20 // A delegate for a constrained window. The delegate is notified when the
19 // window closes. 21 // window closes.
20 class ConstrainedWindowMacDelegate2 { 22 class ConstrainedWindowMacDelegate2 {
21 public: 23 public:
22 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac2* window) = 0; 24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac2* window) = 0;
23 }; 25 };
24 26
25 // Constrained window implementation for Mac. 27 // Constrained window implementation for Mac.
26 // Normally an instance of this class is owned by the delegate. The delegate 28 // Normally an instance of this class is owned by the delegate. The delegate
27 // should delete the instance when the window is closed. 29 // should delete the instance when the window is closed.
28 class ConstrainedWindowMac2 : public ConstrainedWindow { 30 class ConstrainedWindowMac2 : public ConstrainedWindow,
31 public content::NotificationObserver {
29 public: 32 public:
30 ConstrainedWindowMac2(ConstrainedWindowMacDelegate2* delegate, 33 ConstrainedWindowMac2(ConstrainedWindowMacDelegate2* delegate,
31 content::WebContents* web_contents, 34 content::WebContents* web_contents,
32 NSWindow* window); 35 NSWindow* window);
33 virtual ~ConstrainedWindowMac2(); 36 virtual ~ConstrainedWindowMac2();
34 37
35 // ConstrainedWindow implementation. 38 // ConstrainedWindow implementation.
36 virtual void ShowConstrainedWindow() OVERRIDE; 39 virtual void ShowConstrainedWindow() OVERRIDE;
37 // Closes the constrained window and deletes this instance. 40 // Closes the constrained window and deletes this instance.
38 virtual void CloseConstrainedWindow() OVERRIDE; 41 virtual void CloseConstrainedWindow() OVERRIDE;
39 virtual void PulseConstrainedWindow() OVERRIDE; 42 virtual void PulseConstrainedWindow() OVERRIDE;
40 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 43 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
41 virtual bool CanShowConstrainedWindow() OVERRIDE; 44 virtual bool CanShowConstrainedWindow() OVERRIDE;
42 45
46 // content::NotificationObserver:
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
43 private: 51 private:
44 // Gets the parent window of the dialog. 52 // Gets the parent window of the dialog.
45 NSWindow* GetParentWindow() const; 53 NSWindow* GetParentWindow() const;
46 54
47 ConstrainedWindowMacDelegate2* delegate_; // weak, owns us. 55 ConstrainedWindowMacDelegate2* delegate_; // weak, owns us.
48 56
49 // The WebContents that owns and constrains this ConstrainedWindow. Weak. 57 // The WebContents that owns and constrains this ConstrainedWindow. Weak.
50 content::WebContents* web_contents_; 58 content::WebContents* web_contents_;
51 59
52 scoped_nsobject<NSWindow> window_; 60 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_;
53 }; 67 };
54 68
55 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_2_ 69 #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