| 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.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.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/views/unhandled_keyboard_event_handler.h" | 11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
| 12 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/views/controls/webview/webview.h" | 15 #include "ui/views/controls/webview/webview.h" |
| 16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 17 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 18 #include "ui/web_dialogs/web_dialog_delegate.h" | 18 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 19 #include "ui/web_dialogs/web_dialog_ui.h" | 19 #include "ui/web_dialogs/web_dialog_ui.h" |
| 20 | 20 |
| 21 using content::WebContents; | 21 using content::WebContents; |
| 22 using ui::ConstrainedWebDialogDelegate; | |
| 23 using ui::ConstrainedWebDialogUI; | |
| 24 using ui::WebDialogDelegate; | 22 using ui::WebDialogDelegate; |
| 25 using ui::WebDialogWebContentsDelegate; | 23 using ui::WebDialogWebContentsDelegate; |
| 26 | 24 |
| 27 namespace { | 25 namespace { |
| 28 | 26 |
| 29 class ConstrainedWebDialogDelegateViews | 27 class ConstrainedWebDialogDelegateViews |
| 30 : public ConstrainedWebDialogDelegateBase { | 28 : public ConstrainedWebDialogDelegateBase { |
| 31 public: | 29 public: |
| 32 ConstrainedWebDialogDelegateViews( | 30 ConstrainedWebDialogDelegateViews( |
| 33 Profile* profile, | 31 Profile* profile, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SetWebContents(tab()->web_contents()); | 165 SetWebContents(tab()->web_contents()); |
| 168 | 166 |
| 169 // Pressing ESC closes the dialog. | 167 // Pressing ESC closes the dialog. |
| 170 set_allow_accelerators(true); | 168 set_allow_accelerators(true); |
| 171 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | 169 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| 172 } | 170 } |
| 173 | 171 |
| 174 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews()
{ | 172 ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews()
{ |
| 175 } | 173 } |
| 176 | 174 |
| 177 ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( | 175 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
| 178 Profile* profile, | 176 Profile* profile, |
| 179 WebDialogDelegate* delegate, | 177 WebDialogDelegate* delegate, |
| 180 WebDialogWebContentsDelegate* tab_delegate, | 178 WebDialogWebContentsDelegate* tab_delegate, |
| 181 TabContents* container) { | 179 content::WebContents* web_contents) { |
| 182 ConstrainedWebDialogDelegateViewViews* constrained_delegate = | 180 ConstrainedWebDialogDelegateViewViews* constrained_delegate = |
| 183 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate)
; | 181 new ConstrainedWebDialogDelegateViewViews( |
| 182 profile, delegate, tab_delegate); |
| 184 ConstrainedWindow* constrained_window = | 183 ConstrainedWindow* constrained_window = |
| 185 new ConstrainedWindowViews(container->web_contents(), | 184 new ConstrainedWindowViews(web_contents, |
| 186 constrained_delegate, | 185 constrained_delegate, |
| 187 false, | 186 false, |
| 188 ConstrainedWindowViews::DEFAULT_INSETS); | 187 ConstrainedWindowViews::DEFAULT_INSETS); |
| 189 constrained_delegate->set_window(constrained_window); | 188 constrained_delegate->set_window(constrained_window); |
| 190 return constrained_delegate; | 189 return constrained_delegate; |
| 191 } | 190 } |
| OLD | NEW |