| 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 10 #include "chrome/browser/ui/views/constrained_window_views.h" | 10 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 11 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | |
| 12 #include "chrome/browser/ui/webui/web_dialog_ui.h" | |
| 13 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 14 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 15 #include "ui/views/controls/webview/webview.h" | 13 #include "ui/views/controls/webview/webview.h" |
| 16 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 17 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
| 16 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 17 #include "ui/web_dialogs/web_dialog_ui.h" |
| 18 | 18 |
| 19 using content::WebContents; | 19 using content::WebContents; |
| 20 using ui::ConstrainedWebDialogDelegate; |
| 21 using ui::ConstrainedWebDialogUI; |
| 22 using ui::WebDialogDelegate; |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| 22 | 25 |
| 23 class ConstrainedWebDialogDelegateViews | 26 class ConstrainedWebDialogDelegateViews |
| 24 : public ConstrainedWebDialogDelegateBase { | 27 : public ConstrainedWebDialogDelegateBase { |
| 25 public: | 28 public: |
| 26 ConstrainedWebDialogDelegateViews( | 29 ConstrainedWebDialogDelegateViews( |
| 27 Profile* profile, | 30 Profile* profile, |
| 28 WebDialogDelegate* delegate, | 31 WebDialogDelegate* delegate, |
| 29 WebDialogWebContentsDelegate* tab_delegate) | 32 WebDialogWebContentsDelegate* tab_delegate) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 : views::WebView(profile), | 133 : views::WebView(profile), |
| 131 impl_(new ConstrainedWebDialogDelegateViews(profile, | 134 impl_(new ConstrainedWebDialogDelegateViews(profile, |
| 132 delegate, | 135 delegate, |
| 133 tab_delegate)) { | 136 tab_delegate)) { |
| 134 SetWebContents(tab()->web_contents()); | 137 SetWebContents(tab()->web_contents()); |
| 135 } | 138 } |
| 136 | 139 |
| 137 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews()
{ | 140 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews()
{ |
| 138 } | 141 } |
| 139 | 142 |
| 140 // static | 143 ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( |
| 141 ConstrainedWebDialogDelegate* | 144 Profile* profile, |
| 142 ConstrainedWebDialogUI::CreateConstrainedWebDialog( | 145 WebDialogDelegate* delegate, |
| 143 Profile* profile, | 146 WebDialogWebContentsDelegate* tab_delegate, |
| 144 WebDialogDelegate* delegate, | 147 TabContentsWrapper* container) { |
| 145 WebDialogWebContentsDelegate* tab_delegate, | |
| 146 TabContentsWrapper* container) { | |
| 147 ConstrainedWebDialogDelegateViewViews* constrained_delegate = | 148 ConstrainedWebDialogDelegateViewViews* constrained_delegate = |
| 148 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate)
; | 149 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate)
; |
| 149 ConstrainedWindow* constrained_window = | 150 ConstrainedWindow* constrained_window = |
| 150 new ConstrainedWindowViews(container, constrained_delegate); | 151 new ConstrainedWindowViews(container, constrained_delegate); |
| 151 constrained_delegate->set_window(constrained_window); | 152 constrained_delegate->set_window(constrained_window); |
| 152 return constrained_delegate; | 153 return constrained_delegate; |
| 153 } | 154 } |
| OLD | NEW |