| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 13 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 13 #include "components/constrained_window/constrained_window_views.h" | 14 #include "components/constrained_window/constrained_window_views.h" |
| 14 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 15 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 15 #include "content/public/browser/native_web_keyboard_event.h" | 16 #include "content/public/browser/native_web_keyboard_event.h" |
| 16 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 19 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 19 #include "ui/views/controls/webview/webview.h" | 20 #include "ui/views/controls/webview/webview.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegateViews); | 101 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegateViews); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 class ConstrainedWebDialogDelegateViews | 104 class ConstrainedWebDialogDelegateViews |
| 104 : public ConstrainedWebDialogDelegateBase { | 105 : public ConstrainedWebDialogDelegateBase { |
| 105 public: | 106 public: |
| 106 ConstrainedWebDialogDelegateViews(content::BrowserContext* context, | 107 ConstrainedWebDialogDelegateViews(content::BrowserContext* context, |
| 107 ui::WebDialogDelegate* delegate, | 108 ui::WebDialogDelegate* delegate, |
| 108 InitiatorWebContentsObserver* observer, | 109 InitiatorWebContentsObserver* observer, |
| 109 views::WebView* view) | 110 views::WebView* view) |
| 110 : ConstrainedWebDialogDelegateBase(context, delegate, | 111 : ConstrainedWebDialogDelegateBase( |
| 112 context, |
| 113 delegate, |
| 111 new WebDialogWebContentsDelegateViews(context, observer, view)), | 114 new WebDialogWebContentsDelegateViews(context, observer, view)), |
| 112 view_(view) {} | 115 view_(view) { |
| 116 chrome::RecordDialogCreation(chrome::DialogIdentifier::CONSTRAINED_WEB); |
| 117 } |
| 113 | 118 |
| 114 ~ConstrainedWebDialogDelegateViews() override {} | 119 ~ConstrainedWebDialogDelegateViews() override {} |
| 115 | 120 |
| 116 // ui::WebDialogWebContentsDelegate: | 121 // ui::WebDialogWebContentsDelegate: |
| 117 void CloseContents(content::WebContents* source) override { | 122 void CloseContents(content::WebContents* source) override { |
| 118 view_->GetWidget()->Close(); | 123 view_->GetWidget()->Close(); |
| 119 } | 124 } |
| 120 | 125 |
| 121 // contents::WebContentsDelegate: | 126 // contents::WebContentsDelegate: |
| 122 void HandleKeyboardEvent( | 127 void HandleKeyboardEvent( |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 min_size, max_size); | 305 min_size, max_size); |
| 301 | 306 |
| 302 // For embedded WebContents, use the embedder's WebContents for constrained | 307 // For embedded WebContents, use the embedder's WebContents for constrained |
| 303 // window. | 308 // window. |
| 304 content::WebContents* top_level_web_contents = | 309 content::WebContents* top_level_web_contents = |
| 305 constrained_window::GetTopLevelWebContents(web_contents); | 310 constrained_window::GetTopLevelWebContents(web_contents); |
| 306 DCHECK(top_level_web_contents); | 311 DCHECK(top_level_web_contents); |
| 307 constrained_window::CreateWebModalDialogViews(dialog, top_level_web_contents); | 312 constrained_window::CreateWebModalDialogViews(dialog, top_level_web_contents); |
| 308 return dialog; | 313 return dialog; |
| 309 } | 314 } |
| OLD | NEW |