| 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..f260becd464c2aaea1c26449b8a886ad71eca38d 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);
|
| @@ -535,6 +534,7 @@ CustomDrawButton* BrowserTitlebar::BuildTitlebarButton(int image,
|
| int tooltip) {
|
| CustomDrawButton* button = new CustomDrawButton(image, image_pressed,
|
| image_hot, 0);
|
| +
|
| gtk_widget_add_events(GTK_WIDGET(button->widget()), GDK_POINTER_MOTION_MASK);
|
| g_signal_connect(button->widget(), "clicked",
|
| G_CALLBACK(OnButtonClickedThunk), this);
|
| @@ -550,6 +550,25 @@ 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
|
| + // aways with this in the short term because our buttons are rectangles. We
|
| + // should get Glen to make properly hinted masks that match our
|
| + // masks. 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();
|
|
|