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

Unified Diff: chrome/browser/ui/views/frame/browser_frame_mac.mm

Issue 1315043003: [MacViews] Position modal sheets using ModalDialogHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bbobserver
Patch Set: Missded a comment nit. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_mac.h ('k') | ui/views/cocoa/views_nswindow_delegate.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_frame_mac.mm
diff --git a/chrome/browser/ui/views/frame/browser_frame_mac.mm b/chrome/browser/ui/views/frame/browser_frame_mac.mm
index 2d9aa266b431e81973ffbcc22024616e104a8b70..5285ebbdda4c21b849e6b9a7809e1103143ddf62 100644
--- a/chrome/browser/ui/views/frame/browser_frame_mac.mm
+++ b/chrome/browser/ui/views/frame/browser_frame_mac.mm
@@ -8,6 +8,7 @@
#include "chrome/browser/ui/views/frame/browser_shutdown.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#import "chrome/browser/ui/views/frame/native_widget_mac_frameless_nswindow.h"
+#include "components/web_modal/web_contents_modal_dialog_host.h"
#import "ui/base/cocoa/window_size_constants.h"
BrowserFrameMac::BrowserFrameMac(BrowserFrame* browser_frame,
@@ -29,6 +30,17 @@ void BrowserFrameMac::OnWindowWillClose() {
NativeWidgetMac::OnWindowWillClose();
}
+int BrowserFrameMac::SheetPositionY() {
+ web_modal::WebContentsModalDialogHost* dialog_host =
+ browser_view_->GetWebContentsModalDialogHost();
+ NSView* view = dialog_host->GetHostView();
+ // Get the position of the host view relative to the window since
+ // ModalDialogHost::GetDialogPosition() is relative to the host view.
+ int host_view_y =
+ [view convertPoint:NSMakePoint(0, NSHeight([view frame])) toView:nil].y;
+ return host_view_y - dialog_host->GetDialogPosition(gfx::Size()).y();
+}
+
void BrowserFrameMac::InitNativeWidget(
const views::Widget::InitParams& params) {
views::NativeWidgetMac::InitNativeWidget(params);
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_mac.h ('k') | ui/views/cocoa/views_nswindow_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698