OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 10 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
11 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 11 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
12 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.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/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
16 #include "ui/base/gtk/gtk_hig_constants.h" | 16 #include "ui/base/gtk/gtk_hig_constants.h" |
17 #include "ui/base/gtk/gtk_signal.h" | 17 #include "ui/base/gtk/gtk_signal.h" |
18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
19 #include "ui/web_dialogs/web_dialog_delegate.h" | 19 #include "ui/web_dialogs/web_dialog_delegate.h" |
20 #include "ui/web_dialogs/web_dialog_ui.h" | 20 #include "ui/web_dialogs/web_dialog_ui.h" |
21 | 21 |
22 using content::WebContents; | 22 using content::WebContents; |
23 using ui::WebDialogDelegate; | 23 using ui::WebDialogDelegate; |
24 using ui::WebDialogWebContentsDelegate; | 24 using ui::WebDialogWebContentsDelegate; |
| 25 using web_modal::WebContentsModalDialogManager; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 class ConstrainedWebDialogDelegateGtk | 29 class ConstrainedWebDialogDelegateGtk |
29 : public ConstrainedWebDialogDelegateBase { | 30 : public ConstrainedWebDialogDelegateBase { |
30 public: | 31 public: |
31 ConstrainedWebDialogDelegateGtk( | 32 ConstrainedWebDialogDelegateGtk( |
32 content::BrowserContext* browser_context, | 33 content::BrowserContext* browser_context, |
33 WebDialogDelegate* delegate, | 34 WebDialogDelegate* delegate, |
34 WebDialogWebContentsDelegate* tab_delegate) | 35 WebDialogWebContentsDelegate* tab_delegate) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { | 76 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE { |
76 return impl_->GetWebDialogDelegate(); | 77 return impl_->GetWebDialogDelegate(); |
77 } | 78 } |
78 virtual void OnDialogCloseFromWebUI() OVERRIDE { | 79 virtual void OnDialogCloseFromWebUI() OVERRIDE { |
79 return impl_->OnDialogCloseFromWebUI(); | 80 return impl_->OnDialogCloseFromWebUI(); |
80 } | 81 } |
81 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE { | 82 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE { |
82 return impl_->ReleaseWebContentsOnDialogClose(); | 83 return impl_->ReleaseWebContentsOnDialogClose(); |
83 } | 84 } |
84 virtual NativeWebContentsModalDialog GetNativeDialog() OVERRIDE { | 85 virtual web_modal::NativeWebContentsModalDialog GetNativeDialog() OVERRIDE { |
85 return impl_->window(); | 86 return impl_->window(); |
86 } | 87 } |
87 virtual WebContents* GetWebContents() OVERRIDE { | 88 virtual WebContents* GetWebContents() OVERRIDE { |
88 return impl_->GetWebContents(); | 89 return impl_->GetWebContents(); |
89 } | 90 } |
90 | 91 |
91 void SetWindow(GtkWidget* window) { | 92 void SetWindow(GtkWidget* window) { |
92 impl_->set_window(window); | 93 impl_->set_window(window); |
93 } | 94 } |
94 | 95 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 GetContentNativeView()); | 147 GetContentNativeView()); |
147 SetBackgroundColor(window, ui::kGdkWhite); | 148 SetBackgroundColor(window, ui::kGdkWhite); |
148 constrained_delegate->SetWindow(window); | 149 constrained_delegate->SetWindow(window); |
149 | 150 |
150 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 151 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
151 WebContentsModalDialogManager::FromWebContents(web_contents); | 152 WebContentsModalDialogManager::FromWebContents(web_contents); |
152 web_contents_modal_dialog_manager->ShowDialog(window); | 153 web_contents_modal_dialog_manager->ShowDialog(window); |
153 | 154 |
154 return constrained_delegate; | 155 return constrained_delegate; |
155 } | 156 } |
OLD | NEW |