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" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 dialog_size.width(), | 120 dialog_size.width(), |
121 dialog_size.height()); | 121 dialog_size.height()); |
122 | 122 |
123 gtk_widget_show_all(contents); | 123 gtk_widget_show_all(contents); |
124 | 124 |
125 g_signal_connect(contents, "destroy", G_CALLBACK(OnDestroyThunk), this); | 125 g_signal_connect(contents, "destroy", G_CALLBACK(OnDestroyThunk), this); |
126 } | 126 } |
127 | 127 |
128 void ConstrainedWebDialogDelegateViewGtk::OnDestroy(GtkWidget* widget) { | 128 void ConstrainedWebDialogDelegateViewGtk::OnDestroy(GtkWidget* widget) { |
129 if (!impl_->closed_via_webui()) | 129 if (!impl_->closed_via_webui()) |
130 GetWebDialogDelegate()->OnDialogClosed(""); | 130 GetWebDialogDelegate()->OnDialogClosed(std::string()); |
131 delete this; | 131 delete this; |
132 } | 132 } |
133 | 133 |
134 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 134 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
135 content::BrowserContext* browser_context, | 135 content::BrowserContext* browser_context, |
136 WebDialogDelegate* delegate, | 136 WebDialogDelegate* delegate, |
137 WebDialogWebContentsDelegate* tab_delegate, | 137 WebDialogWebContentsDelegate* tab_delegate, |
138 content::WebContents* web_contents) { | 138 content::WebContents* web_contents) { |
139 ConstrainedWebDialogDelegateViewGtk* constrained_delegate = | 139 ConstrainedWebDialogDelegateViewGtk* constrained_delegate = |
140 new ConstrainedWebDialogDelegateViewGtk( | 140 new ConstrainedWebDialogDelegateViewGtk( |
141 browser_context, delegate, tab_delegate); | 141 browser_context, delegate, tab_delegate); |
142 GtkWidget* window = | 142 GtkWidget* window = |
143 CreateWebContentsModalDialogGtk( | 143 CreateWebContentsModalDialogGtk( |
144 constrained_delegate->GetWebContents()->GetView()->GetNativeView(), | 144 constrained_delegate->GetWebContents()->GetView()->GetNativeView(), |
145 constrained_delegate->GetWebContents()->GetView()-> | 145 constrained_delegate->GetWebContents()->GetView()-> |
146 GetContentNativeView()); | 146 GetContentNativeView()); |
147 SetBackgroundColor(window, ui::kGdkWhite); | 147 SetBackgroundColor(window, ui::kGdkWhite); |
148 constrained_delegate->SetWindow(window); | 148 constrained_delegate->SetWindow(window); |
149 | 149 |
150 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 150 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
151 WebContentsModalDialogManager::FromWebContents(web_contents); | 151 WebContentsModalDialogManager::FromWebContents(web_contents); |
152 web_contents_modal_dialog_manager->ShowDialog(window); | 152 web_contents_modal_dialog_manager->ShowDialog(window); |
153 | 153 |
154 return constrained_delegate; | 154 return constrained_delegate; |
155 } | 155 } |
OLD | NEW |