Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm |
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm |
index c408dcfd0c064ae86bede07e33947f3e5c066873..9375daa5b8af5f1c90ff7df3fc44c2b18a884877 100644 |
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm |
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm |
@@ -9,7 +9,6 @@ |
#include "base/logging.h" |
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" |
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_info.h" |
-#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
namespace { |
@@ -21,6 +20,19 @@ NSValue* GetKeyForParentWindow(NSWindow* parent_window) { |
return [NSValue valueWithNonretainedObject:parent_window]; |
} |
+// Returns the bounds to use when showing a sheet for a given parent view. This |
+// returns a rect in window coordinates. |
+NSRect GetSheetParentBoundsForParentView(NSView* view) { |
+ // If the devtools view is open, it shrinks the size of the WebContents, so go |
+ // up the hierarchy to the devtools container view to avoid that. Note that |
+ // the devtools view is always in the hierarchy even if it is not open or it |
+ // is detached. |
+ NSView* devtools_view = [[[view superview] superview] superview]; |
+ if (devtools_view) |
+ view = devtools_view; |
+ return [view convertRect:[view bounds] toView:nil]; |
+} |
+ |
} // namespace |
// An invisible overlay window placed on top of the sheet's parent view. |