diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 20:28:13 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 20:28:13 +0000 |
commit | 97c22ee2f0123d1d4dbdb705809d97d0f1d9f65a (patch) | |
tree | 4b6501ca599fb8d884381f56e4435a9b4244d7a2 | |
parent | b104b50ddb1d70d95ff9ace7a6fb30ec3b1aeb17 (diff) | |
download | chromium_src-97c22ee2f0123d1d4dbdb705809d97d0f1d9f65a.zip chromium_src-97c22ee2f0123d1d4dbdb705809d97d0f1d9f65a.tar.gz chromium_src-97c22ee2f0123d1d4dbdb705809d97d0f1d9f65a.tar.bz2 |
[Gtk] add facility for constrained window delegate to control background color.
This makes modal html dialogs blend better (rather than having a white HTML background and a theme-colored border).
BUG=none
TEST=manual
Review URL: http://codereview.chromium.org/3784006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62968 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/constrained_html_delegate_gtk.cc (renamed from chrome/browser/gtk/constrained_html_dialog_gtk.cc) | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/constrained_window_gtk.cc | 15 | ||||
-rw-r--r-- | chrome/browser/gtk/constrained_window_gtk.h | 5 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/chrome/browser/gtk/constrained_html_dialog_gtk.cc b/chrome/browser/gtk/constrained_html_delegate_gtk.cc index 5f65b2a..f23c82d 100644 --- a/chrome/browser/gtk/constrained_html_dialog_gtk.cc +++ b/chrome/browser/gtk/constrained_html_delegate_gtk.cc @@ -4,6 +4,7 @@ #include "chrome/browser/dom_ui/constrained_html_ui.h" +#include "gfx/gtk_util.h" #include "gfx/rect.h" #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" @@ -35,6 +36,10 @@ class ConstrainedHtmlDelegateGtk : public ConstrainedWindowGtkDelegate, // ConstrainedHtmlDelegate --------------------------------------------- virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); virtual void OnDialogClose(); + virtual bool GetBackgroundColor(GdkColor* color) { + *color = gfx::kGdkWhite; + return true; + } // HtmlDialogTabContentsDelegate --------------------------------------------- void MoveContents(TabContents* source, const gfx::Rect& pos) {} diff --git a/chrome/browser/gtk/constrained_window_gtk.cc b/chrome/browser/gtk/constrained_window_gtk.cc index b901083..14564de 100644 --- a/chrome/browser/gtk/constrained_window_gtk.cc +++ b/chrome/browser/gtk/constrained_window_gtk.cc @@ -11,6 +11,13 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" +ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { +} + +bool ConstrainedWindowGtkDelegate::GetBackgroundColor(GdkColor* color) { + return false; +} + ConstrainedWindowGtk::ConstrainedWindowGtk( TabContents* owner, ConstrainedWindowGtkDelegate* delegate) : owner_(owner), @@ -26,10 +33,18 @@ ConstrainedWindowGtk::ConstrainedWindowGtk( GtkWidget* ebox = gtk_event_box_new(); GtkWidget* frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); + GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder); + GdkColor background; + if (delegate->GetBackgroundColor(&background)) { + gtk_widget_modify_base(ebox, GTK_STATE_NORMAL, &background); + gtk_widget_modify_fg(ebox, GTK_STATE_NORMAL, &background); + gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, &background); + } + gtk_container_add(GTK_CONTAINER(alignment), dialog); gtk_container_add(GTK_CONTAINER(frame), alignment); gtk_container_add(GTK_CONTAINER(ebox), frame); diff --git a/chrome/browser/gtk/constrained_window_gtk.h b/chrome/browser/gtk/constrained_window_gtk.h index 117fd33..16b4b33 100644 --- a/chrome/browser/gtk/constrained_window_gtk.h +++ b/chrome/browser/gtk/constrained_window_gtk.h @@ -16,6 +16,7 @@ class TabContents; class TabContentsViewGtk; +typedef struct _GdkColor GdkColor; class ConstrainedWindowGtkDelegate { public: @@ -26,8 +27,10 @@ class ConstrainedWindowGtkDelegate { // itself later. virtual void DeleteDelegate() = 0; + virtual bool GetBackgroundColor(GdkColor* color); + protected: - virtual ~ConstrainedWindowGtkDelegate() {} + virtual ~ConstrainedWindowGtkDelegate(); }; // Constrained window implementation for the GTK port. Unlike the Win32 system, diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 59662e3..d5a3f8e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1756,7 +1756,7 @@ 'browser/gtk/clear_browsing_data_dialog_gtk.h', 'browser/gtk/collected_cookies_gtk.cc', 'browser/gtk/collected_cookies_gtk.h', - 'browser/gtk/constrained_html_dialog_gtk.cc', + 'browser/gtk/constrained_html_delegate_gtk.cc', 'browser/gtk/constrained_window_gtk.cc', 'browser/gtk/constrained_window_gtk.h', 'browser/gtk/content_setting_bubble_gtk.cc', |