OLD | NEW |
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 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 GetWebContents()->GetRenderViewHost(); | 173 GetWebContents()->GetRenderViewHost(); |
174 render_view_host->EnableAutoResize(min_size_, max_size_); | 174 render_view_host->EnableAutoResize(min_size_, max_size_); |
175 } | 175 } |
176 | 176 |
177 // Whether or not the dialog is autoresizable is determined based on whether | 177 // Whether or not the dialog is autoresizable is determined based on whether |
178 // |max_size_| was specified. | 178 // |max_size_| was specified. |
179 bool IsDialogAutoResizable() { | 179 bool IsDialogAutoResizable() { |
180 return !max_size_.IsEmpty(); | 180 return !max_size_.IsEmpty(); |
181 } | 181 } |
182 | 182 |
183 scoped_ptr<ConstrainedWebDialogDelegateMac> impl_; | 183 std::unique_ptr<ConstrainedWebDialogDelegateMac> impl_; |
184 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 184 std::unique_ptr<ConstrainedWindowMac> constrained_window_; |
185 base::scoped_nsobject<NSWindow> window_; | 185 base::scoped_nsobject<NSWindow> window_; |
186 | 186 |
187 // Minimum and maximum sizes to determine dialog bounds for auto-resizing. | 187 // Minimum and maximum sizes to determine dialog bounds for auto-resizing. |
188 const gfx::Size min_size_; | 188 const gfx::Size min_size_; |
189 const gfx::Size max_size_; | 189 const gfx::Size max_size_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewMac); | 191 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewMac); |
192 }; | 192 }; |
193 | 193 |
194 ConstrainedWebDialogDelegateViewMac::ConstrainedWebDialogDelegateViewMac( | 194 ConstrainedWebDialogDelegateViewMac::ConstrainedWebDialogDelegateViewMac( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 const gfx::Size& max_size) { | 255 const gfx::Size& max_size) { |
256 DCHECK(!min_size.IsEmpty()); | 256 DCHECK(!min_size.IsEmpty()); |
257 DCHECK(!max_size.IsEmpty()); | 257 DCHECK(!max_size.IsEmpty()); |
258 // Deleted when the dialog closes. | 258 // Deleted when the dialog closes. |
259 ConstrainedWebDialogDelegateViewMac* constrained_delegate = | 259 ConstrainedWebDialogDelegateViewMac* constrained_delegate = |
260 new ConstrainedWebDialogDelegateViewMac( | 260 new ConstrainedWebDialogDelegateViewMac( |
261 browser_context, delegate, web_contents, | 261 browser_context, delegate, web_contents, |
262 min_size, max_size); | 262 min_size, max_size); |
263 return constrained_delegate; | 263 return constrained_delegate; |
264 } | 264 } |
OLD | NEW |