| 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/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/common/renderer_preferences.h" | 15 #include "content/public/common/renderer_preferences.h" |
| 16 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
| 17 #include "ui/web_dialogs/web_dialog_delegate.h" | 17 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 18 #include "ui/web_dialogs/web_dialog_ui.h" | 18 #include "ui/web_dialogs/web_dialog_ui.h" |
| 19 | 19 |
| 20 using content::NativeWebKeyboardEvent; | 20 using content::NativeWebKeyboardEvent; |
| 21 using content::WebContents; | 21 using content::WebContents; |
| 22 using ui::WebDialogDelegate; | 22 using ui::WebDialogDelegate; |
| 23 using ui::WebDialogWebContentsDelegate; | 23 using ui::WebDialogWebContentsDelegate; |
| 24 | 24 |
| 25 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( | 25 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( |
| 26 content::BrowserContext* browser_context, | 26 content::BrowserContext* browser_context, |
| 27 WebDialogDelegate* delegate, | 27 WebDialogDelegate* delegate, |
| 28 WebDialogWebContentsDelegate* tab_delegate) | 28 WebDialogWebContentsDelegate* tab_delegate) |
| 29 : WebDialogWebContentsDelegate(browser_context, | 29 : WebDialogWebContentsDelegate(browser_context, |
| 30 new ChromeWebContentsHandler), | 30 new ChromeWebContentsHandler), |
| 31 web_dialog_delegate_(delegate), | 31 web_dialog_delegate_(delegate), |
| 32 closed_via_webui_(false), | 32 closed_via_webui_(false), |
| 33 release_contents_on_close_(false) { | 33 release_contents_on_close_(false) { |
| 34 CHECK(delegate); | 34 CHECK(delegate); |
| 35 web_contents_.reset( | 35 web_contents_.reset( |
| 36 WebContents::Create(WebContents::CreateParams(browser_context))); | 36 WebContents::Create(WebContents::CreateParams(browser_context))); |
| 37 ui_zoom::ZoomController::CreateForWebContents(web_contents_.get()); | 37 zoom::ZoomController::CreateForWebContents(web_contents_.get()); |
| 38 if (tab_delegate) { | 38 if (tab_delegate) { |
| 39 override_tab_delegate_.reset(tab_delegate); | 39 override_tab_delegate_.reset(tab_delegate); |
| 40 web_contents_->SetDelegate(tab_delegate); | 40 web_contents_->SetDelegate(tab_delegate); |
| 41 } else { | 41 } else { |
| 42 web_contents_->SetDelegate(this); | 42 web_contents_->SetDelegate(this); |
| 43 } | 43 } |
| 44 content::RendererPreferences* prefs = | 44 content::RendererPreferences* prefs = |
| 45 web_contents_->GetMutableRendererPrefs(); | 45 web_contents_->GetMutableRendererPrefs(); |
| 46 renderer_preferences_util::UpdateFromSystemSettings( | 46 renderer_preferences_util::UpdateFromSystemSettings( |
| 47 prefs, Profile::FromBrowserContext(browser_context), web_contents_.get()); | 47 prefs, Profile::FromBrowserContext(browser_context), web_contents_.get()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 gfx::Size ConstrainedWebDialogDelegateBase::GetPreferredSize() const { | 112 gfx::Size ConstrainedWebDialogDelegateBase::GetPreferredSize() const { |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 return gfx::Size(); | 114 return gfx::Size(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ConstrainedWebDialogDelegateBase::ResizeToGivenSize( | 117 void ConstrainedWebDialogDelegateBase::ResizeToGivenSize( |
| 118 const gfx::Size size) { | 118 const gfx::Size size) { |
| 119 NOTREACHED(); | 119 NOTREACHED(); |
| 120 } | 120 } |
| OLD | NEW |