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

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

Issue 8511041: GTK: Use IDR_THEME_WINDOW_CONTROL_BACKGROUND when drawing min/max/close and new tab buttons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: estade nits Created 9 years, 1 month 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/browser_titlebar.h ('k') | chrome/browser/ui/gtk/gtk_theme_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_titlebar.cc
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index ae2b9353b4af99bdddbe6262851a03cad38a3fd2..b15cd62a470885a3f757c2144dfd6680abcd2f3e 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -401,16 +401,15 @@ void BrowserTitlebar::Init() {
gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_title_, TRUE, TRUE,
0);
- // Register with the theme provider to set the |app_mode_title_| label
- // color.
- theme_service_ = GtkThemeService::GetFrom(
- browser_window_->browser()->profile());
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
- content::Source<ThemeService>(theme_service_));
- theme_service_->InitThemesFor(this);
UpdateTitleAndIcon();
}
+ theme_service_ = GtkThemeService::GetFrom(
+ browser_window_->browser()->profile());
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
+ content::Source<ThemeService>(theme_service_));
+ theme_service_->InitThemesFor(this);
+
gtk_widget_show_all(container_);
ui::ActiveWindowWatcherX::AddObserver(this);
@@ -550,6 +549,26 @@ CustomDrawButton* BrowserTitlebar::BuildTitlebarButton(int image,
return button;
}
+void BrowserTitlebar::UpdateButtonBackground(CustomDrawButton* button) {
+ SkColor color = theme_service_->GetColor(
+ ThemeService::COLOR_BUTTON_BACKGROUND);
+ SkBitmap* background =
+ theme_service_->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND);
+
+ // TODO(erg): For now, we just use a completely black mask and we can get
+ // away with this in the short term because our buttons are rectangles. We
+ // should get Glen to make properly hinted masks that match our min/max/close
+ // buttons (which have some odd alpha blending around the
+ // edges). http://crbug.com/103661
+ SkBitmap mask;
+ mask.setConfig(SkBitmap::kARGB_8888_Config,
+ button->SurfaceWidth(), button->SurfaceHeight(), 0);
+ mask.allocPixels();
+ mask.eraseColor(SK_ColorBLACK);
+
+ button->SetBackground(color, background, &mask);
+}
+
void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) {
using_custom_frame_ = use_custom_frame;
if (!use_custom_frame ||
@@ -994,9 +1013,19 @@ void BrowserTitlebar::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
+ case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
UpdateTextColor();
+
+ if (minimize_button_.get())
+ UpdateButtonBackground(minimize_button_.get());
+ if (maximize_button_.get())
+ UpdateButtonBackground(maximize_button_.get());
+ if (restore_button_.get())
+ UpdateButtonBackground(restore_button_.get());
+ if (close_button_.get())
+ UpdateButtonBackground(close_button_.get());
break;
+ }
case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED:
UpdateAvatar();
« no previous file with comments | « chrome/browser/ui/gtk/browser_titlebar.h ('k') | chrome/browser/ui/gtk/gtk_theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698