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 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 EnableAutoResize(); | 230 EnableAutoResize(); |
231 } | 231 } |
232 void RenderViewHostChanged(content::RenderViewHost* old_host, | 232 void RenderViewHostChanged(content::RenderViewHost* old_host, |
233 content::RenderViewHost* new_host) override { | 233 content::RenderViewHost* new_host) override { |
234 if (!max_size_.IsEmpty()) | 234 if (!max_size_.IsEmpty()) |
235 EnableAutoResize(); | 235 EnableAutoResize(); |
236 } | 236 } |
237 void DocumentOnLoadCompletedInMainFrame() override { | 237 void DocumentOnLoadCompletedInMainFrame() override { |
238 if (!max_size_.IsEmpty()) { | 238 if (!max_size_.IsEmpty()) { |
239 EnableAutoResize(); | 239 EnableAutoResize(); |
240 if (initiator_observer_.web_contents()) { | 240 if (initiator_observer_.web_contents()) |
241 web_modal::WebContentsModalDialogManager::FromWebContents( | 241 constrained_window::ShowModalDialog(GetWidget()->GetNativeWindow(), |
242 initiator_observer_.web_contents()) | 242 initiator_observer_.web_contents()); |
243 ->ShowModalDialog(GetWidget()->GetNativeWindow()); | |
244 } | |
245 } | 243 } |
246 } | 244 } |
247 | 245 |
248 private: | 246 private: |
249 void EnableAutoResize() { | 247 void EnableAutoResize() { |
250 content::RenderViewHost* render_view_host = | 248 content::RenderViewHost* render_view_host = |
251 GetWebContents()->GetRenderViewHost(); | 249 GetWebContents()->GetRenderViewHost(); |
252 render_view_host->EnableAutoResize(min_size_, max_size_); | 250 render_view_host->EnableAutoResize(min_size_, max_size_); |
253 } | 251 } |
254 | 252 |
(...skipping 30 matching lines...) Expand all Loading... |
285 const gfx::Size& max_size) { | 283 const gfx::Size& max_size) { |
286 DCHECK(!min_size.IsEmpty()); | 284 DCHECK(!min_size.IsEmpty()); |
287 DCHECK(!max_size.IsEmpty()); | 285 DCHECK(!max_size.IsEmpty()); |
288 ConstrainedWebDialogDelegateViewViews* dialog = | 286 ConstrainedWebDialogDelegateViewViews* dialog = |
289 new ConstrainedWebDialogDelegateViewViews( | 287 new ConstrainedWebDialogDelegateViewViews( |
290 browser_context, delegate, web_contents, | 288 browser_context, delegate, web_contents, |
291 min_size, max_size); | 289 min_size, max_size); |
292 constrained_window::CreateWebModalDialogViews(dialog, web_contents); | 290 constrained_window::CreateWebModalDialogViews(dialog, web_contents); |
293 return dialog; | 291 return dialog; |
294 } | 292 } |
OLD | NEW |