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

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

Issue 7880003: content: Move constrained window code from TabContents to TabContentsWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix views merge part 2 Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MAC_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_ 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 10
11 #include "content/browser/tab_contents/constrained_window.h" 11 #include "content/browser/tab_contents/constrained_window.h"
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_nsobject.h" 15 #include "base/memory/scoped_nsobject.h"
16 16
17 @class BrowserWindowController; 17 @class BrowserWindowController;
18 @class GTMWindowSheetController; 18 @class GTMWindowSheetController;
19 @class NSView; 19 @class NSView;
20 @class NSWindow; 20 @class NSWindow;
21 class TabContents; 21 class TabContents;
Avi (use Gerrit) 2011/09/29 18:30:36 forward decl still needed?
22 class TabContentsWrapper;
22 23
23 // Base class for constrained dialog delegates. Never inherit from this 24 // Base class for constrained dialog delegates. Never inherit from this
24 // directly. 25 // directly.
25 class ConstrainedWindowMacDelegate { 26 class ConstrainedWindowMacDelegate {
26 public: 27 public:
27 ConstrainedWindowMacDelegate() : is_sheet_open_(false) {} 28 ConstrainedWindowMacDelegate() : is_sheet_open_(false) {}
28 virtual ~ConstrainedWindowMacDelegate() {} 29 virtual ~ConstrainedWindowMacDelegate() {}
29 30
30 // Tells the delegate to either delete itself or set up a task to delete 31 // Tells the delegate to either delete itself or set up a task to delete
31 // itself later. Note that you MUST close the sheet belonging to your delegate 32 // itself later. Note that you MUST close the sheet belonging to your delegate
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Constrained window implementation for the Mac port. A constrained window 103 // Constrained window implementation for the Mac port. A constrained window
103 // is a per-tab sheet on OS X. 104 // is a per-tab sheet on OS X.
104 // 105 //
105 // Constrained windows work slightly differently on OS X than on the other 106 // Constrained windows work slightly differently on OS X than on the other
106 // platforms: 107 // platforms:
107 // 1. A constrained window is bound to both a tab and window on OS X. 108 // 1. A constrained window is bound to both a tab and window on OS X.
108 // 2. The delegate is responsible for closing the sheet again when it is 109 // 2. The delegate is responsible for closing the sheet again when it is
109 // deleted. 110 // deleted.
110 class ConstrainedWindowMac : public ConstrainedWindow { 111 class ConstrainedWindowMac : public ConstrainedWindow {
111 public: 112 public:
112 ConstrainedWindowMac(TabContents* owner, 113 ConstrainedWindowMac(TabContentsWrapper* wrapper,
113 ConstrainedWindowMacDelegate* delegate); 114 ConstrainedWindowMacDelegate* delegate);
114 virtual ~ConstrainedWindowMac(); 115 virtual ~ConstrainedWindowMac();
115 116
116 // Overridden from ConstrainedWindow: 117 // Overridden from ConstrainedWindow:
117 virtual void ShowConstrainedWindow(); 118 virtual void ShowConstrainedWindow();
118 virtual void CloseConstrainedWindow(); 119 virtual void CloseConstrainedWindow();
119 120
120 // Returns the TabContents that constrains this Constrained Window. 121 // Returns the TabContents that constrains this Constrained Window.
Avi (use Gerrit) 2011/09/29 18:30:36 update comment?
121 TabContents* owner() const { return owner_; } 122 TabContentsWrapper* owner() const { return wrapper_; }
122 123
123 // Returns the window's delegate. 124 // Returns the window's delegate.
124 ConstrainedWindowMacDelegate* delegate() { return delegate_; } 125 ConstrainedWindowMacDelegate* delegate() { return delegate_; }
125 126
126 // Makes the constrained window visible, if it is not yet visible. 127 // Makes the constrained window visible, if it is not yet visible.
127 void Realize(BrowserWindowController* controller); 128 void Realize(BrowserWindowController* controller);
128 129
129 private: 130 private:
130 friend class ConstrainedWindow; 131 friend class ConstrainedWindow;
131 132
132 // The TabContents that owns and constrains this ConstrainedWindow. 133 // The TabContents that owns and constrains this ConstrainedWindow.
Avi (use Gerrit) 2011/09/29 18:30:36 update comment?
133 TabContents* owner_; 134 TabContentsWrapper* wrapper_;
134 135
135 // Delegate that provides the contents of this constrained window. 136 // Delegate that provides the contents of this constrained window.
136 ConstrainedWindowMacDelegate* delegate_; 137 ConstrainedWindowMacDelegate* delegate_;
137 138
138 // Controller of the window that contains this sheet. 139 // Controller of the window that contains this sheet.
139 BrowserWindowController* controller_; 140 BrowserWindowController* controller_;
140 141
141 // Stores if |ShowConstrainedWindow()| was called. 142 // Stores if |ShowConstrainedWindow()| was called.
142 bool should_be_visible_; 143 bool should_be_visible_;
143 144
144 // True when CloseConstrainedWindow has been called. 145 // True when CloseConstrainedWindow has been called.
145 bool closing_; 146 bool closing_;
146 147
147 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); 148 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac);
148 }; 149 };
149 150
150 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_ 151 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698