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

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: Address comments. 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
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..3e6bd346d883409b6083e6165c6b2c132fd39ce0 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* host_view = dialog_host->GetHostView();
+ // Get the position of the host view relative to the window since
+ // ModalDialogHost::GetDialogPosition is relative to the host view.
tapted 2015/08/26 07:27:48 nit: GetDialogPosition()
jackhou1 2015/08/27 05:38:09 Done.
+ int host_view_y =
+ NSHeight([[host_view window] frame]) - NSMaxY([host_view frame]);
tapted 2015/08/26 07:27:48 So I think this assumes host_view is the contentVi
jackhou1 2015/08/27 05:38:09 Changed to use -convertPoint to get the host_view'
+ return host_view_y + dialog_host->GetDialogPosition(gfx::Size()).y();
+}
+
void BrowserFrameMac::InitNativeWidget(
const views::Widget::InitParams& params) {
views::NativeWidgetMac::InitNativeWidget(params);

Powered by Google App Engine
This is Rietveld 408576698