| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/renderer_preferences_util.h" | 10 #include "chrome/browser/renderer_preferences_util.h" |
| 11 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 11 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 12 #include "components/ui/zoom/zoom_controller.h" | 12 #include "components/ui/zoom/zoom_controller.h" |
| 13 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_source.h" |
| 15 #include "content/public/common/renderer_preferences.h" | 16 #include "content/public/common/renderer_preferences.h" |
| 16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
| 17 #include "ui/web_dialogs/web_dialog_delegate.h" | 18 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 18 #include "ui/web_dialogs/web_dialog_ui.h" | 19 #include "ui/web_dialogs/web_dialog_ui.h" |
| 19 | 20 |
| 20 using content::NativeWebKeyboardEvent; | 21 using content::NativeWebKeyboardEvent; |
| 21 using content::WebContents; | 22 using content::WebContents; |
| 22 using ui::WebDialogDelegate; | 23 using ui::WebDialogDelegate; |
| 23 using ui::WebDialogWebContentsDelegate; | 24 using ui::WebDialogWebContentsDelegate; |
| 24 | 25 |
| 25 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( | 26 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( |
| 26 content::BrowserContext* browser_context, | 27 content::BrowserContext* browser_context, |
| 27 WebDialogDelegate* delegate, | 28 WebDialogDelegate* delegate, |
| 28 WebDialogWebContentsDelegate* tab_delegate) | 29 WebDialogWebContentsDelegate* tab_delegate) |
| 29 : WebDialogWebContentsDelegate(browser_context, | 30 : WebDialogWebContentsDelegate(browser_context, |
| 30 new ChromeWebContentsHandler), | 31 new ChromeWebContentsHandler), |
| 31 web_dialog_delegate_(delegate), | 32 web_dialog_delegate_(delegate), |
| 32 closed_via_webui_(false), | 33 closed_via_webui_(false), |
| 33 release_contents_on_close_(false) { | 34 release_contents_on_close_(false) { |
| 34 CHECK(delegate); | 35 CHECK(delegate); |
| 35 web_contents_.reset( | 36 web_contents_.reset( |
| 36 WebContents::Create(WebContents::CreateParams(browser_context))); | 37 WebContents::Create(WebContents::CreateParams(browser_context))); |
| 38 WebContentsSource::CreateForWebContentsAndLocation(web_contents_.get(), |
| 39 FROM_HERE); |
| 37 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); | 40 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); |
| 38 if (tab_delegate) { | 41 if (tab_delegate) { |
| 39 override_tab_delegate_.reset(tab_delegate); | 42 override_tab_delegate_.reset(tab_delegate); |
| 40 web_contents_->SetDelegate(tab_delegate); | 43 web_contents_->SetDelegate(tab_delegate); |
| 41 } else { | 44 } else { |
| 42 web_contents_->SetDelegate(this); | 45 web_contents_->SetDelegate(this); |
| 43 } | 46 } |
| 44 content::RendererPreferences* prefs = | 47 content::RendererPreferences* prefs = |
| 45 web_contents_->GetMutableRendererPrefs(); | 48 web_contents_->GetMutableRendererPrefs(); |
| 46 renderer_preferences_util::UpdateFromSystemSettings( | 49 renderer_preferences_util::UpdateFromSystemSettings( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 109 |
| 107 gfx::Size ConstrainedWebDialogDelegateBase::GetMaximumSize() const { | 110 gfx::Size ConstrainedWebDialogDelegateBase::GetMaximumSize() const { |
| 108 NOTREACHED(); | 111 NOTREACHED(); |
| 109 return gfx::Size(); | 112 return gfx::Size(); |
| 110 } | 113 } |
| 111 | 114 |
| 112 gfx::Size ConstrainedWebDialogDelegateBase::GetPreferredSize() const { | 115 gfx::Size ConstrainedWebDialogDelegateBase::GetPreferredSize() const { |
| 113 NOTREACHED(); | 116 NOTREACHED(); |
| 114 return gfx::Size(); | 117 return gfx::Size(); |
| 115 } | 118 } |
| OLD | NEW |