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

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

Issue 8566014: Cocoa: Make HTMLDialogWindow resizable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" 5 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/memory/scoped_nsobject.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 - (id)initWithDelegate:(HtmlDialogUIDelegate*)delegate 253 - (id)initWithDelegate:(HtmlDialogUIDelegate*)delegate
254 profile:(Profile*)profile { 254 profile:(Profile*)profile {
255 DCHECK(delegate); 255 DCHECK(delegate);
256 DCHECK(profile); 256 DCHECK(profile);
257 257
258 gfx::Size dialogSize; 258 gfx::Size dialogSize;
259 delegate->GetDialogSize(&dialogSize); 259 delegate->GetDialogSize(&dialogSize);
260 NSRect dialogRect = NSMakeRect(0, 0, dialogSize.width(), dialogSize.height()); 260 NSRect dialogRect = NSMakeRect(0, 0, dialogSize.width(), dialogSize.height());
261 // TODO(akalin): Make the window resizable (but with the minimum size being 261 NSUInteger style = NSTitledWindowMask | NSClosableWindowMask |
262 // dialog_size and always on top (but not modal) to match the Windows 262 NSResizableWindowMask;
263 // behavior. On the other hand, the fact that HTML dialogs on Windows
264 // are resizable could just be an accident. Investigate futher...
265 NSUInteger style = NSTitledWindowMask | NSClosableWindowMask;
266 scoped_nsobject<ChromeEventProcessingWindow> window( 263 scoped_nsobject<ChromeEventProcessingWindow> window(
267 [[ChromeEventProcessingWindow alloc] 264 [[ChromeEventProcessingWindow alloc]
268 initWithContentRect:dialogRect 265 initWithContentRect:dialogRect
269 styleMask:style 266 styleMask:style
270 backing:NSBackingStoreBuffered 267 backing:NSBackingStoreBuffered
271 defer:YES]); 268 defer:YES]);
272 if (!window.get()) { 269 if (!window.get()) {
273 return nil; 270 return nil;
274 } 271 }
275 self = [super initWithWindow:window]; 272 self = [super initWithWindow:window];
276 if (!self) { 273 if (!self) {
277 return nil; 274 return nil;
278 } 275 }
279 [window setWindowController:self]; 276 [window setWindowController:self];
280 [window setDelegate:self]; 277 [window setDelegate:self];
281 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())]; 278 [window setTitle:base::SysUTF16ToNSString(delegate->GetDialogTitle())];
279 [window setMinSize:dialogRect.size];
282 [window center]; 280 [window center];
283 delegate_.reset(new HtmlDialogWindowDelegateBridge(self, profile, delegate)); 281 delegate_.reset(new HtmlDialogWindowDelegateBridge(self, profile, delegate));
284 return self; 282 return self;
285 } 283 }
286 284
287 - (void)loadDialogContents { 285 - (void)loadDialogContents {
288 tabContents_.reset(new TabContents( 286 tabContents_.reset(new TabContents(
289 delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); 287 delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL));
290 [[self window] setContentView:tabContents_->GetNativeView()]; 288 [[self window] setContentView:tabContents_->GetNativeView()];
291 tabContents_->set_delegate(delegate_.get()); 289 tabContents_->set_delegate(delegate_.get());
(...skipping 13 matching lines...) Expand all
305 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender 303 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender
306 // to do the above doesn't work. 304 // to do the above doesn't work.
307 } 305 }
308 306
309 - (void)windowWillClose:(NSNotification*)notification { 307 - (void)windowWillClose:(NSNotification*)notification {
310 delegate_->WindowControllerClosed(); 308 delegate_->WindowControllerClosed();
311 [self autorelease]; 309 [self autorelease];
312 } 310 }
313 311
314 @end 312 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698