Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3844)

Unified Diff: chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc

Issue 12851002: Remove ConstrainedWindowGtkDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move SetBackgroundColor() Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/collected_cookies_gtk.cc ('k') | chrome/browser/ui/gtk/constrained_window_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
diff --git a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
index a45672227b71c12e58d2d0af5a642b4f86ec748d..679d4297479d0f602b55d6fbf8ba2327701f661e 100644
--- a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
@@ -45,11 +45,16 @@ class ConstrainedWebDialogDelegateGtk
DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateGtk);
};
+void SetBackgroundColor(GtkWidget* widget, const GdkColor &color) {
+ gtk_widget_modify_base(widget, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color);
+}
+
} // namespace
class ConstrainedWebDialogDelegateViewGtk
- : public ConstrainedWindowGtkDelegate,
- public ConstrainedWebDialogDelegate {
+ : public ConstrainedWebDialogDelegate {
public:
ConstrainedWebDialogDelegateViewGtk(
content::BrowserContext* browser_context,
@@ -79,23 +84,6 @@ class ConstrainedWebDialogDelegateViewGtk
return impl_->GetWebContents();
}
- // ConstrainedWindowGtkDelegate interface
- virtual GtkWidget* GetWidgetRoot() OVERRIDE {
- return GetWebContents()->GetView()->GetNativeView();
- }
- virtual GtkWidget* GetFocusWidget() OVERRIDE {
- return GetWebContents()->GetView()->GetContentNativeView();
- }
- virtual void DeleteDelegate() OVERRIDE {
- if (!impl_->closed_via_webui())
- GetWebDialogDelegate()->OnDialogClosed("");
- delete this;
- }
- virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE {
- *color = ui::kGdkWhite;
- return true;
- }
-
void SetWindow(GtkWidget* window) {
impl_->set_window(window);
}
@@ -105,6 +93,8 @@ class ConstrainedWebDialogDelegateViewGtk
}
private:
+ CHROMEGTK_CALLBACK_0(ConstrainedWebDialogDelegateViewGtk, void, OnDestroy);
+
scoped_ptr<ConstrainedWebDialogDelegateGtk> impl_;
DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewGtk);
@@ -120,11 +110,21 @@ ConstrainedWebDialogDelegateViewGtk::ConstrainedWebDialogDelegateViewGtk(
tab_delegate)) {
gfx::Size dialog_size;
delegate->GetDialogSize(&dialog_size);
- gtk_widget_set_size_request(GTK_WIDGET(GetWidgetRoot()),
+ GtkWidget* contents =
+ GTK_WIDGET(GetWebContents()->GetView()->GetNativeView());
+ gtk_widget_set_size_request(contents,
dialog_size.width(),
dialog_size.height());
- gtk_widget_show_all(GetWidgetRoot());
+ gtk_widget_show_all(contents);
+
+ g_signal_connect(contents, "destroy", G_CALLBACK(OnDestroyThunk), this);
+}
+
+void ConstrainedWebDialogDelegateViewGtk::OnDestroy(GtkWidget* widget) {
+ if (!impl_->closed_via_webui())
+ GetWebDialogDelegate()->OnDialogClosed("");
+ delete this;
}
ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
@@ -136,7 +136,12 @@ ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
new ConstrainedWebDialogDelegateViewGtk(
browser_context, delegate, tab_delegate);
GtkWidget* window =
- CreateWebContentsModalDialogGtk(web_contents, constrained_delegate);
+ CreateWebContentsModalDialogGtk(
+ web_contents,
+ constrained_delegate->GetWebContents()->GetView()->GetNativeView(),
+ constrained_delegate->GetWebContents()->GetView()->
+ GetContentNativeView());
+ SetBackgroundColor(window, ui::kGdkWhite);
constrained_delegate->SetWindow(window);
WebContentsModalDialogManager* web_contents_modal_dialog_manager =
« no previous file with comments | « chrome/browser/ui/gtk/collected_cookies_gtk.cc ('k') | chrome/browser/ui/gtk/constrained_window_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698