| 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 |
| 10 #include <memory> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 | 14 |
| 14 namespace web_modal { | 15 namespace web_modal { |
| 15 class WebContentsModalDialogHost; | 16 class WebContentsModalDialogHost; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class WebContentsModalDialogHostCocoa; | 19 class WebContentsModalDialogHostCocoa; |
| 19 | 20 |
| 20 @protocol ConstrainedWindowSheet; | 21 @protocol ConstrainedWindowSheet; |
| 21 | 22 |
| 22 // This class manages multiple tab modal sheets for a single parent window. Each | 23 // 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. | 24 // 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:|. | 25 // A tab in this case is the |parentView| passed to |-showSheet:forParentView:|. |
| 25 @interface ConstrainedWindowSheetController : NSObject { | 26 @interface ConstrainedWindowSheetController : NSObject { |
| 26 @private | 27 @private |
| 27 base::scoped_nsobject<NSMutableArray> sheets_; | 28 base::scoped_nsobject<NSMutableArray> sheets_; |
| 28 base::scoped_nsobject<NSWindow> parentWindow_; | 29 base::scoped_nsobject<NSWindow> parentWindow_; |
| 29 base::scoped_nsobject<NSView> activeView_; | 30 base::scoped_nsobject<NSView> activeView_; |
| 30 | 31 |
| 31 // Flag to prevent the sheet from updating its position if it's hidden during | 32 // 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 // fullscreen. Otherwise, we will get janky movements during the animation. |
| 33 BOOL isSheetHiddenForFullscreen_; | 34 BOOL isSheetHiddenForFullscreen_; |
| 34 | 35 |
| 35 // Class that bridges the cross-platform web_modal APIs to the Cocoa sheet | 36 // Class that bridges the cross-platform web_modal APIs to the Cocoa sheet |
| 36 // controller. | 37 // controller. |
| 37 scoped_ptr<WebContentsModalDialogHostCocoa> dialogHost_; | 38 std::unique_ptr<WebContentsModalDialogHostCocoa> dialogHost_; |
| 38 } | 39 } |
| 39 | 40 |
| 40 @property(readonly, nonatomic) | 41 @property(readonly, nonatomic) |
| 41 web_modal::WebContentsModalDialogHost* dialogHost; | 42 web_modal::WebContentsModalDialogHost* dialogHost; |
| 42 @property(readonly, nonatomic) NSWindow* parentWindow; | 43 @property(readonly, nonatomic) NSWindow* parentWindow; |
| 43 | 44 |
| 44 // Returns a sheet controller for |parentWindow|. If a sheet controller does not | 45 // Returns a sheet controller for |parentWindow|. If a sheet controller does not |
| 45 // exist yet then one will be created. | 46 // exist yet then one will be created. |
| 46 + (ConstrainedWindowSheetController*) | 47 + (ConstrainedWindowSheetController*) |
| 47 controllerForParentWindow:(NSWindow*)parentWindow; | 48 controllerForParentWindow:(NSWindow*)parentWindow; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Gets the number of sheets attached to the controller's window. | 83 // Gets the number of sheets attached to the controller's window. |
| 83 - (int)sheetCount; | 84 - (int)sheetCount; |
| 84 | 85 |
| 85 // The size of the overlay window, which can be used to determine a preferred | 86 // The size of the overlay window, which can be used to determine a preferred |
| 86 // maximum size for a dialog that should be contained within |parentView|. | 87 // maximum size for a dialog that should be contained within |parentView|. |
| 87 - (NSSize)overlayWindowSizeForParentView:(NSView*)parentView; | 88 - (NSSize)overlayWindowSizeForParentView:(NSView*)parentView; |
| 88 | 89 |
| 89 @end | 90 @end |
| 90 | 91 |
| 91 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_C
ONTROLLER_H_ | 92 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_C
ONTROLLER_H_ |
| OLD | NEW |