| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/constrained_window_views.h" | 8 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 9 #include "content/public/browser/native_web_keyboard_event.h" | 9 #include "content/public/browser/native_web_keyboard_event.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 11 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 12 #include "ui/views/controls/webview/webview.h" | 12 #include "ui/views/controls/webview/webview.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
| 15 #include "ui/web_dialogs/web_dialog_delegate.h" | 15 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 16 #include "ui/web_dialogs/web_dialog_ui.h" | 16 #include "ui/web_dialogs/web_dialog_ui.h" |
| 17 | 17 |
| 18 using ui::WebDialogDelegate; | 18 using ui::WebDialogDelegate; |
| 19 using ui::WebDialogWebContentsDelegate; | 19 using ui::WebDialogWebContentsDelegate; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class ConstrainedWebDialogDelegateViews | 23 class ConstrainedWebDialogDelegateViews |
| 24 : public ConstrainedWebDialogDelegateBase { | 24 : public ConstrainedWebDialogDelegateBase { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 virtual const views::Widget* GetWidget() const OVERRIDE { | 110 virtual const views::Widget* GetWidget() const OVERRIDE { |
| 111 return View::GetWidget(); | 111 return View::GetWidget(); |
| 112 } | 112 } |
| 113 virtual base::string16 GetWindowTitle() const OVERRIDE { | 113 virtual base::string16 GetWindowTitle() const OVERRIDE { |
| 114 return impl_->closed_via_webui() ? base::string16() : | 114 return impl_->closed_via_webui() ? base::string16() : |
| 115 GetWebDialogDelegate()->GetDialogTitle(); | 115 GetWebDialogDelegate()->GetDialogTitle(); |
| 116 } | 116 } |
| 117 virtual views::View* GetContentsView() OVERRIDE { | 117 virtual views::View* GetContentsView() OVERRIDE { |
| 118 return this; | 118 return this; |
| 119 } | 119 } |
| 120 virtual views::NonClientFrameView* CreateNonClientFrameView( |
| 121 views::Widget* widget) OVERRIDE { |
| 122 return views::DialogDelegate::CreateDialogFrameView(widget); |
| 123 } |
| 120 virtual bool ShouldShowCloseButton() const OVERRIDE { | 124 virtual bool ShouldShowCloseButton() const OVERRIDE { |
| 121 // No close button if the dialog doesn't want a title bar. | 125 // No close button if the dialog doesn't want a title bar. |
| 122 return impl_->GetWebDialogDelegate()->ShouldShowDialogTitle(); | 126 return impl_->GetWebDialogDelegate()->ShouldShowDialogTitle(); |
| 123 } | 127 } |
| 124 virtual ui::ModalType GetModalType() const OVERRIDE { | 128 virtual ui::ModalType GetModalType() const OVERRIDE { |
| 125 return ui::MODAL_TYPE_CHILD; | 129 return ui::MODAL_TYPE_CHILD; |
| 126 } | 130 } |
| 127 | 131 |
| 128 // views::WebView: | 132 // views::WebView: |
| 129 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { | 133 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 155 content::BrowserContext* browser_context, | 159 content::BrowserContext* browser_context, |
| 156 WebDialogDelegate* delegate, | 160 WebDialogDelegate* delegate, |
| 157 WebDialogWebContentsDelegate* tab_delegate, | 161 WebDialogWebContentsDelegate* tab_delegate, |
| 158 content::WebContents* web_contents) { | 162 content::WebContents* web_contents) { |
| 159 ConstrainedWebDialogDelegateViewViews* dialog = | 163 ConstrainedWebDialogDelegateViewViews* dialog = |
| 160 new ConstrainedWebDialogDelegateViewViews( | 164 new ConstrainedWebDialogDelegateViewViews( |
| 161 browser_context, delegate, tab_delegate); | 165 browser_context, delegate, tab_delegate); |
| 162 ShowWebModalDialogViews(dialog, web_contents); | 166 ShowWebModalDialogViews(dialog, web_contents); |
| 163 return dialog; | 167 return dialog; |
| 164 } | 168 } |
| OLD | NEW |