| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (!max_size_.IsEmpty()) | 231 if (!max_size_.IsEmpty()) |
| 232 EnableAutoResize(); | 232 EnableAutoResize(); |
| 233 } | 233 } |
| 234 void RenderViewHostChanged(content::RenderViewHost* old_host, | 234 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 235 content::RenderViewHost* new_host) override { | 235 content::RenderViewHost* new_host) override { |
| 236 if (!max_size_.IsEmpty()) | 236 if (!max_size_.IsEmpty()) |
| 237 EnableAutoResize(); | 237 EnableAutoResize(); |
| 238 } | 238 } |
| 239 void DocumentOnLoadCompletedInMainFrame() override { | 239 void DocumentOnLoadCompletedInMainFrame() override { |
| 240 if (!max_size_.IsEmpty() && initiator_observer_.web_contents()) { | 240 if (!max_size_.IsEmpty() && 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 } | 243 } |
| 245 } | 244 } |
| 246 | 245 |
| 247 private: | 246 private: |
| 248 void EnableAutoResize() { | 247 void EnableAutoResize() { |
| 249 content::RenderViewHost* render_view_host = | 248 content::RenderViewHost* render_view_host = |
| 250 GetWebContents()->GetRenderViewHost(); | 249 GetWebContents()->GetRenderViewHost(); |
| 251 render_view_host->EnableAutoResize(min_size_, max_size_); | 250 render_view_host->EnableAutoResize(min_size_, max_size_); |
| 252 } | 251 } |
| 253 | 252 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 284 const gfx::Size& max_size) { | 283 const gfx::Size& max_size) { |
| 285 DCHECK(!min_size.IsEmpty()); | 284 DCHECK(!min_size.IsEmpty()); |
| 286 DCHECK(!max_size.IsEmpty()); | 285 DCHECK(!max_size.IsEmpty()); |
| 287 ConstrainedWebDialogDelegateViewViews* dialog = | 286 ConstrainedWebDialogDelegateViewViews* dialog = |
| 288 new ConstrainedWebDialogDelegateViewViews( | 287 new ConstrainedWebDialogDelegateViewViews( |
| 289 browser_context, delegate, web_contents, | 288 browser_context, delegate, web_contents, |
| 290 min_size, max_size); | 289 min_size, max_size); |
| 291 constrained_window::CreateWebModalDialogViews(dialog, web_contents); | 290 constrained_window::CreateWebModalDialogViews(dialog, web_contents); |
| 292 return dialog; | 291 return dialog; |
| 293 } | 292 } |
| OLD | NEW |