OLD | NEW |
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_SHEET_CONT
ROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONT
ROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONT
ROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONT
ROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // This class manages multiple tab modal sheets for a single parent window. Each | 22 // This class manages multiple tab modal sheets for a single parent window. Each |
23 // tab can have a single sheet and only the active tab's sheet will be visible. | 23 // tab can have a single sheet and only the active tab's sheet will be visible. |
24 // A tab in this case is the |parentView| passed to |-showSheet:forParentView:|. | 24 // A tab in this case is the |parentView| passed to |-showSheet:forParentView:|. |
25 @interface ConstrainedWindowSheetController : NSObject { | 25 @interface ConstrainedWindowSheetController : NSObject { |
26 @private | 26 @private |
27 base::scoped_nsobject<NSMutableArray> sheets_; | 27 base::scoped_nsobject<NSMutableArray> sheets_; |
28 base::scoped_nsobject<NSWindow> parentWindow_; | 28 base::scoped_nsobject<NSWindow> parentWindow_; |
29 base::scoped_nsobject<NSView> activeView_; | 29 base::scoped_nsobject<NSView> activeView_; |
30 | 30 |
| 31 // Flag to prevent the sheet from updating its position if it's hidden during |
| 32 // fullscreen. Otherwise, we will get janky movements during the animation. |
| 33 BOOL isSheetHiddenForFullscreen_; |
| 34 |
31 // Class that bridges the cross-platform web_modal APIs to the Cocoa sheet | 35 // Class that bridges the cross-platform web_modal APIs to the Cocoa sheet |
32 // controller. | 36 // controller. |
33 scoped_ptr<WebContentsModalDialogHostCocoa> dialogHost_; | 37 scoped_ptr<WebContentsModalDialogHostCocoa> dialogHost_; |
34 } | 38 } |
35 | 39 |
36 @property(readonly, nonatomic) | 40 @property(readonly, nonatomic) |
37 web_modal::WebContentsModalDialogHost* dialogHost; | 41 web_modal::WebContentsModalDialogHost* dialogHost; |
38 @property(readonly, nonatomic) NSWindow* parentWindow; | 42 @property(readonly, nonatomic) NSWindow* parentWindow; |
39 | 43 |
40 // Returns a sheet controller for |parentWindow|. If a sheet controller does not | 44 // Returns a sheet controller for |parentWindow|. If a sheet controller does not |
41 // exist yet then one will be created. | 45 // exist yet then one will be created. |
42 + (ConstrainedWindowSheetController*) | 46 + (ConstrainedWindowSheetController*) |
43 controllerForParentWindow:(NSWindow*)parentWindow; | 47 controllerForParentWindow:(NSWindow*)parentWindow; |
44 | 48 |
45 // Find a controller that's managing the given sheet. If no such controller | 49 // Find a controller that's managing the given sheet. If no such controller |
46 // exists then nil is returned. | 50 // exists then nil is returned. |
47 + (ConstrainedWindowSheetController*) | 51 + (ConstrainedWindowSheetController*) |
48 controllerForSheet:(id<ConstrainedWindowSheet>)sheet; | 52 controllerForSheet:(id<ConstrainedWindowSheet>)sheet; |
49 | 53 |
50 // Find the sheet attached to the given overlay window. | 54 // Find the sheet attached to the given overlay window. |
51 + (id<ConstrainedWindowSheet>)sheetForOverlayWindow:(NSWindow*)overlayWindow; | 55 + (id<ConstrainedWindowSheet>)sheetForOverlayWindow:(NSWindow*)overlayWindow; |
52 | 56 |
53 // Shows the given sheet over |parentView|. | 57 // Shows the given sheet over |parentView|. |
54 - (void)showSheet:(id<ConstrainedWindowSheet>)sheet | 58 - (void)showSheet:(id<ConstrainedWindowSheet>)sheet |
55 forParentView:(NSView*)parentView; | 59 forParentView:(NSView*)parentView; |
56 | 60 |
57 // Hides a sheet over the active view. | 61 // Hides a sheet over the active view. |
58 - (void)hideSheet; | 62 - (void)hideSheet; |
59 | 63 |
| 64 // Hides and unhides the sheet at the beginning and end of fullscreen |
| 65 // transition. |hideSheetForFullscreenTransition| gets called at the beginning |
| 66 // of the transition and |unhideSheetForFullscreenTransition| gets called at |
| 67 // the end. |
| 68 - (void)hideSheetForFullscreenTransition; |
| 69 - (void)unhideSheetForFullscreenTransition; |
| 70 |
60 // Calculates the position of the sheet for the given window size. | 71 // Calculates the position of the sheet for the given window size. |
61 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet | 72 - (NSPoint)originForSheet:(id<ConstrainedWindowSheet>)sheet |
62 withWindowSize:(NSSize)size; | 73 withWindowSize:(NSSize)size; |
63 | 74 |
64 // Closes the given sheet. | 75 // Closes the given sheet. |
65 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet; | 76 - (void)closeSheet:(id<ConstrainedWindowSheet>)sheet; |
66 | 77 |
67 // Run a pulse animation for the given sheet. This does nothing if the sheet | 78 // Run a pulse animation for the given sheet. This does nothing if the sheet |
68 // is not visible. | 79 // is not visible. |
69 - (void)pulseSheet:(id<ConstrainedWindowSheet>)sheet; | 80 - (void)pulseSheet:(id<ConstrainedWindowSheet>)sheet; |
70 | 81 |
71 // Gets the number of sheets attached to the controller's window. | 82 // Gets the number of sheets attached to the controller's window. |
72 - (int)sheetCount; | 83 - (int)sheetCount; |
73 | 84 |
74 // The size of the overlay window, which can be used to determine a preferred | 85 // The size of the overlay window, which can be used to determine a preferred |
75 // maximum size for a dialog that should be contained within |parentView|. | 86 // maximum size for a dialog that should be contained within |parentView|. |
76 - (NSSize)overlayWindowSizeForParentView:(NSView*)parentView; | 87 - (NSSize)overlayWindowSizeForParentView:(NSView*)parentView; |
77 | 88 |
78 @end | 89 @end |
79 | 90 |
80 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_C
ONTROLLER_H_ | 91 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_C
ONTROLLER_H_ |
OLD | NEW |