Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h |
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5fe1f8a1ee3c940a990b8fbc391a664c5d261fb8 |
--- /dev/null |
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONTROLLER_H_ |
+#define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONTROLLER_H_ |
+ |
+#import <Cocoa/Cocoa.h> |
+#include <vector> |
+ |
+#include "base/memory/scoped_vector.h" |
+#include "base/memory/scoped_nsobject.h" |
+ |
+// This class can be used to implement tab modal sheets. Each tab can have |
+// a single sheet and only the active tab's sheet will be visible. |
+@interface ConstrainedWindowSheetController : NSObject <NSAnimationDelegate> { |
+ @private |
+ scoped_nsobject<NSMutableArray> sheets_; |
+ scoped_nsobject<NSWindow> parentWindow_; |
+ scoped_nsobject<NSView> activeView_; |
+} |
+ |
+// Returns a sheet controller for |parentWindow|. If a sheet controller does not |
+// exist yet then one will be created. |
++ (ConstrainedWindowSheetController*) |
+ controllerForParentWindow:(NSWindow*)parentWindow; |
+ |
+// Find a controller that's managing the given sheet. If no such controller |
+// exists then nil is returned. |
++ (ConstrainedWindowSheetController*)controllerForSheet:(NSWindow*)sheet; |
+ |
+// Shows the given sheet over |parentView|. If |parentView| is not the active |
+// view then the sheet is not shown until the |parentView| becomes active. |
+- (void)showSheet:(NSWindow*)sheet |
+ forParentView:(NSView*)parentView; |
+ |
+// Closes the given sheet. If the parent view of the sheet is currently active |
+// then an asynchronous animation will be run and the sheet will be closed |
+// at the end of the animation. |
+- (void)closeSheet:(NSWindow*)sheet; |
+ |
+// Make |parentView| the current active view. If |parentView| has an attached |
+// sheet then the sheet is made visible. |
+- (void)parentViewDidBecomeActive:(NSView*)parentView; |
+ |
+// Gets the number of sheets attached to the controller's window. |
+- (int)sheetCount; |
+ |
+// Testing only API. End any pending animation for the given sheet. |
+- (void)endAnimationForSheet:(NSWindow*)sheet; |
+ |
+@end |
+ |
+#endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONTROLLER_H_ |