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

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

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 3 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_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 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
13 #include "chrome/browser/ui/constrained_window.h" 13 #include "chrome/browser/ui/constrained_window.h"
14 14
15 class ConstrainedWindowMac; 15 class ConstrainedWindowMac;
16 @class GTMWindowSheetController; 16 @class GTMWindowSheetController;
17 @class NSView; 17 @class NSView;
18 @class NSWindow; 18 @class NSWindow;
19 class TabContents; 19 class TabContents;
20 20
21 // Window controllers that allow hosting constrained windows should 21 // Window controllers that allow hosting constrained windows should
22 // implement this protocol. 22 // implement this protocol.
23 @protocol ConstrainedWindowSupport 23 @protocol ConstrainedWindowSupport
24 24
25 // Requests that |window| is opened as a per-tab sheet to the current tab. 25 - (GTMWindowSheetController*)sheetController;
26 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window;
27
28 // Closes the tab sheet |window| and potentially shows the next sheet in the
29 // tab's sheet queue.
30 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window;
31
32 // Returns NO if constrained windows cannot be attached to this window.
33 - (BOOL)canAttachConstrainedWindow;
34 26
35 @end 27 @end
36 28
37 // Base class for constrained dialog delegates. Never inherit from this 29 // Base class for constrained dialog delegates. Never inherit from this
38 // directly. 30 // directly.
39 class ConstrainedWindowMacDelegate { 31 class ConstrainedWindowMacDelegate {
40 public: 32 public:
41 ConstrainedWindowMacDelegate() : is_sheet_open_(false) {} 33 ConstrainedWindowMacDelegate() : is_sheet_open_(false) {}
42 virtual ~ConstrainedWindowMacDelegate() {} 34 virtual ~ConstrainedWindowMacDelegate() {}
43 35
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 130
139 // Returns the window's delegate. 131 // Returns the window's delegate.
140 ConstrainedWindowMacDelegate* delegate() { return delegate_; } 132 ConstrainedWindowMacDelegate* delegate() { return delegate_; }
141 133
142 // Makes the constrained window visible, if it is not yet visible. 134 // Makes the constrained window visible, if it is not yet visible.
143 void Realize(NSWindowController<ConstrainedWindowSupport>* controller); 135 void Realize(NSWindowController<ConstrainedWindowSupport>* controller);
144 136
145 private: 137 private:
146 friend class ConstrainedWindow; 138 friend class ConstrainedWindow;
147 139
140 bool GetCanShow() const;
141
148 // The TabContents that owns and constrains this ConstrainedWindow. 142 // The TabContents that owns and constrains this ConstrainedWindow.
149 TabContents* tab_contents_; 143 TabContents* tab_contents_;
150 144
151 // Delegate that provides the contents of this constrained window. 145 // Delegate that provides the contents of this constrained window.
152 ConstrainedWindowMacDelegate* delegate_; 146 ConstrainedWindowMacDelegate* delegate_;
153 147
154 // Controller of the window that contains this sheet. 148 // Controller of the window that contains this sheet.
155 NSWindowController<ConstrainedWindowSupport>* controller_; 149 NSWindowController<ConstrainedWindowSupport>* controller_;
156 150
157 // Stores if |ShowConstrainedWindow()| was called. 151 // Stores if |ShowConstrainedWindow()| was called.
158 bool should_be_visible_; 152 bool should_be_visible_;
159 153
160 // True when CloseConstrainedWindow has been called. 154 // True when CloseConstrainedWindow has been called.
161 bool closing_; 155 bool closing_;
162 156
163 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); 157 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac);
164 }; 158 };
165 159
166 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_ 160 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/constrained_window/cw_window_unittest.mm ('k') | chrome/browser/ui/cocoa/constrained_window_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698