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

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

Issue 10871082: Constrained Windows Cocoa: Part 4 Refactor ConstrainedWindowSupport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // deleted. 117 // deleted.
126 class ConstrainedWindowMac : public ConstrainedWindow { 118 class ConstrainedWindowMac : public ConstrainedWindow {
127 public: 119 public:
128 ConstrainedWindowMac(TabContents* tab_contents, 120 ConstrainedWindowMac(TabContents* tab_contents,
129 ConstrainedWindowMacDelegate* delegate); 121 ConstrainedWindowMacDelegate* delegate);
130 virtual ~ConstrainedWindowMac(); 122 virtual ~ConstrainedWindowMac();
131 123
132 // Overridden from ConstrainedWindow: 124 // Overridden from ConstrainedWindow:
133 virtual void ShowConstrainedWindow() OVERRIDE; 125 virtual void ShowConstrainedWindow() OVERRIDE;
134 virtual void CloseConstrainedWindow() OVERRIDE; 126 virtual void CloseConstrainedWindow() OVERRIDE;
127 virtual bool CanShowConstrainedWindow() OVERRIDE;
135 128
136 // Returns the TabContents that constrains this Constrained Window. 129 // Returns the TabContents that constrains this Constrained Window.
137 TabContents* owner() const { return tab_contents_; } 130 TabContents* owner() const { return tab_contents_; }
138 131
139 // Returns the window's delegate. 132 // Returns the window's delegate.
140 ConstrainedWindowMacDelegate* delegate() { return delegate_; } 133 ConstrainedWindowMacDelegate* delegate() { return delegate_; }
141 134
142 // Makes the constrained window visible, if it is not yet visible. 135 // Makes the constrained window visible, if it is not yet visible.
143 void Realize(NSWindowController<ConstrainedWindowSupport>* controller); 136 void Realize(NSWindowController<ConstrainedWindowSupport>* controller);
144 137
(...skipping 12 matching lines...) Expand all
157 // Stores if |ShowConstrainedWindow()| was called. 150 // Stores if |ShowConstrainedWindow()| was called.
158 bool should_be_visible_; 151 bool should_be_visible_;
159 152
160 // True when CloseConstrainedWindow has been called. 153 // True when CloseConstrainedWindow has been called.
161 bool closing_; 154 bool closing_;
162 155
163 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); 156 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac);
164 }; 157 };
165 158
166 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_ 159 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.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