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

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

Issue 1430023002: Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per erikchen@'s comments. Created 5 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
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/cocoa/tab_modal_confirm_dialog_mac.h" 5 #include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "chrome/browser/ui/browser_dialogs.h" 8 #include "chrome/browser/ui/browser_dialogs.h"
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.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_custom_sh eet.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 keyEquivalent:kKeyEquivalentEscape 81 keyEquivalent:kKeyEquivalentEscape
82 target:bridge_ 82 target:bridge_
83 action:@selector(onCancelButton:)]; 83 action:@selector(onCancelButton:)];
84 [[alert_ closeButton] setTarget:bridge_]; 84 [[alert_ closeButton] setTarget:bridge_];
85 [[alert_ closeButton] setAction:@selector(onCancelButton:)]; 85 [[alert_ closeButton] setAction:@selector(onCancelButton:)];
86 [alert_ layout]; 86 [alert_ layout];
87 87
88 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 88 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
89 [[CustomConstrainedWindowSheet alloc] 89 [[CustomConstrainedWindowSheet alloc]
90 initWithCustomWindow:[alert_ window]]); 90 initWithCustomWindow:[alert_ window]]);
91 window_.reset(new ConstrainedWindowMac(this, web_contents, sheet)); 91 window_.reset(CreateAndShowWebModalDialogMac(this, web_contents, sheet));
92 delegate_->set_close_delegate(this); 92 delegate_->set_close_delegate(this);
93 } 93 }
94 94
95 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { 95 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() {
96 } 96 }
97 97
98 void TabModalConfirmDialogMac::AcceptTabModalDialog() { 98 void TabModalConfirmDialogMac::AcceptTabModalDialog() {
99 delegate_->Accept(); 99 delegate_->Accept();
100 } 100 }
101 101
(...skipping 13 matching lines...) Expand all
115 // If this method should mistakenly be called during Delegate::Close(), 115 // If this method should mistakenly be called during Delegate::Close(),
116 // prevent a double-delete by moving delegate_ to a stack variable. 116 // prevent a double-delete by moving delegate_ to a stack variable.
117 if (!delegate_) 117 if (!delegate_)
118 return; 118 return;
119 scoped_ptr<TabModalConfirmDialogDelegate> delegate(delegate_.Pass()); 119 scoped_ptr<TabModalConfirmDialogDelegate> delegate(delegate_.Pass());
120 // Provide a disposition in case the dialog was closed without accepting or 120 // Provide a disposition in case the dialog was closed without accepting or
121 // cancelling. 121 // cancelling.
122 delegate->Close(); 122 delegate->Close();
123 delete this; 123 delete this;
124 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698