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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm

Issue 817273003: [Mac] Make ConstrainedWebDialog resize with parent window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialo g_sheet.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/web_dialogs/web_dialog_delegate.h" 15 #include "ui/web_dialogs/web_dialog_delegate.h"
16 #include "ui/web_dialogs/web_dialog_ui.h" 16 #include "ui/web_dialogs/web_dialog_ui.h"
17 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 17 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
18 18
19 using content::WebContents; 19 using content::WebContents;
20 using ui::WebDialogDelegate; 20 using ui::WebDialogDelegate;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 content::WebContents* web_contents) 110 content::WebContents* web_contents)
111 : impl_(new ConstrainedWebDialogDelegateMac(browser_context, delegate)) { 111 : impl_(new ConstrainedWebDialogDelegateMac(browser_context, delegate)) {
112 // Create a window to hold web_contents in the constrained sheet: 112 // Create a window to hold web_contents in the constrained sheet:
113 gfx::Size size; 113 gfx::Size size;
114 delegate->GetDialogSize(&size); 114 delegate->GetDialogSize(&size);
115 NSRect frame = NSMakeRect(0, 0, size.width(), size.height()); 115 NSRect frame = NSMakeRect(0, 0, size.width(), size.height());
116 116
117 window_.reset( 117 window_.reset(
118 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); 118 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]);
119 [GetWebContents()->GetNativeView() setFrame:frame]; 119 [GetWebContents()->GetNativeView() setFrame:frame];
120 [GetWebContents()->GetNativeView() setAutoresizingMask:
121 NSViewWidthSizable|NSViewHeightSizable];
120 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()]; 122 [[window_ contentView] addSubview:GetWebContents()->GetNativeView()];
121 123
122 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 124 base::scoped_nsobject<WebDialogConstrainedWindowSheet> sheet(
123 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window_]); 125 [[WebDialogConstrainedWindowSheet alloc] initWithCustomWindow:window_
126 webDialogDelegate:delegate]);
124 constrained_window_.reset(new ConstrainedWindowMac( 127 constrained_window_.reset(new ConstrainedWindowMac(
125 this, web_contents, sheet)); 128 this, web_contents, sheet));
126 129
127 impl_->set_window(constrained_window_.get()); 130 impl_->set_window(constrained_window_.get());
128 } 131 }
129 132
130 ConstrainedWebDialogDelegate* ShowConstrainedWebDialog( 133 ConstrainedWebDialogDelegate* ShowConstrainedWebDialog(
131 content::BrowserContext* browser_context, 134 content::BrowserContext* browser_context,
132 WebDialogDelegate* delegate, 135 WebDialogDelegate* delegate,
133 content::WebContents* web_contents) { 136 content::WebContents* web_contents) {
134 // Deleted when the dialog closes. 137 // Deleted when the dialog closes.
135 ConstrainedWebDialogDelegateViewMac* constrained_delegate = 138 ConstrainedWebDialogDelegateViewMac* constrained_delegate =
136 new ConstrainedWebDialogDelegateViewMac( 139 new ConstrainedWebDialogDelegateViewMac(
137 browser_context, delegate, web_contents); 140 browser_context, delegate, web_contents);
138 return constrained_delegate; 141 return constrained_delegate;
139 } 142 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698