summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gtk/bookmark_bar_instructions_gtk.cc38
-rw-r--r--chrome/browser/gtk/bookmark_bar_instructions_gtk.h4
2 files changed, 24 insertions, 18 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc b/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
index 3734888..cada10d 100644
--- a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
@@ -36,7 +36,8 @@ void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label) {
BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate,
Profile* profile)
: delegate_(delegate),
- profile_(profile) {
+ profile_(profile),
+ theme_provider_(GtkThemeProvider::GetFrom(profile_)) {
instructions_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, 0);
gtk_widget_set_size_request(instructions_hbox_, 0, -1);
@@ -68,6 +69,7 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate,
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());
+ theme_provider_->InitThemesFor(this);
}
void BookmarkBarInstructionsGtk::Observe(NotificationType type,
@@ -82,29 +84,31 @@ void BookmarkBarInstructionsGtk::OnButtonClick(GtkWidget* button) {
}
void BookmarkBarInstructionsGtk::UpdateColors() {
- const GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(profile_);
- if (!theme_provider)
- return;
-
gtk_chrome_link_button_set_use_gtk_theme(
GTK_CHROME_LINK_BUTTON(instructions_link_),
- theme_provider->UseGtkTheme());
-
- // When using a non-standard, non-gtk theme, we make the link color match
- // the bookmark text color. Otherwise, standard link blue can look very
- // bad for some dark themes.
- if (theme_provider->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT) ==
- BrowserThemeProvider::GetDefaultColor(
- BrowserThemeProvider::COLOR_BOOKMARK_TEXT)) {
+ theme_provider_->UseGtkTheme());
+
+ GdkColor bookmark_color = theme_provider_->GetGdkColor(
+ BrowserThemeProvider::COLOR_BOOKMARK_TEXT);
+ if (theme_provider_->UseGtkTheme()) {
gtk_util::SetLabelColor(instructions_label_, NULL);
gtk_chrome_link_button_set_normal_color(
GTK_CHROME_LINK_BUTTON(instructions_link_), NULL);
} else {
- GdkColor bookmark_color = theme_provider->GetGdkColor(
- BrowserThemeProvider::COLOR_BOOKMARK_TEXT);
gtk_util::SetLabelColor(instructions_label_, &bookmark_color);
- gtk_chrome_link_button_set_normal_color(
- GTK_CHROME_LINK_BUTTON(instructions_link_), &bookmark_color);
+
+ // When using a non-standard, non-gtk theme, we make the link color match
+ // the bookmark text color. Otherwise, standard link blue can look very
+ // bad for some dark themes.
+ if (theme_provider_->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT) ==
+ BrowserThemeProvider::GetDefaultColor(
+ BrowserThemeProvider::COLOR_BOOKMARK_TEXT)) {
+ gtk_chrome_link_button_set_normal_color(
+ GTK_CHROME_LINK_BUTTON(instructions_link_), NULL);
+ } else {
+ gtk_chrome_link_button_set_normal_color(
+ GTK_CHROME_LINK_BUTTON(instructions_link_), &bookmark_color);
+ }
}
}
diff --git a/chrome/browser/gtk/bookmark_bar_instructions_gtk.h b/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
index bb7dc12..ce711e0 100644
--- a/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_instructions_gtk.h
@@ -11,6 +11,7 @@
#include "chrome/common/notification_registrar.h"
typedef struct _GtkWidget GtkWidget;
+class GtkThemeProvider;
class Profile;
class BookmarkBarInstructionsGtk : public NotificationObserver {
@@ -42,9 +43,10 @@ class BookmarkBarInstructionsGtk : public NotificationObserver {
Profile* profile_;
+ GtkThemeProvider* theme_provider_;
+
// HBox that holds the the label and link of bookmark bar import promotion.
GtkWidget* instructions_hbox_;
-
GtkWidget* instructions_label_;
GtkWidget* instructions_link_;