diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 17:36:42 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 17:36:42 +0000 |
commit | a0ea76cbf036408912e337653500aaefd51586b9 (patch) | |
tree | ed1bf3f0a50025df8c2d4b7e083593ded4d2e01a /chrome/browser/ui/gtk | |
parent | 58492209d54a3af3e40fa0a876c9d6381d943188 (diff) | |
download | chromium_src-a0ea76cbf036408912e337653500aaefd51586b9.zip chromium_src-a0ea76cbf036408912e337653500aaefd51586b9.tar.gz chromium_src-a0ea76cbf036408912e337653500aaefd51586b9.tar.bz2 |
Theme system cleanup
- Removes useless dependencies on themeing from content/
- Renames BrowserThemeProvider to ThemeService, along with name variants such
as GtkThemeService. BrowserThemeProvider has grown by a lot to be more than
an implementation of the ui::ThemeProvider interface. This change touches
everything.
- Rename theme_service.{h,cc} (which defined ThemeServiceFactory) to
theme_service_factory.{h,cc}.
BUG=77155
TEST=compiles.
Review URL: http://codereview.chromium.org/6727005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk')
61 files changed, 487 insertions, 488 deletions
diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc index 49909c6..f46f0e1 100644 --- a/chrome/browser/ui/gtk/about_chrome_dialog.cc +++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc @@ -16,7 +16,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_version_info.h" @@ -84,8 +84,8 @@ gboolean OnEventBoxExpose(GtkWidget* event_box, cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(event_box->window)); gdk_cairo_rectangle(cr, &expose->area); cairo_clip(cr); - GtkThemeProvider* theme_provider = - GtkThemeProvider::GetFrom(BrowserList::GetLastActive()->profile()); + GtkThemeService* theme_provider = + GtkThemeService::GetFrom(BrowserList::GetLastActive()->profile()); CairoCachedSurface* background = theme_provider->GetSurfaceNamed( IDR_ABOUT_BACKGROUND_COLOR, event_box); diff --git a/chrome/browser/ui/gtk/back_forward_button_gtk.cc b/chrome/browser/ui/gtk/back_forward_button_gtk.cc index 2810126..c6c1a98 100644 --- a/chrome/browser/ui/gtk/back_forward_button_gtk.cc +++ b/chrome/browser/ui/gtk/back_forward_button_gtk.cc @@ -10,7 +10,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/menu_gtk.h" #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" @@ -43,7 +43,7 @@ BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward) stock = GTK_STOCK_GO_BACK; } button_.reset(new CustomDrawButton( - GtkThemeProvider::GetFrom(browser_->profile()), + GtkThemeService::GetFrom(browser_->profile()), normal, pushed, hover, disabled, stock, GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_widget_set_tooltip_text(widget(), l10n_util::GetStringUTF8(tooltip).c_str()); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index 3fd2105..7fc1286 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -26,7 +26,7 @@ #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/custom_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/hover_controller_gtk.h" #include "chrome/browser/ui/gtk/menu_gtk.h" @@ -133,7 +133,7 @@ BookmarkBarGtk::BookmarkBarGtk(BrowserWindowGtk* window, dragged_node_(NULL), drag_icon_(NULL), toolbar_drop_item_(NULL), - theme_provider_(GtkThemeProvider::GetFrom(profile)), + theme_service_(GtkThemeService::GetFrom(profile)), show_instructions_(true), menu_bar_helper_(this), slide_animation_(this), @@ -204,7 +204,7 @@ void BookmarkBarGtk::Init(Profile* profile) { paint_box_ = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(ntp_padding_box_), paint_box_); GdkColor paint_box_color = - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); + theme_service_->GetGdkColor(ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); gtk_widget_add_events(paint_box_, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK); @@ -240,7 +240,7 @@ void BookmarkBarGtk::Init(Profile* profile) { gtk_box_pack_start(GTK_BOX(bookmark_hbox_), bookmark_toolbar_.get(), TRUE, TRUE, 0); - overflow_button_ = theme_provider_->BuildChromeButton(); + overflow_button_ = theme_service_->BuildChromeButton(); g_object_set_data(G_OBJECT(overflow_button_), "left-align-popup", reinterpret_cast<void*>(true)); SetOverflowButtonAppearance(); @@ -258,13 +258,13 @@ void BookmarkBarGtk::Init(Profile* profile) { g_signal_connect(bookmark_toolbar_.get(), "drag-data-received", G_CALLBACK(&OnDragReceivedThunk), this); - GtkWidget* vseparator = theme_provider_->CreateToolbarSeparator(); + GtkWidget* vseparator = theme_service_->CreateToolbarSeparator(); gtk_box_pack_start(GTK_BOX(bookmark_hbox_), vseparator, FALSE, FALSE, 0); // We pack the button manually (rather than using gtk_button_set_*) so that // we can have finer control over its label. - other_bookmarks_button_ = theme_provider_->BuildChromeButton(); + other_bookmarks_button_ = theme_service_->BuildChromeButton(); ConnectFolderButtonEvents(other_bookmarks_button_, false); GtkWidget* other_padding = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(other_padding), @@ -276,7 +276,7 @@ void BookmarkBarGtk::Init(Profile* profile) { gtk_box_pack_start(GTK_BOX(bookmark_hbox_), other_padding, FALSE, FALSE, 0); - sync_error_button_ = theme_provider_->BuildChromeButton(); + sync_error_button_ = theme_service_->BuildChromeButton(); gtk_button_set_image( GTK_BUTTON(sync_error_button_), gtk_image_new_from_pixbuf( @@ -311,7 +311,7 @@ void BookmarkBarGtk::Show(bool animate) { // Hide out behind the findbar. This is rather fragile code, it could // probably be improved. if (floating_) { - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { if (GTK_WIDGET_REALIZED(event_box_->parent)) gdk_window_lower(event_box_->parent->window); if (GTK_WIDGET_REALIZED(event_box_.get())) @@ -482,7 +482,7 @@ void BookmarkBarGtk::BookmarkNodeChanged(BookmarkModel* model, GtkToolItem* item = gtk_toolbar_get_nth_item( GTK_TOOLBAR(bookmark_toolbar_.get()), index); GtkWidget* button = gtk_bin_get_child(GTK_BIN(item)); - bookmark_utils::ConfigureButtonForNode(node, model, button, theme_provider_); + bookmark_utils::ConfigureButtonForNode(node, model, button, theme_service_); SetChevronState(); } @@ -515,7 +515,7 @@ void BookmarkBarGtk::CreateAllBookmarkButtons() { } bookmark_utils::ConfigureButtonForNode(model_->other_node(), - model_, other_bookmarks_button_, theme_provider_); + model_, other_bookmarks_button_, theme_service_); SetInstructionState(); SetChevronState(); @@ -572,7 +572,7 @@ void BookmarkBarGtk::SetOverflowButtonAppearance() { if (former_child) gtk_widget_destroy(former_child); - GtkWidget* new_child = theme_provider_->UseGtkTheme() ? + GtkWidget* new_child = theme_service_->UseGtkTheme() ? gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE) : gtk_image_new_from_pixbuf(ResourceBundle::GetSharedInstance(). GetRTLEnabledPixbufNamed(IDR_BOOKMARK_BAR_CHEVRONS)); @@ -635,9 +635,9 @@ void BookmarkBarGtk::UpdateFloatingState() { #if !defined(OS_CHROMEOS) gtk_event_box_set_visible_window(GTK_EVENT_BOX(paint_box_), TRUE); #endif - GdkColor stroke_color = theme_provider_->UseGtkTheme() ? - theme_provider_->GetBorderColor() : - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_NTP_HEADER); + GdkColor stroke_color = theme_service_->UseGtkTheme() ? + theme_service_->GetBorderColor() : + theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER); gtk_util::ActAsRoundedWindow(paint_box_, stroke_color, kNTPRoundedness, gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL); @@ -674,14 +674,14 @@ void BookmarkBarGtk::UpdateFloatingState() { void BookmarkBarGtk::UpdateEventBoxPaintability() { gtk_widget_set_app_paintable(event_box_.get(), - !theme_provider_->UseGtkTheme() || floating_); + !theme_service_->UseGtkTheme() || floating_); // When using the GTK+ theme, we need to have the event box be visible so // buttons don't get a halo color from the background. When using Chromium // themes, we want to let the background show through the toolbar. #if !defined(OS_CHROMEOS) gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), - theme_provider_->UseGtkTheme()); + theme_service_->UseGtkTheme()); #endif } @@ -836,13 +836,13 @@ void BookmarkBarGtk::Observe(NotificationType type, UpdateEventBoxPaintability(); GdkColor paint_box_color = - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); + theme_service_->GetGdkColor(ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); if (floating_) { - GdkColor stroke_color = theme_provider_->UseGtkTheme() ? - theme_provider_->GetBorderColor() : - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_NTP_HEADER); + GdkColor stroke_color = theme_service_->UseGtkTheme() ? + theme_service_->GetBorderColor() : + theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER); gtk_util::SetRoundedWindowBorderColor(paint_box_, stroke_color); } @@ -851,8 +851,8 @@ void BookmarkBarGtk::Observe(NotificationType type, } GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { - GtkWidget* button = theme_provider_->BuildChromeButton(); - bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_provider_); + GtkWidget* button = theme_service_->BuildChromeButton(); + bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_service_); // The tool item is also a source for dragging gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, @@ -1040,7 +1040,7 @@ void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button, DCHECK(dragged_node_); drag_icon_ = bookmark_utils::GetDragRepresentationForNode( - node, model_, theme_provider_); + node, model_, theme_service_); // We have to jump through some hoops to get the drag icon to line up because // it is a different size than the button. @@ -1312,7 +1312,7 @@ void BookmarkBarGtk::OnDragReceived(GtkWidget* widget, gboolean BookmarkBarGtk::OnEventBoxExpose(GtkWidget* widget, GdkEventExpose* event) { - GtkThemeProvider* theme_provider = theme_provider_; + GtkThemeService* theme_provider = theme_service_; // We don't need to render the toolbar image in GTK mode, except when // detached. diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h index 7a74c79..a4c2b36 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h @@ -32,7 +32,7 @@ class BookmarkMenuController; class Browser; class BrowserWindowGtk; class CustomContainerButton; -class GtkThemeProvider; +class GtkThemeService; class MenuGtk; class PageNavigator; class Profile; @@ -361,7 +361,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate, GtkToolItem* toolbar_drop_item_; // Theme provider for building buttons. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // Whether we should show the instructional text in the bookmark bar. bool show_instructions_; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc index 9d231f1..b763d5f 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc @@ -7,7 +7,7 @@ #include "base/observer_list.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -17,7 +17,7 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, Profile* profile) : delegate_(delegate), profile_(profile), - theme_provider_(GtkThemeProvider::GetFrom(profile_)) { + theme_service_(GtkThemeService::GetFrom(profile_)) { instructions_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, 0); gtk_widget_set_size_request(instructions_hbox_, 0, -1); @@ -49,7 +49,7 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } void BookmarkBarInstructionsGtk::Observe(NotificationType type, @@ -66,11 +66,11 @@ void BookmarkBarInstructionsGtk::OnButtonClick(GtkWidget* button) { void BookmarkBarInstructionsGtk::UpdateColors() { gtk_chrome_link_button_set_use_gtk_theme( GTK_CHROME_LINK_BUTTON(instructions_link_), - theme_provider_->UseGtkTheme()); + theme_service_->UseGtkTheme()); - GdkColor bookmark_color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); - if (theme_provider_->UseGtkTheme()) { + GdkColor bookmark_color = theme_service_->GetGdkColor( + ThemeService::COLOR_BOOKMARK_TEXT); + if (theme_service_->UseGtkTheme()) { gtk_util::SetLabelColor(instructions_label_, NULL); gtk_chrome_link_button_set_normal_color( GTK_CHROME_LINK_BUTTON(instructions_link_), NULL); @@ -80,9 +80,9 @@ void BookmarkBarInstructionsGtk::UpdateColors() { // 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)) { + if (theme_service_->GetColor(ThemeService::COLOR_BOOKMARK_TEXT) == + ThemeService::GetDefaultColor( + ThemeService::COLOR_BOOKMARK_TEXT)) { gtk_chrome_link_button_set_normal_color( GTK_CHROME_LINK_BUTTON(instructions_link_), NULL); } else { diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h index ffb484c..509e8fd 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h @@ -12,7 +12,7 @@ #include "ui/base/gtk/gtk_signal.h" typedef struct _GtkWidget GtkWidget; -class GtkThemeProvider; +class GtkThemeService; class Profile; class BookmarkBarInstructionsGtk : public NotificationObserver { @@ -47,7 +47,7 @@ class BookmarkBarInstructionsGtk : public NotificationObserver { Profile* profile_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // HBox that holds the the label and link of bookmark bar import promotion. GtkWidget* instructions_hbox_; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc index d285c1d..4248f43 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc @@ -19,7 +19,7 @@ #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/info_bubble_gtk.h" #include "content/common/notification_service.h" @@ -67,9 +67,9 @@ void BookmarkBubbleGtk::Observe(NotificationType type, gtk_chrome_link_button_set_use_gtk_theme( GTK_CHROME_LINK_BUTTON(remove_button_), - theme_provider_->UseGtkTheme()); + theme_service_->UseGtkTheme()); - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { for (std::vector<GtkWidget*>::iterator it = labels_.begin(); it != labels_.end(); ++it) { gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, NULL); @@ -88,7 +88,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, bool newly_bookmarked) : url_(url), profile_(profile), - theme_provider_(GtkThemeProvider::GetFrom(profile_)), + theme_service_(GtkThemeService::GetFrom(profile_)), anchor_(anchor), content_(NULL), name_entry_(NULL), @@ -166,7 +166,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, arrow_location, true, // match_system_theme true, // grab_input - theme_provider_, + theme_service_, this); // delegate if (!bubble_) { NOTREACHED(); @@ -190,7 +190,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } BookmarkBubbleGtk::~BookmarkBubbleGtk() { diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h index 5f31d85..6b99ff2 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h @@ -86,7 +86,7 @@ class BookmarkBubbleGtk : public InfoBubbleGtkDelegate, Profile* profile_; // Provides colors and stuff. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The widget relative to which we are positioned. GtkWidget* anchor_; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc index cab8b1d..2d39eac 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc @@ -17,7 +17,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" @@ -482,7 +482,7 @@ void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { gtk_tree_store_append(tree_store_, child, parent); gtk_tree_store_set( tree_store_, child, - bookmark_utils::FOLDER_ICON, GtkThemeProvider::GetFolderIcon(true), + bookmark_utils::FOLDER_ICON, GtkThemeService::GetFolderIcon(true), bookmark_utils::FOLDER_NAME, l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME).c_str(), bookmark_utils::ITEM_ID, static_cast<int64>(0), diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc index 5af40b2..63140f1 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc @@ -13,7 +13,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/menu_gtk.h" #include "content/browser/tab_contents/page_navigator.h" @@ -348,7 +348,7 @@ void BookmarkMenuController::OnMenuItemDragBegin(GtkWidget* menu_item, const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(menu_item); drag_icon_ = bookmark_utils::GetDragRepresentationForNode( - node, model_, GtkThemeProvider::GetFrom(profile_)); + node, model_, GtkThemeService::GetFrom(profile_)); gint x, y; gtk_widget_get_pointer(menu_item, &x, &y); gtk_drag_set_icon_widget(drag_context, drag_icon_, x, y); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.cc index 0589f28..cc2284f 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.cc @@ -10,7 +10,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" namespace { @@ -25,7 +25,7 @@ void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, // (and indeed, Nautilus does not render an expanded directory any // differently). gtk_tree_store_set(store, iter, - bookmark_utils::FOLDER_ICON, GtkThemeProvider::GetFolderIcon(true), + bookmark_utils::FOLDER_ICON, GtkThemeService::GetFolderIcon(true), bookmark_utils::FOLDER_NAME, UTF16ToUTF8(node->GetTitle()).c_str(), bookmark_utils::ITEM_ID, node->id(), diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc index ae6f3da..961e7f1 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc @@ -13,7 +13,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/l10n/l10n_util.h" @@ -51,7 +51,7 @@ void* AsVoid(const BookmarkNode* node) { // Creates the widget hierarchy for a bookmark button. void PackButton(GdkPixbuf* pixbuf, const string16& title, bool ellipsize, - GtkThemeProvider* provider, GtkWidget* button) { + GtkThemeService* provider, GtkWidget* button) { GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(button)); if (former_child) gtk_container_remove(GTK_CONTAINER(button), former_child); @@ -165,11 +165,11 @@ GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, if (model->GetFavicon(node).width() != 0) { pixbuf = gfx::GdkPixbufFromSkBitmap(&model->GetFavicon(node)); } else { - pixbuf = GtkThemeProvider::GetDefaultFavicon(native); + pixbuf = GtkThemeService::GetDefaultFavicon(native); g_object_ref(pixbuf); } } else { - pixbuf = GtkThemeProvider::GetFolderIcon(native); + pixbuf = GtkThemeService::GetFolderIcon(native); g_object_ref(pixbuf); } @@ -178,14 +178,14 @@ GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, const string16& title, - GtkThemeProvider* provider) { + GtkThemeService* provider) { GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); if (gtk_util::IsScreenComposited() && gtk_util::AddWindowAlphaChannel(window)) { DragRepresentationData* data = new DragRepresentationData( pixbuf, title, - provider->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); + provider->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); g_signal_connect(window, "expose-event", G_CALLBACK(OnDragIconExpose), data); g_object_ref(window); @@ -198,7 +198,7 @@ GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, } else { if (!provider->UseGtkTheme()) { GdkColor color = provider->GetGdkColor( - BrowserThemeProvider::COLOR_TOOLBAR); + ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color); } gtk_widget_realize(window); @@ -218,7 +218,7 @@ GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, BookmarkModel* model, - GtkThemeProvider* provider) { + GtkThemeService* provider) { GdkPixbuf* pixbuf = GetPixbufForNode(node, model, provider->UseGtkTheme()); GtkWidget* widget = GetDragRepresentation(pixbuf, node->GetTitle(), provider); g_object_unref(pixbuf); @@ -226,7 +226,7 @@ GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, } void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, - GtkWidget* button, GtkThemeProvider* provider) { + GtkWidget* button, GtkThemeService* provider) { GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model, provider->UseGtkTheme()); PackButton(pixbuf, node->GetTitle(), node != model->other_node(), provider, @@ -278,12 +278,12 @@ const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget) { g_object_get_data(G_OBJECT(widget), bookmark_utils::kBookmarkNode)); } -void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider) { +void SetButtonTextColors(GtkWidget* label, GtkThemeService* provider) { if (provider->UseGtkTheme()) { gtk_util::SetLabelColor(label, NULL); } else { GdkColor color = provider->GetGdkColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + ThemeService::COLOR_BOOKMARK_TEXT); gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &color); gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &color); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h index 49e10a0..14efe65 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h @@ -14,7 +14,7 @@ class BookmarkModel; class BookmarkNode; -class GtkThemeProvider; +class GtkThemeService; class Profile; typedef struct _GdkDragContext GdkDragContext; @@ -35,15 +35,15 @@ GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, // gtk_drag_set_icon_widget(). GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, const string16& title, - GtkThemeProvider* provider); + GtkThemeService* provider); GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, BookmarkModel* model, - GtkThemeProvider* provider); + GtkThemeService* provider); // Helper function that sets visual properties of GtkButton |button| to the // contents of |node|. void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, - GtkWidget* button, GtkThemeProvider* provider); + GtkWidget* button, GtkThemeService* provider); // Returns the tooltip. std::string BuildTooltipFor(const BookmarkNode* node); @@ -52,7 +52,7 @@ std::string BuildTooltipFor(const BookmarkNode* node); const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); // Set the colors on |label| as per the theme. -void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider); +void SetButtonTextColors(GtkWidget* label, GtkThemeService* provider); // Drag and drop. -------------------------------------------------------------- diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index 0f36121..511dee1 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -19,7 +19,7 @@ #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/hover_controller_gtk.h" #include "chrome/browser/ui/gtk/menu_gtk.h" @@ -85,7 +85,7 @@ class BrowserActionButton : public NotificationObserver, public: BrowserActionButton(BrowserActionsToolbarGtk* toolbar, const Extension* extension, - GtkThemeProvider* theme_provider) + GtkThemeService* theme_provider) : toolbar_(toolbar), extension_(extension), image_(NULL), @@ -364,7 +364,7 @@ class BrowserActionButton : public NotificationObserver, BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) : browser_(browser), profile_(browser->profile()), - theme_provider_(GtkThemeProvider::GetFrom(browser->profile())), + theme_service_(GtkThemeService::GetFrom(browser->profile())), model_(NULL), hbox_(gtk_hbox_new(FALSE, 0)), button_hbox_(gtk_chrome_shrinkable_hbox_new(TRUE, FALSE, kButtonPadding)), @@ -380,7 +380,7 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) return; overflow_button_.reset(new CustomDrawButton( - theme_provider_, + theme_service_, IDR_BROWSER_ACTIONS_OVERFLOW, IDR_BROWSER_ACTIONS_OVERFLOW_P, IDR_BROWSER_ACTIONS_OVERFLOW_H, @@ -448,7 +448,7 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } BrowserActionsToolbarGtk::~BrowserActionsToolbarGtk() { @@ -477,7 +477,7 @@ void BrowserActionsToolbarGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); - if (theme_provider_->UseGtkTheme()) + if (theme_service_->UseGtkTheme()) gtk_widget_show(separator_); else gtk_widget_hide(separator_); @@ -518,7 +518,7 @@ void BrowserActionsToolbarGtk::CreateButtonForExtension( RemoveButtonForExtension(extension); linked_ptr<BrowserActionButton> button( - new BrowserActionButton(this, extension, theme_provider_)); + new BrowserActionButton(this, extension, theme_service_)); gtk_chrome_shrinkable_hbox_pack_start( GTK_CHROME_SHRINKABLE_HBOX(button_hbox_.get()), button->widget(), 0); gtk_box_reorder_child(GTK_BOX(button_hbox_.get()), button->widget(), index); diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h index 3e1db05..dfdc191 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h @@ -27,7 +27,7 @@ class Browser; class BrowserActionButton; class Extension; -class GtkThemeProvider; +class GtkThemeService; class Profile; typedef struct _GdkDragContext GdkDragContext; @@ -170,7 +170,7 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, Browser* browser_; Profile* profile_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; ExtensionToolbarModel* model_; diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index 130961e..32c048a 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -25,7 +25,7 @@ #if defined(USE_GCONF) #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" #endif -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/menu_gtk.h" #include "chrome/browser/ui/gtk/nine_box.h" @@ -214,7 +214,7 @@ BrowserTitlebar::BrowserTitlebar(BrowserWindowGtk* browser_window, app_mode_title_(NULL), using_custom_frame_(false), window_has_focus_(false), - theme_provider_(NULL) { + theme_service_(NULL) { Init(); } @@ -357,11 +357,11 @@ void BrowserTitlebar::Init() { // Register with the theme provider to set the |app_mode_title_| label // color. - theme_provider_ = GtkThemeProvider::GetFrom( + theme_service_ = GtkThemeService::GetFrom( browser_window_->browser()->profile()); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); UpdateTitleAndIcon(); } @@ -671,7 +671,7 @@ void BrowserTitlebar::UpdateTextColor() { if (!app_mode_title_) return; - if (theme_provider_ && theme_provider_->UseGtkTheme()) { + if (theme_service_ && theme_service_->UseGtkTheme()) { // We don't really have any good options here. // // Colors from window manager themes aren't exposed in GTK; the window @@ -687,11 +687,11 @@ void BrowserTitlebar::UpdateTextColor() { // color. GdkColor frame_color; if (window_has_focus_) { - frame_color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_FRAME); + frame_color = theme_service_->GetGdkColor( + ThemeService::COLOR_FRAME); } else { - frame_color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_FRAME_INACTIVE); + frame_color = theme_service_->GetGdkColor( + ThemeService::COLOR_FRAME_INACTIVE); } GdkColor text_color = PickLuminosityContrastingColor( &frame_color, >k_util::kGdkWhite, >k_util::kGdkBlack); diff --git a/chrome/browser/ui/gtk/browser_titlebar.h b/chrome/browser/ui/gtk/browser_titlebar.h index c4f4603..72a01b7 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.h +++ b/chrome/browser/ui/gtk/browser_titlebar.h @@ -22,7 +22,7 @@ class BrowserWindowGtk; class CustomDrawButton; -class GtkThemeProvider; +class GtkThemeService; class MenuGtk; class PopupPageMenuModel; class TabContents; @@ -231,7 +231,7 @@ class BrowserTitlebar : public NotificationObserver, Throbber throbber_; // Theme provider for building buttons. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; NotificationRegistrar registrar_; }; diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index f5c1735..4c057b0 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -19,7 +19,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/themes/browser_theme_provider.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/accelerators_gtk.h" #include "chrome/browser/ui/gtk/back_forward_button_gtk.h" @@ -28,7 +28,7 @@ #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/custom_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" #include "chrome/browser/ui/gtk/reload_button_gtk.h" @@ -119,7 +119,7 @@ void BrowserToolbarGtk::Init(Profile* profile, // Make sure to tell the location bar the profile before calling its Init. SetProfile(profile); - theme_provider_ = GtkThemeProvider::GetFrom(profile); + theme_service_ = GtkThemeService::GetFrom(profile); offscreen_entry_.Own(gtk_entry_new()); show_home_button_.Init(prefs::kShowHomeButton, profile->GetPrefs(), this); @@ -130,7 +130,7 @@ void BrowserToolbarGtk::Init(Profile* profile, event_box_ = gtk_event_box_new(); // Make the event box transparent so themes can use transparent toolbar // backgrounds. - if (!theme_provider_->UseGtkTheme()) + if (!theme_service_->UseGtkTheme()) gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_), FALSE); toolbar_ = gtk_hbox_new(FALSE, 0); @@ -159,7 +159,7 @@ void BrowserToolbarGtk::Init(Profile* profile, gtk_box_pack_start(GTK_BOX(toolbar_left_), reload_->widget(), FALSE, FALSE, 0); - home_.reset(new CustomDrawButton(GtkThemeProvider::GetFrom(profile_), + home_.reset(new CustomDrawButton(GtkThemeService::GetFrom(profile_), IDR_HOME, IDR_HOME_P, IDR_HOME_H, 0, GTK_STOCK_HOME, GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_widget_set_tooltip_text(home_->widget(), @@ -190,9 +190,9 @@ void BrowserToolbarGtk::Init(Profile* profile, } wrench_menu_image_ = gtk_image_new_from_pixbuf( - theme_provider_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); + theme_service_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); wrench_menu_button_.reset(new CustomDrawButton( - GtkThemeProvider::GetFrom(profile_), + GtkThemeService::GetFrom(profile_), IDR_TOOLS, IDR_TOOLS_P, IDR_TOOLS_H, 0, wrench_menu_image_)); GtkWidget* wrench_button = wrench_menu_button_->widget(); @@ -236,7 +236,7 @@ void BrowserToolbarGtk::Init(Profile* profile, location_bar_->UpdateContentSettingsIcons(); SetViewIDs(); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } void BrowserToolbarGtk::SetViewIDs() { @@ -315,7 +315,7 @@ void BrowserToolbarGtk::StoppedShowing() { } GtkIconSet* BrowserToolbarGtk::GetIconSetForId(int idr) { - return theme_provider_->GetIconSetForId(idr); + return theme_service_->GetIconSetForId(idr); } // Always show images because we desire that some icons always show @@ -345,7 +345,7 @@ void BrowserToolbarGtk::Observe(NotificationType type, NotifyPrefChanged(Details<std::string>(details).ptr()); } else if (type == NotificationType::BROWSER_THEME_CHANGED) { // Update the spacing around the menu buttons - bool use_gtk = theme_provider_->UseGtkTheme(); + bool use_gtk = theme_service_->UseGtkTheme(); int border = use_gtk ? 0 : 2; gtk_container_set_border_width( GTK_CONTAINER(wrench_menu_button_->widget()), border); @@ -372,7 +372,7 @@ void BrowserToolbarGtk::Observe(NotificationType type, // we set the initial value in Init()). gtk_image_set_from_pixbuf( GTK_IMAGE(wrench_menu_image_), - theme_provider_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); + theme_service_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); } UpdateRoundedness(); @@ -428,7 +428,7 @@ bool BrowserToolbarGtk::UpdateRoundedness() { // We still round the corners if we are in chrome theme mode, but we do it by // drawing theme resources rather than changing the physical shape of the // widget. - bool should_be_rounded = theme_provider_->UseGtkTheme() && + bool should_be_rounded = theme_service_->UseGtkTheme() && window_->ShouldDrawContentDropShadow(); if (should_be_rounded == gtk_util::IsActingAsRoundedWindow(alignment_)) @@ -453,7 +453,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, return TRUE; // We don't need to render the toolbar image in GTK mode. - if (theme_provider_->UseGtkTheme()) + if (theme_service_->UseGtkTheme()) return FALSE; cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); @@ -463,8 +463,8 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, gfx::Point tabstrip_origin = window_->tabstrip()->GetTabStripOriginForWidget(widget); // Fill the entire region with the toolbar color. - GdkColor color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_TOOLBAR); + GdkColor color = theme_service_->GetGdkColor( + ThemeService::COLOR_TOOLBAR); gdk_cairo_set_source_color(cr, &color); cairo_fill(cr); @@ -490,7 +490,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, area = area.Subtract(right).Subtract(left); } - CairoCachedSurface* background = theme_provider_->GetSurfaceNamed( + CairoCachedSurface* background = theme_service_->GetSurfaceNamed( IDR_THEME_TOOLBAR, widget); background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); @@ -517,13 +517,13 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, cairo_set_operator(copy_cr, CAIRO_OPERATOR_SOURCE); if (draw_left_corner) { - CairoCachedSurface* left_corner = theme_provider_->GetSurfaceNamed( + CairoCachedSurface* left_corner = theme_service_->GetSurfaceNamed( IDR_CONTENT_TOP_LEFT_CORNER_MASK, widget); left_corner->SetSource(copy_cr, left.x(), left.y()); cairo_paint(copy_cr); } if (draw_right_corner) { - CairoCachedSurface* right_corner = theme_provider_->GetSurfaceNamed( + CairoCachedSurface* right_corner = theme_service_->GetSurfaceNamed( IDR_CONTENT_TOP_RIGHT_CORNER_MASK, widget); right_corner->SetSource(copy_cr, right.x(), right.y()); // We fill a path rather than just painting because we don't want to @@ -554,7 +554,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, gboolean BrowserToolbarGtk::OnLocationHboxExpose(GtkWidget* location_hbox, GdkEventExpose* e) { - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), location_hbox, &e->area, &location_hbox->allocation); @@ -629,7 +629,7 @@ gboolean BrowserToolbarGtk::OnWrenchMenuButtonExpose(GtkWidget* sender, GdkEventExpose* expose) { const SkBitmap* badge = NULL; if (UpgradeDetector::GetInstance()->notify_upgrade()) { - badge = theme_provider_->GetBitmapNamed(IDR_UPDATE_BADGE); + badge = theme_service_->GetBitmapNamed(IDR_UPDATE_BADGE); } else { return FALSE; } diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_toolbar_gtk.h index ff7ec88..4cae34e 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.h @@ -28,7 +28,7 @@ class Browser; class BrowserActionsToolbarGtk; class BrowserWindowGtk; class CustomDrawButton; -class GtkThemeProvider; +class GtkThemeService; class LocationBar; class LocationBarViewGtk; class Profile; @@ -186,7 +186,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, // The model that contains the security level, text, icon to display... ToolbarModel* model_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; scoped_ptr<MenuGtk> wrench_menu_; diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index e04a5ea..f546e5f 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -31,7 +31,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model.h" -#include "chrome/browser/themes/browser_theme_provider.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" @@ -51,7 +51,7 @@ #include "chrome/browser/ui/gtk/find_bar_gtk.h" #include "chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h" #include "chrome/browser/ui/gtk/gtk_floating_container.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/info_bubble_gtk.h" #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" @@ -360,7 +360,7 @@ gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget, void BrowserWindowGtk::DrawContentShadow(cairo_t* cr) { // Draw the shadow above the toolbar. Tabs on the tabstrip will draw over us. - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( + GtkThemeService* theme_provider = GtkThemeService::GetFrom( browser()->profile()); int left_x, top_y; gtk_widget_translate_coordinates(toolbar_->widget(), @@ -487,7 +487,7 @@ void BrowserWindowGtk::DrawContentShadow(cairo_t* cr) { void BrowserWindowGtk::DrawPopupFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event) { - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( + GtkThemeService* theme_provider = GtkThemeService::GetFrom( browser()->profile()); // Like DrawCustomFrame(), except that we use the unthemed resources to draw @@ -507,7 +507,7 @@ void BrowserWindowGtk::DrawPopupFrame(cairo_t* cr, void BrowserWindowGtk::DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event) { - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( + GtkThemeService* theme_provider = GtkThemeService::GetFrom( browser()->profile()); int image_name = GetThemeFrameResource(); @@ -1647,18 +1647,18 @@ void BrowserWindowGtk::InitWidgets() { void BrowserWindowGtk::SetBackgroundColor() { Profile* profile = browser()->profile(); - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(profile); + GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile); int frame_color_id; if (UsingCustomPopupFrame()) { - frame_color_id = BrowserThemeProvider::COLOR_TOOLBAR; + frame_color_id = ThemeService::COLOR_TOOLBAR; } else if (IsActive()) { frame_color_id = browser()->profile()->IsOffTheRecord() - ? BrowserThemeProvider::COLOR_FRAME_INCOGNITO - : BrowserThemeProvider::COLOR_FRAME; + ? ThemeService::COLOR_FRAME_INCOGNITO + : ThemeService::COLOR_FRAME; } else { frame_color_id = browser()->profile()->IsOffTheRecord() - ? BrowserThemeProvider::COLOR_FRAME_INCOGNITO_INACTIVE - : BrowserThemeProvider::COLOR_FRAME_INACTIVE; + ? ThemeService::COLOR_FRAME_INCOGNITO_INACTIVE + : ThemeService::COLOR_FRAME_INACTIVE; } SkColor frame_color = theme_provider->GetColor(frame_color_id); @@ -1844,7 +1844,7 @@ gboolean BrowserWindowGtk::OnExposeDrawInfobarBits(GtkWidget* sender, Profile* profile = browser()->profile(); infobar_arrow_model_.Paint( sender, expose, bounds, - GtkThemeProvider::GetFrom(profile)->GetBorderColor()); + GtkThemeService::GetFrom(profile)->GetBorderColor()); return FALSE; } @@ -2148,7 +2148,7 @@ bool BrowserWindowGtk::IsBookmarkBarSupported() const { } bool BrowserWindowGtk::UsingCustomPopupFrame() const { - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( + GtkThemeService* theme_provider = GtkThemeService::GetFrom( browser()->profile()); return !theme_provider->UseGtkTheme() && browser()->type() & Browser::TYPE_POPUP; diff --git a/chrome/browser/ui/gtk/cairo_cached_surface.h b/chrome/browser/ui/gtk/cairo_cached_surface.h index da7fe67..8894ee1 100644 --- a/chrome/browser/ui/gtk/cairo_cached_surface.h +++ b/chrome/browser/ui/gtk/cairo_cached_surface.h @@ -16,10 +16,10 @@ typedef struct _cairo_surface cairo_surface_t; // once. From then on, that cached version is used so we don't upload the same // image each and every time we expose. // -// Most cached surfaces are owned by the GtkThemeProvider, which associates +// Most cached surfaces are owned by the GtkThemeService, which associates // them with a certain XDisplay. Some users of surfaces (CustomDrawButtonBase, // for example) own their surfaces instead since they interact with the -// ResourceBundle instead of the GtkThemeProvider. +// ResourceBundle instead of the GtkThemeService. class CairoCachedSurface { public: CairoCachedSurface(); diff --git a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc index 9fe4ef1..c26e345 100644 --- a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc @@ -15,7 +15,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/common/content_settings.h" #include "content/browser/tab_contents/tab_contents.h" @@ -87,7 +87,7 @@ void ContentSettingBubbleGtk::Observe(NotificationType type, } void ContentSettingBubbleGtk::BuildBubble() { - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(profile_); + GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc index 28f3713..4bdd1e8 100644 --- a/chrome/browser/ui/gtk/custom_button.cc +++ b/chrome/browser/ui/gtk/custom_button.cc @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "content/common/notification_service.h" #include "grit/theme_resources.h" @@ -16,7 +16,7 @@ #include "ui/gfx/gtk_util.h" #include "ui/gfx/skbitmap_operations.h" -CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeProvider* theme_provider, +CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -27,7 +27,7 @@ CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeProvider* theme_provider, pressed_id_(pressed_id), hover_id_(hover_id), disabled_id_(disabled_id), - theme_provider_(theme_provider), + theme_service_(theme_provider), flipped_(false) { for (int i = 0; i < (GTK_STATE_INSENSITIVE + 1); ++i) surfaces_[i].reset(new CairoCachedSurface); @@ -142,18 +142,18 @@ void CustomDrawButtonBase::SetBackground(SkColor color, void CustomDrawButtonBase::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(theme_provider_); + DCHECK(theme_service_); DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); surfaces_[GTK_STATE_NORMAL]->UsePixbuf(normal_id_ ? - theme_provider_->GetRTLEnabledPixbufNamed(normal_id_) : NULL); + theme_service_->GetRTLEnabledPixbufNamed(normal_id_) : NULL); surfaces_[GTK_STATE_ACTIVE]->UsePixbuf(pressed_id_ ? - theme_provider_->GetRTLEnabledPixbufNamed(pressed_id_) : NULL); + theme_service_->GetRTLEnabledPixbufNamed(pressed_id_) : NULL); surfaces_[GTK_STATE_PRELIGHT]->UsePixbuf(hover_id_ ? - theme_provider_->GetRTLEnabledPixbufNamed(hover_id_) : NULL); + theme_service_->GetRTLEnabledPixbufNamed(hover_id_) : NULL); surfaces_[GTK_STATE_SELECTED]->UsePixbuf(NULL); surfaces_[GTK_STATE_INSENSITIVE]->UsePixbuf(disabled_id_ ? - theme_provider_->GetRTLEnabledPixbufNamed(disabled_id_) : NULL); + theme_service_->GetRTLEnabledPixbufNamed(disabled_id_) : NULL); } CairoCachedSurface* CustomDrawButtonBase::PixbufForState(int state) { @@ -221,14 +221,14 @@ CustomDrawButton::CustomDrawButton(int normal_id, int hover_id, int disabled_id) : button_base_(NULL, normal_id, pressed_id, hover_id, disabled_id), - theme_provider_(NULL) { + theme_service_(NULL) { Init(); // Initialize the theme stuff with no theme_provider. SetBrowserTheme(); } -CustomDrawButton::CustomDrawButton(GtkThemeProvider* theme_provider, +CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -237,18 +237,18 @@ CustomDrawButton::CustomDrawButton(GtkThemeProvider* theme_provider, GtkIconSize stock_size) : button_base_(theme_provider, normal_id, pressed_id, hover_id, disabled_id), - theme_provider_(theme_provider) { + theme_service_(theme_provider) { native_widget_.Own(gtk_image_new_from_stock(stock_id, stock_size)); Init(); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); } -CustomDrawButton::CustomDrawButton(GtkThemeProvider* theme_provider, +CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -257,10 +257,10 @@ CustomDrawButton::CustomDrawButton(GtkThemeProvider* theme_provider, : button_base_(theme_provider, normal_id, pressed_id, hover_id, disabled_id), native_widget_(native_widget), - theme_provider_(theme_provider) { + theme_service_(theme_provider) { Init(); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); @@ -315,7 +315,7 @@ gboolean CustomDrawButton::OnCustomExpose(GtkWidget* sender, // static CustomDrawButton* CustomDrawButton::CloseButton( - GtkThemeProvider* theme_provider) { + GtkThemeService* theme_provider) { CustomDrawButton* button = new CustomDrawButton(theme_provider, IDR_CLOSE_BAR, IDR_CLOSE_BAR_P, IDR_CLOSE_BAR_H, 0, GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); return button; @@ -341,5 +341,5 @@ void CustomDrawButton::SetBrowserTheme() { } bool CustomDrawButton::UseGtkTheme() { - return theme_provider_ && theme_provider_->UseGtkTheme(); + return theme_service_ && theme_service_->UseGtkTheme(); } diff --git a/chrome/browser/ui/gtk/custom_button.h b/chrome/browser/ui/gtk/custom_button.h index 64b3a65..c18c7ed 100644 --- a/chrome/browser/ui/gtk/custom_button.h +++ b/chrome/browser/ui/gtk/custom_button.h @@ -19,7 +19,7 @@ #include "ui/gfx/rect.h" class CairoCachedSurface; -class GtkThemeProvider; +class GtkThemeService; class SkBitmap; // These classes implement two kinds of custom-drawn buttons. They're @@ -32,7 +32,7 @@ class CustomDrawButtonBase : public NotificationObserver { public: // If the images come from ResourceBundle rather than the theme provider, // pass in NULL for |theme_provider|. - CustomDrawButtonBase(GtkThemeProvider* theme_provider, + CustomDrawButtonBase(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -81,7 +81,7 @@ class CustomDrawButtonBase : public NotificationObserver { int pressed_id_; int hover_id_; int disabled_id_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // Whether the button is flipped horizontally. Not used for RTL (we get // flipped versions from the theme provider). Used for the flipped window @@ -137,7 +137,7 @@ class CustomDrawButton : public NotificationObserver { // Same as above, but uses themed (and possibly tinted) images. |stock_id| and // |stock_size| are used for GTK+ theme mode. - CustomDrawButton(GtkThemeProvider* theme_provider, + CustomDrawButton(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -147,7 +147,7 @@ class CustomDrawButton : public NotificationObserver { // As above, but uses an arbitrary GtkImage rather than a stock icon. This // constructor takes ownership of |native_widget|. - CustomDrawButton(GtkThemeProvider* theme_provider, + CustomDrawButton(GtkThemeService* theme_provider, int normal_id, int pressed_id, int hover_id, @@ -191,7 +191,7 @@ class CustomDrawButton : public NotificationObserver { // Returns a standard close button. Pass a |theme_provider| to use Gtk icons // in Gtk rendering mode. - static CustomDrawButton* CloseButton(GtkThemeProvider* theme_provider); + static CustomDrawButton* CloseButton(GtkThemeService* theme_provider); private: // Sets the button to themed or not. @@ -216,7 +216,7 @@ class CustomDrawButton : public NotificationObserver { OwnedWidgetGtk native_widget_; // Our theme provider. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // Used to listen for theme change notifications. NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/gtk/download_item_gtk.cc b/chrome/browser/ui/gtk/download_item_gtk.cc index b4a5484..1c0449b 100644 --- a/chrome/browser/ui/gtk/download_item_gtk.cc +++ b/chrome/browser/ui/gtk/download_item_gtk.cc @@ -19,7 +19,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/custom_drag.h" #include "chrome/browser/ui/gtk/download_shelf_gtk.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/menu_gtk.h" #include "chrome/browser/ui/gtk/nine_box.h" @@ -167,7 +167,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, : parent_shelf_(parent_shelf), arrow_(NULL), menu_showing_(false), - theme_provider_(GtkThemeProvider::GetFrom( + theme_service_(GtkThemeService::GetFrom( parent_shelf->browser()->profile())), progress_angle_(download_util::kStartAngleDegrees), download_model_(download_model), @@ -320,7 +320,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); // Set the initial width of the widget to be animated. if (IsDangerous()) { @@ -448,7 +448,7 @@ void DownloadItemGtk::Observe(NotificationType type, if (type == NotificationType::BROWSER_THEME_CHANGED) { // Our GtkArrow is only visible in gtk mode. Otherwise, we let the custom // rendering code do whatever it wants. - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { if (!arrow_) { arrow_ = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); gtk_widget_set_size_request(arrow_, @@ -546,9 +546,9 @@ void DownloadItemGtk::UpdateNameLabel() { get_download()->GetFileNameToReportUser(), gfx::Font(), kTextWidth); - GdkColor color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); - gtk_util::SetLabelColor(name_label_, theme_provider_->UseGtkTheme() ? + GdkColor color = theme_service_->GetGdkColor( + ThemeService::COLOR_BOOKMARK_TEXT); + gtk_util::SetLabelColor(name_label_, theme_service_->UseGtkTheme() ? NULL : &color); gtk_label_set_text(GTK_LABEL(name_label_), UTF16ToUTF8(elided_filename).c_str()); @@ -559,9 +559,9 @@ void DownloadItemGtk::UpdateStatusLabel(const std::string& status_text) { return; GdkColor text_color; - if (!theme_provider_->UseGtkTheme()) { - SkColor color = theme_provider_->GetColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + if (!theme_service_->UseGtkTheme()) { + SkColor color = theme_service_->GetColor( + ThemeService::COLOR_BOOKMARK_TEXT); if (color_utils::RelativeLuminance(color) > 0.5) { color = SkColorSetRGB( static_cast<int>(kDownloadItemLuminanceMod * @@ -579,7 +579,7 @@ void DownloadItemGtk::UpdateStatusLabel(const std::string& status_text) { color_utils::AlphaBlend(blend_color, color, 77)); } - gtk_util::SetLabelColor(status_label_, theme_provider_->UseGtkTheme() ? + gtk_util::SetLabelColor(status_label_, theme_service_->UseGtkTheme() ? NULL : &text_color); gtk_label_set_text(GTK_LABEL(status_label_), status_text.c_str()); } @@ -612,11 +612,11 @@ void DownloadItemGtk::UpdateDangerWarning() { } } - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { gtk_util::SetLabelColor(dangerous_label_, NULL); } else { - GdkColor color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + GdkColor color = theme_service_->GetGdkColor( + ThemeService::COLOR_BOOKMARK_TEXT); gtk_util::SetLabelColor(dangerous_label_, &color); } @@ -647,7 +647,7 @@ void DownloadItemGtk::UpdateDangerWarning() { } void DownloadItemGtk::UpdateDangerIcon() { - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { const char* stock = get_download()->danger_type() == DownloadItem::DANGEROUS_URL ? GTK_STOCK_DIALOG_ERROR : GTK_STOCK_DIALOG_WARNING; @@ -730,7 +730,7 @@ void DownloadItemGtk::InitNineBoxes() { } gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) { - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { int border_width = GTK_CONTAINER(widget)->border_width; int x = widget->allocation.x + border_width; int y = widget->allocation.y + border_width; @@ -799,7 +799,7 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) { } gboolean DownloadItemGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e) { - if (!theme_provider_->UseGtkTheme()) { + if (!theme_service_->UseGtkTheme()) { bool is_body = widget == body_.get(); NineBox* nine_box = NULL; @@ -901,7 +901,7 @@ void DownloadItemGtk::ShowPopupMenu(GtkWidget* button, gboolean DownloadItemGtk::OnDangerousPromptExpose(GtkWidget* widget, GdkEventExpose* event) { - if (!theme_provider_->UseGtkTheme()) { + if (!theme_service_->UseGtkTheme()) { // The hbox renderer will take care of the border when in GTK mode. dangerous_nine_box_->RenderToWidget(widget); } diff --git a/chrome/browser/ui/gtk/download_item_gtk.h b/chrome/browser/ui/gtk/download_item_gtk.h index afe5fe7..190db53 100644 --- a/chrome/browser/ui/gtk/download_item_gtk.h +++ b/chrome/browser/ui/gtk/download_item_gtk.h @@ -23,7 +23,7 @@ class BaseDownloadItemModel; class DownloadShelfContextMenuGtk; class DownloadShelfGtk; -class GtkThemeProvider; +class GtkThemeService; class NineBox; class SkBitmap; @@ -181,7 +181,7 @@ class DownloadItemGtk : public DownloadItem::Observer, bool menu_showing_; // Whether we should use the GTK text color - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The widget that contains the animation progress and the file's icon // (as well as the complete animation). diff --git a/chrome/browser/ui/gtk/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download_shelf_gtk.cc index a64006b..40c45a9 100644 --- a/chrome/browser/ui/gtk/download_shelf_gtk.cc +++ b/chrome/browser/ui/gtk/download_shelf_gtk.cc @@ -15,7 +15,7 @@ #include "chrome/browser/ui/gtk/download_item_gtk.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -60,7 +60,7 @@ const int kShelfAuraSize = 40; DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent) : browser_(browser), is_showing_(false), - theme_provider_(GtkThemeProvider::GetFrom(browser->profile())), + theme_service_(GtkThemeService::GetFrom(browser->profile())), close_on_mouse_out_(false), mouse_in_shelf_(false), auto_close_factory_(this) { @@ -109,7 +109,7 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent) gtk_container_add(GTK_CONTAINER(shelf_.get()), vbox); // Create and pack the close button. - close_button_.reset(CustomDrawButton::CloseButton(theme_provider_)); + close_button_.reset(CustomDrawButton::CloseButton(theme_service_)); gtk_util::CenterWidgetInHBox(outer_hbox, close_button_->widget(), true, 0); g_signal_connect(close_button_->widget(), "clicked", G_CALLBACK(OnButtonClickThunk), this); @@ -140,7 +140,7 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent) kShelfAnimationDurationMs, false, true, this)); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); @@ -222,32 +222,32 @@ void DownloadShelfGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::BROWSER_THEME_CHANGED) { - GdkColor color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_TOOLBAR); + GdkColor color = theme_service_->GetGdkColor( + ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(padding_bg_, GTK_STATE_NORMAL, &color); - color = theme_provider_->GetBorderColor(); + color = theme_service_->GetBorderColor(); gtk_widget_modify_bg(top_border_, GTK_STATE_NORMAL, &color); gtk_chrome_link_button_set_use_gtk_theme( - GTK_CHROME_LINK_BUTTON(link_button_), theme_provider_->UseGtkTheme()); + GTK_CHROME_LINK_BUTTON(link_button_), theme_service_->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. - bool use_default_color = theme_provider_->GetColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT) == - BrowserThemeProvider::GetDefaultColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); - GdkColor bookmark_color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + bool use_default_color = theme_service_->GetColor( + ThemeService::COLOR_BOOKMARK_TEXT) == + ThemeService::GetDefaultColor( + ThemeService::COLOR_BOOKMARK_TEXT); + GdkColor bookmark_color = theme_service_->GetGdkColor( + ThemeService::COLOR_BOOKMARK_TEXT); gtk_chrome_link_button_set_normal_color( GTK_CHROME_LINK_BUTTON(link_button_), use_default_color ? NULL : &bookmark_color); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); close_button_->SetBackground( - theme_provider_->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), + theme_service_->GetColor(ThemeService::COLOR_TAB_TEXT), rb.GetBitmapNamed(IDR_CLOSE_BAR), rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); } diff --git a/chrome/browser/ui/gtk/download_shelf_gtk.h b/chrome/browser/ui/gtk/download_shelf_gtk.h index d54cabe..abe735d1 100644 --- a/chrome/browser/ui/gtk/download_shelf_gtk.h +++ b/chrome/browser/ui/gtk/download_shelf_gtk.h @@ -24,7 +24,7 @@ class BaseDownloadItemModel; class Browser; class CustomDrawButton; class DownloadItemGtk; -class GtkThemeProvider; +class GtkThemeService; class SlideAnimatorGtk; namespace gfx { @@ -132,7 +132,7 @@ class DownloadShelfGtk : public DownloadShelf, std::vector<DownloadItemGtk*> download_items_; // Gives us our colors and theme information. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc index 1fa0156..1892a0d 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc @@ -14,7 +14,7 @@ #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" #include "chrome/browser/ui/gtk/browser_window_gtk.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" #include "chrome/common/extensions/extension.h" @@ -171,7 +171,7 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { if (reference_widget == NULL) reference_widget = browser_window->GetToolbar()->GetAppMenuButton(); - GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( + GtkThemeService* theme_provider = GtkThemeService::GetFrom( browser_->profile()); // Setup the InfoBubble content. diff --git a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc index 823f5a7..b395292 100644 --- a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc @@ -17,7 +17,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -124,7 +124,7 @@ void ExtensionPopupGtk::ShowPopup() { arrow_location, false, // match_system_theme !being_inspected_, // grab_input - GtkThemeProvider::GetFrom(browser_->profile()), + GtkThemeService::GetFrom(browser_->profile()), this); } diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index 81fe41f..5487d9f 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -24,7 +24,7 @@ #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/custom_button.h" #include "chrome/browser/ui/gtk/gtk_floating_container.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/nine_box.h" #include "chrome/browser/ui/gtk/slide_animator_gtk.h" @@ -176,7 +176,7 @@ void BuildBorder(GtkWidget* child, FindBarGtk::FindBarGtk(Browser* browser) : browser_(browser), window_(static_cast<BrowserWindowGtk*>(browser->window())), - theme_provider_(GtkThemeProvider::GetFrom(browser->profile())), + theme_service_(GtkThemeService::GetFrom(browser->profile())), container_width_(-1), container_height_(-1), match_label_failure_(false), @@ -235,7 +235,7 @@ void FindBarGtk::InitWidgets() { SlideAnimatorGtk::DOWN, 0, false, false, NULL)); - close_button_.reset(CustomDrawButton::CloseButton(theme_provider_)); + close_button_.reset(CustomDrawButton::CloseButton(theme_service_)); gtk_util::CenterWidgetInHBox(hbox, close_button_->widget(), true, kCloseButtonPaddingLeft); g_signal_connect(close_button_->widget(), "clicked", @@ -243,7 +243,7 @@ void FindBarGtk::InitWidgets() { gtk_widget_set_tooltip_text(close_button_->widget(), l10n_util::GetStringUTF8(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP).c_str()); - find_next_button_.reset(new CustomDrawButton(theme_provider_, + find_next_button_.reset(new CustomDrawButton(theme_service_, IDR_FINDINPAGE_NEXT, IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_P, GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_MENU)); g_signal_connect(find_next_button_->widget(), "clicked", @@ -253,7 +253,7 @@ void FindBarGtk::InitWidgets() { gtk_box_pack_end(GTK_BOX(hbox), find_next_button_->widget(), FALSE, FALSE, 0); - find_previous_button_.reset(new CustomDrawButton(theme_provider_, + find_previous_button_.reset(new CustomDrawButton(theme_service_, IDR_FINDINPAGE_PREV, IDR_FINDINPAGE_PREV_H, IDR_FINDINPAGE_PREV_H, IDR_FINDINPAGE_PREV_P, GTK_STOCK_GO_UP, GTK_ICON_SIZE_MENU)); g_signal_connect(find_previous_button_->widget(), "clicked", @@ -302,7 +302,7 @@ void FindBarGtk::InitWidgets() { &border_bin_, &border_bin_alignment_); gtk_util::CenterWidgetInHBox(hbox, border_bin_, true, 0); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); @@ -468,7 +468,7 @@ void FindBarGtk::Observe(NotificationType type, container_width_ = -1; container_height_ = -1; - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { gtk_widget_modify_cursor(text_entry_, NULL, NULL); gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, NULL); gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, NULL); @@ -535,7 +535,7 @@ void FindBarGtk::Observe(NotificationType type, ResourceBundle& rb = ResourceBundle::GetSharedInstance(); close_button_->SetBackground( - theme_provider_->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), + theme_service_->GetColor(ThemeService::COLOR_TAB_TEXT), rb.GetBitmapNamed(IDR_CLOSE_BAR), rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); } @@ -602,7 +602,7 @@ void FindBarGtk::FindEntryTextInContents(bool forward_search) { void FindBarGtk::UpdateMatchLabelAppearance(bool failure) { match_label_failure_ = failure; - bool use_gtk = theme_provider_->UseGtkTheme(); + bool use_gtk = theme_service_->UseGtkTheme(); if (use_gtk) { GtkStyle* style = gtk_rc_get_style(text_entry_); @@ -812,7 +812,7 @@ void FindBarGtk::OnClicked(GtkWidget* button, FindBarGtk* find_bar) { gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget, GdkEventExpose* event, FindBarGtk* bar) { - if (bar->theme_provider_->UseGtkTheme()) { + if (bar->theme_service_->UseGtkTheme()) { // Draw the text entry background around where we input stuff. Note the // decrement to |width|. We do this because some theme engines // (*cough*Clearlooks*cough*) don't do any blending and use thickness to @@ -839,7 +839,7 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, gtk_widget_size_request(widget, &req); gtk_widget_set_size_request(bar->widget(), req.width, -1); - if (bar->theme_provider_->UseGtkTheme()) { + if (bar->theme_service_->UseGtkTheme()) { if (bar->container_width_ != widget->allocation.width || bar->container_height_ != widget->allocation.height) { std::vector<GdkPoint> mask_points = MakeFramePolygonPoints( @@ -859,7 +859,7 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, GdkDrawable* drawable = GDK_DRAWABLE(e->window); GdkGC* gc = gdk_gc_new(drawable); gdk_gc_set_clip_rectangle(gc, &e->area); - GdkColor color = bar->theme_provider_->GetBorderColor(); + GdkColor color = bar->theme_service_->GetBorderColor(); gdk_gc_set_rgb_fg_color(gc, &color); // Stroke the frame border. @@ -887,7 +887,7 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); gtk_util::DrawThemedToolbarBackground(widget, cr, e, tabstrip_origin, - bar->theme_provider_); + bar->theme_service_); // During chrome theme mode, we need to draw the border around content_hbox // now instead of when we render |border_bin_|. We don't use stacked event @@ -897,7 +897,7 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, // Blit the left part of the background image once on the left. CairoCachedSurface* background_left = - bar->theme_provider_->GetRTLEnabledSurfaceNamed( + bar->theme_service_->GetRTLEnabledSurfaceNamed( IDR_FIND_BOX_BACKGROUND_LEFT, widget); background_left->SetSource(cr, border_allocation.x, border_allocation.y); cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); @@ -906,7 +906,7 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, cairo_fill(cr); // Blit the center part of the background image in all the space between. - CairoCachedSurface* background = bar->theme_provider_->GetSurfaceNamed( + CairoCachedSurface* background = bar->theme_service_->GetSurfaceNamed( IDR_FIND_BOX_BACKGROUND, widget); background->SetSource(cr, border_allocation.x + background_left->Width(), diff --git a/chrome/browser/ui/gtk/find_bar_gtk.h b/chrome/browser/ui/gtk/find_bar_gtk.h index ae5a656..7059c94 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.h +++ b/chrome/browser/ui/gtk/find_bar_gtk.h @@ -22,7 +22,7 @@ class Browser; class BrowserWindowGtk; class CustomDrawButton; class FindBarController; -class GtkThemeProvider; +class GtkThemeService; class NineBox; class SlideAnimatorGtk; class TabContentsContainerGtk; @@ -172,7 +172,7 @@ class FindBarGtk : public FindBar, BrowserWindowGtk* window_; // Provides colors and information about GTK. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The widget that animates the slide-in and -out of the findbar. scoped_ptr<SlideAnimatorGtk> slide_widget_; diff --git a/chrome/browser/ui/gtk/first_run_bubble.cc b/chrome/browser/ui/gtk/first_run_bubble.cc index 9a5f2c6..3c05c31 100644 --- a/chrome/browser/ui/gtk/first_run_bubble.cc +++ b/chrome/browser/ui/gtk/first_run_bubble.cc @@ -12,7 +12,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/search_engines/util.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "content/common/notification_service.h" #include "grit/chromium_strings.h" @@ -57,7 +57,7 @@ void FirstRunBubble::Observe(NotificationType type, const NotificationDetails& details) { DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { for (std::vector<GtkWidget*>::iterator it = labels_.begin(); it != labels_.end(); ++it) { gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, NULL); @@ -75,7 +75,7 @@ FirstRunBubble::FirstRunBubble(Profile* profile, const gfx::Rect& rect, FirstRun::BubbleType bubble_type) : profile_(profile), - theme_provider_(GtkThemeProvider::GetFrom(profile_)), + theme_service_(GtkThemeService::GetFrom(profile_)), anchor_(anchor), content_(NULL), bubble_(NULL) { @@ -110,7 +110,7 @@ FirstRunBubble::FirstRunBubble(Profile* profile, arrow_location, true, // match_system_theme true, // grab_input - theme_provider_, + theme_service_, this); // delegate if (!bubble_) { NOTREACHED(); @@ -119,7 +119,7 @@ FirstRunBubble::FirstRunBubble(Profile* profile, registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } FirstRunBubble::~FirstRunBubble() { diff --git a/chrome/browser/ui/gtk/first_run_bubble.h b/chrome/browser/ui/gtk/first_run_bubble.h index 1a26e1b..7e774de 100644 --- a/chrome/browser/ui/gtk/first_run_bubble.h +++ b/chrome/browser/ui/gtk/first_run_bubble.h @@ -66,7 +66,7 @@ class FirstRunBubble : public InfoBubbleGtkDelegate, Profile* profile_; // Provides colors and stuff. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The widget we anchor to, and a descendant of the toplevel window we // are transient for. diff --git a/chrome/browser/ui/gtk/gtk_theme_provider.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc index 7247515..81bf8a9 100644 --- a/chrome/browser/ui/gtk/gtk_theme_provider.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include <gtk/gtk.h> @@ -17,7 +17,7 @@ #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" @@ -122,8 +122,7 @@ bool IsOverridableImage(int id) { images.insert(kAutocompleteImages, kAutocompleteImages + arraysize(kAutocompleteImages)); - const std::set<int>& buttons = - BrowserThemeProvider::GetTintableToolbarButtons(); + const std::set<int>& buttons = ThemeService::GetTintableToolbarButtons(); images.insert(buttons.begin(), buttons.end()); } @@ -242,18 +241,18 @@ void GdkColorHSLShift(const color_utils::HSL& shift, GdkColor* frame_color) { } // namespace -GtkWidget* GtkThemeProvider::icon_widget_ = NULL; -GdkPixbuf* GtkThemeProvider::default_folder_icon_ = NULL; -GdkPixbuf* GtkThemeProvider::default_bookmark_icon_ = NULL; +GtkWidget* GtkThemeService::icon_widget_ = NULL; +GdkPixbuf* GtkThemeService::default_folder_icon_ = NULL; +GdkPixbuf* GtkThemeService::default_bookmark_icon_ = NULL; // static -GtkThemeProvider* GtkThemeProvider::GetFrom(Profile* profile) { - return static_cast<GtkThemeProvider*>( +GtkThemeService* GtkThemeService::GetFrom(Profile* profile) { + return static_cast<GtkThemeService*>( ThemeServiceFactory::GetForProfile(profile)); } -GtkThemeProvider::GtkThemeProvider() - : BrowserThemeProvider(), +GtkThemeService::GtkThemeService() + : ThemeService(), fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), fake_frame_(chrome_gtk_frame_new()), signals_(new ui::GtkSignalRegistrar), @@ -271,7 +270,7 @@ GtkThemeProvider::GtkThemeProvider() G_CALLBACK(&OnStyleSetThunk), this); } -GtkThemeProvider::~GtkThemeProvider() { +GtkThemeService::~GtkThemeService() { gtk_widget_destroy(fake_window_); gtk_widget_destroy(fake_frame_); fake_label_.Destroy(); @@ -280,20 +279,20 @@ GtkThemeProvider::~GtkThemeProvider() { FreeIconSets(); - // We have to call this because FreePlatformCached() in ~BrowserThemeProvider + // We have to call this because FreePlatformCached() in ~ThemeService // doesn't call the right virutal FreePlatformCaches. FreePlatformCaches(); } -void GtkThemeProvider::Init(Profile* profile) { +void GtkThemeService::Init(Profile* profile) { registrar_.Init(profile->GetPrefs()); registrar_.Add(prefs::kUsesSystemTheme, this); use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); - BrowserThemeProvider::Init(profile); + ThemeService::Init(profile); } -SkBitmap* GtkThemeProvider::GetBitmapNamed(int id) const { +SkBitmap* GtkThemeService::GetBitmapNamed(int id) const { // Try to get our cached version: ImageCache::const_iterator it = gtk_images_.find(id); if (it != gtk_images_.end()) @@ -306,64 +305,64 @@ SkBitmap* GtkThemeProvider::GetBitmapNamed(int id) const { return bitmap; } - return BrowserThemeProvider::GetBitmapNamed(id); + return ThemeService::GetBitmapNamed(id); } -SkColor GtkThemeProvider::GetColor(int id) const { +SkColor GtkThemeService::GetColor(int id) const { if (use_gtk_) { ColorMap::const_iterator it = colors_.find(id); if (it != colors_.end()) return it->second; } - return BrowserThemeProvider::GetColor(id); + return ThemeService::GetColor(id); } -bool GtkThemeProvider::HasCustomImage(int id) const { +bool GtkThemeService::HasCustomImage(int id) const { if (use_gtk_) return IsOverridableImage(id); - return BrowserThemeProvider::HasCustomImage(id); + return ThemeService::HasCustomImage(id); } -void GtkThemeProvider::InitThemesFor(NotificationObserver* observer) { +void GtkThemeService::InitThemesFor(NotificationObserver* observer) { observer->Observe(NotificationType::BROWSER_THEME_CHANGED, Source<ui::ThemeProvider>(this), NotificationService::NoDetails()); } -void GtkThemeProvider::SetTheme(const Extension* extension) { +void GtkThemeService::SetTheme(const Extension* extension) { profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); LoadDefaultValues(); - BrowserThemeProvider::SetTheme(extension); + ThemeService::SetTheme(extension); } -void GtkThemeProvider::UseDefaultTheme() { +void GtkThemeService::UseDefaultTheme() { profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); LoadDefaultValues(); - BrowserThemeProvider::UseDefaultTheme(); + ThemeService::UseDefaultTheme(); } -void GtkThemeProvider::SetNativeTheme() { +void GtkThemeService::SetNativeTheme() { profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); ClearAllThemeData(); LoadGtkValues(); NotifyThemeChanged(NULL); } -bool GtkThemeProvider::UsingDefaultTheme() { - return !use_gtk_ && BrowserThemeProvider::UsingDefaultTheme(); +bool GtkThemeService::UsingDefaultTheme() { + return !use_gtk_ && ThemeService::UsingDefaultTheme(); } -void GtkThemeProvider::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { +void GtkThemeService::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { if ((type == NotificationType::PREF_CHANGED) && (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); } -GtkWidget* GtkThemeProvider::BuildChromeButton() { +GtkWidget* GtkThemeService::BuildChromeButton() { GtkWidget* button = HoverControllerGtk::CreateChromeButton(); gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); chrome_buttons_.push_back(button); @@ -373,7 +372,7 @@ GtkWidget* GtkThemeProvider::BuildChromeButton() { return button; } -GtkWidget* GtkThemeProvider::CreateToolbarSeparator() { +GtkWidget* GtkThemeService::CreateToolbarSeparator() { GtkWidget* separator = gtk_vseparator_new(); GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), @@ -385,15 +384,15 @@ GtkWidget* GtkThemeProvider::CreateToolbarSeparator() { return alignment; } -bool GtkThemeProvider::UseGtkTheme() const { +bool GtkThemeService::UseGtkTheme() const { return use_gtk_; } -GdkColor GtkThemeProvider::GetGdkColor(int id) const { +GdkColor GtkThemeService::GetGdkColor(int id) const { return gfx::SkColorToGdkColor(GetColor(id)); } -GdkColor GtkThemeProvider::GetBorderColor() const { +GdkColor GtkThemeService::GetBorderColor() const { GtkStyle* style = gtk_rc_get_style(fake_window_); GdkColor text; @@ -417,16 +416,16 @@ GdkColor GtkThemeProvider::GetBorderColor() const { return color; } -GtkIconSet* GtkThemeProvider::GetIconSetForId(int id) const { +GtkIconSet* GtkThemeService::GetIconSetForId(int id) const { if (id == IDR_FULLSCREEN_MENU_BUTTON) return fullscreen_icon_set_; return NULL; } -void GtkThemeProvider::GetScrollbarColors(GdkColor* thumb_active_color, - GdkColor* thumb_inactive_color, - GdkColor* track_color) { +void GtkThemeService::GetScrollbarColors(GdkColor* thumb_active_color, + GdkColor* thumb_inactive_color, + GdkColor* track_color) { const GdkColor* theme_thumb_active = NULL; const GdkColor* theme_thumb_inactive = NULL; const GdkColor* theme_trough_color = NULL; @@ -523,7 +522,7 @@ void GtkThemeProvider::GetScrollbarColors(GdkColor* thumb_active_color, *track_color = *theme_trough_color; } -CairoCachedSurface* GtkThemeProvider::GetSurfaceNamed( +CairoCachedSurface* GtkThemeService::GetSurfaceNamed( int id, GtkWidget* widget_on_display) { return GetSurfaceNamedImpl(id, @@ -532,11 +531,11 @@ CairoCachedSurface* GtkThemeProvider::GetSurfaceNamed( widget_on_display); } -CairoCachedSurface* GtkThemeProvider::GetRTLEnabledSurfaceNamed( +CairoCachedSurface* GtkThemeService::GetRTLEnabledSurfaceNamed( int id, GtkWidget* widget_on_display) { // We flip the sign of |id| when passing it to GetSurfaceNamedImpl() for the - // same reason that BrowserThemeProvider::GetPixbufImpl() does: so that if one + // same reason that ThemeService::GetPixbufImpl() does: so that if one // location calls this function with a resource ID, and another place calls // GetSurfaceNamed() with the same ID, they'll correctly get different // surfaces in RTL mode. @@ -546,7 +545,7 @@ CairoCachedSurface* GtkThemeProvider::GetRTLEnabledSurfaceNamed( widget_on_display); } -CairoCachedSurface* GtkThemeProvider::GetUnthemedSurfaceNamed( +CairoCachedSurface* GtkThemeService::GetUnthemedSurfaceNamed( int id, GtkWidget* widget_on_display) { return GetSurfaceNamedImpl(id, @@ -556,7 +555,7 @@ CairoCachedSurface* GtkThemeProvider::GetUnthemedSurfaceNamed( } // static -GdkPixbuf* GtkThemeProvider::GetFolderIcon(bool native) { +GdkPixbuf* GtkThemeService::GetFolderIcon(bool native) { if (native) { if (!icon_widget_) icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -577,7 +576,7 @@ GdkPixbuf* GtkThemeProvider::GetFolderIcon(bool native) { } // static -GdkPixbuf* GtkThemeProvider::GetDefaultFavicon(bool native) { +GdkPixbuf* GtkThemeService::GetDefaultFavicon(bool native) { if (native) { if (!icon_widget_) icon_widget_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -598,7 +597,7 @@ GdkPixbuf* GtkThemeProvider::GetDefaultFavicon(bool native) { } // static -bool GtkThemeProvider::DefaultUsesSystemTheme() { +bool GtkThemeService::DefaultUsesSystemTheme() { scoped_ptr<base::Environment> env(base::Environment::Create()); switch (base::nix::GetDesktopEnvironment(env.get())) { @@ -610,26 +609,26 @@ bool GtkThemeProvider::DefaultUsesSystemTheme() { } } -void GtkThemeProvider::ClearAllThemeData() { +void GtkThemeService::ClearAllThemeData() { colors_.clear(); tints_.clear(); - BrowserThemeProvider::ClearAllThemeData(); + ThemeService::ClearAllThemeData(); } -void GtkThemeProvider::LoadThemePrefs() { +void GtkThemeService::LoadThemePrefs() { if (use_gtk_) { LoadGtkValues(); } else { LoadDefaultValues(); - BrowserThemeProvider::LoadThemePrefs(); + ThemeService::LoadThemePrefs(); } RebuildMenuIconSets(); } -void GtkThemeProvider::NotifyThemeChanged(const Extension* extension) { - BrowserThemeProvider::NotifyThemeChanged(extension); +void GtkThemeService::NotifyThemeChanged(const Extension* extension) { + ThemeService::NotifyThemeChanged(extension); // Notify all GtkChromeButtons of their new rendering mode: for (std::vector<GtkWidget*>::iterator it = chrome_buttons_.begin(); @@ -644,15 +643,15 @@ void GtkThemeProvider::NotifyThemeChanged(const Extension* extension) { } } -void GtkThemeProvider::FreePlatformCaches() { - BrowserThemeProvider::FreePlatformCaches(); +void GtkThemeService::FreePlatformCaches() { + ThemeService::FreePlatformCaches(); FreePerDisplaySurfaces(&per_display_surfaces_); FreePerDisplaySurfaces(&per_display_unthemed_surfaces_); STLDeleteValues(>k_images_); } -void GtkThemeProvider::OnStyleSet(GtkWidget* widget, - GtkStyle* previous_style) { +void GtkThemeService::OnStyleSet(GtkWidget* widget, + GtkStyle* previous_style) { GdkPixbuf* default_folder_icon = default_folder_icon_; GdkPixbuf* default_bookmark_icon = default_bookmark_icon_; default_folder_icon_ = NULL; @@ -674,7 +673,7 @@ void GtkThemeProvider::OnStyleSet(GtkWidget* widget, g_object_unref(default_bookmark_icon); } -void GtkThemeProvider::LoadGtkValues() { +void GtkThemeService::LoadGtkValues() { // Before we start setting images and values, we have to clear out old, stale // values. (If we don't do this, we'll regress startup time in the case where // someone installs a heavyweight theme, then goes back to GTK.) @@ -685,21 +684,21 @@ void GtkThemeProvider::LoadGtkValues() { GtkStyle* frame_style = gtk_rc_get_style(fake_frame_); GtkStyle* window_style = gtk_rc_get_style(fake_window_); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_CONTROL_BACKGROUND, + SetThemeColorFromGtk(ThemeService::COLOR_CONTROL_BACKGROUND, &window_style->bg[GTK_STATE_NORMAL]); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND, + SetThemeColorFromGtk(ThemeService::COLOR_BUTTON_BACKGROUND, &window_style->bg[GTK_STATE_NORMAL]); GdkColor toolbar_color = window_style->bg[GTK_STATE_NORMAL]; - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_TOOLBAR, &toolbar_color); + SetThemeColorFromGtk(ThemeService::COLOR_TOOLBAR, &toolbar_color); GdkColor button_color = window_style->bg[GTK_STATE_SELECTED]; - SetThemeTintFromGtk(BrowserThemeProvider::TINT_BUTTONS, &button_color); + SetThemeTintFromGtk(ThemeService::TINT_BUTTONS, &button_color); GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); GdkColor label_color = label_style->fg[GTK_STATE_NORMAL]; - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_TAB_TEXT, &label_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_BOOKMARK_TEXT, &label_color); + SetThemeColorFromGtk(ThemeService::COLOR_TAB_TEXT, &label_color); + SetThemeColorFromGtk(ThemeService::COLOR_BOOKMARK_TEXT, &label_color); // Build the various icon tints. GetNormalButtonTintHSL(&button_tint_); @@ -723,7 +722,7 @@ void GtkThemeProvider::LoadGtkValues() { else inactive_tab_text_hsl.s = kLightInactiveSaturation; - colors_[BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT] = + colors_[ThemeService::COLOR_BACKGROUND_TAB_TEXT] = color_utils::HSLToSkColor(inactive_tab_text_hsl, 255); // We pick the text and background colors for the NTP out of the colors for a @@ -734,9 +733,9 @@ void GtkThemeProvider::LoadGtkValues() { GtkStyle* entry_style = gtk_rc_get_style(fake_entry_.get()); GdkColor ntp_background = entry_style->base[GTK_STATE_NORMAL]; GdkColor ntp_foreground = entry_style->text[GTK_STATE_NORMAL]; - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_BACKGROUND, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_BACKGROUND, &ntp_background); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_TEXT, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_TEXT, &ntp_foreground); // The NTP header is the color that surrounds the current active thumbnail on @@ -744,11 +743,11 @@ void GtkThemeProvider::LoadGtkValues() { // awesome if they were separated so we could use GetBorderColor() for the // border around the "Recent Links" section, but matching the frame color is // more important. - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_HEADER, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_HEADER, &frame_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_SECTION, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_SECTION, &toolbar_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_SECTION_TEXT, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_SECTION_TEXT, &label_color); // Override the link color if the theme provides it. @@ -758,21 +757,21 @@ void GtkThemeProvider::LoadGtkValues() { if (!link_color) link_color = &kDefaultLinkColor; - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_LINK, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_LINK, link_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_LINK_UNDERLINE, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_LINK_UNDERLINE, link_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_SECTION_LINK, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_SECTION_LINK, link_color); - SetThemeColorFromGtk(BrowserThemeProvider::COLOR_NTP_SECTION_LINK_UNDERLINE, + SetThemeColorFromGtk(ThemeService::COLOR_NTP_SECTION_LINK_UNDERLINE, link_color); // Generate the colors that we pass to WebKit. focus_ring_color_ = GdkToSkColor(&frame_color); GdkColor thumb_active_color, thumb_inactive_color, track_color; - GtkThemeProvider::GetScrollbarColors(&thumb_active_color, - &thumb_inactive_color, - &track_color); + GtkThemeService::GetScrollbarColors(&thumb_active_color, + &thumb_inactive_color, + &track_color); thumb_active_color_ = GdkToSkColor(&thumb_active_color); thumb_inactive_color_ = GdkToSkColor(&thumb_inactive_color); track_color_ = GdkToSkColor(&track_color); @@ -789,7 +788,7 @@ void GtkThemeProvider::LoadGtkValues() { GdkToSkColor(&entry_style->text[GTK_STATE_ACTIVE]); } -GdkColor GtkThemeProvider::BuildFrameColors(GtkStyle* frame_style) { +GdkColor GtkThemeService::BuildFrameColors(GtkStyle* frame_style) { const GdkColor* theme_frame = NULL; const GdkColor* theme_inactive_frame = NULL; const GdkColor* theme_incognito_frame = NULL; @@ -806,35 +805,35 @@ GdkColor GtkThemeProvider::BuildFrameColors(GtkStyle* frame_style) { &frame_style->bg[GTK_STATE_SELECTED], theme_frame, kDefaultFrameShift, - BrowserThemeProvider::COLOR_FRAME, - BrowserThemeProvider::TINT_FRAME); - SetThemeTintFromGtk(BrowserThemeProvider::TINT_BACKGROUND_TAB, &frame_color); + ThemeService::COLOR_FRAME, + ThemeService::TINT_FRAME); + SetThemeTintFromGtk(ThemeService::TINT_BACKGROUND_TAB, &frame_color); BuildAndSetFrameColor( &frame_style->bg[GTK_STATE_INSENSITIVE], theme_inactive_frame, kDefaultFrameShift, - BrowserThemeProvider::COLOR_FRAME_INACTIVE, - BrowserThemeProvider::TINT_FRAME_INACTIVE); + ThemeService::COLOR_FRAME_INACTIVE, + ThemeService::TINT_FRAME_INACTIVE); BuildAndSetFrameColor( &frame_color, theme_incognito_frame, - GetDefaultTint(BrowserThemeProvider::TINT_FRAME_INCOGNITO), - BrowserThemeProvider::COLOR_FRAME_INCOGNITO, - BrowserThemeProvider::TINT_FRAME_INCOGNITO); + GetDefaultTint(ThemeService::TINT_FRAME_INCOGNITO), + ThemeService::COLOR_FRAME_INCOGNITO, + ThemeService::TINT_FRAME_INCOGNITO); BuildAndSetFrameColor( &frame_color, theme_incognito_inactive_frame, - GetDefaultTint(BrowserThemeProvider::TINT_FRAME_INCOGNITO_INACTIVE), - BrowserThemeProvider::COLOR_FRAME_INCOGNITO_INACTIVE, - BrowserThemeProvider::TINT_FRAME_INCOGNITO_INACTIVE); + GetDefaultTint(ThemeService::TINT_FRAME_INCOGNITO_INACTIVE), + ThemeService::COLOR_FRAME_INCOGNITO_INACTIVE, + ThemeService::TINT_FRAME_INCOGNITO_INACTIVE); return frame_color; } -void GtkThemeProvider::LoadDefaultValues() { +void GtkThemeService::LoadDefaultValues() { focus_ring_color_ = SkColorSetARGB(255, 229, 151, 0); thumb_active_color_ = SkColorSetRGB(244, 244, 244); thumb_inactive_color_ = SkColorSetRGB(234, 234, 234); @@ -846,7 +845,7 @@ void GtkThemeProvider::LoadDefaultValues() { inactive_selection_fg_color_ = SkColorSetRGB(50, 50, 50); } -void GtkThemeProvider::RebuildMenuIconSets() { +void GtkThemeService::RebuildMenuIconSets() { FreeIconSets(); GtkStyle* style = gtk_rc_get_style(fake_menu_item_.get()); @@ -862,11 +861,11 @@ void GtkThemeProvider::RebuildMenuIconSets() { fullscreen_icon_set_); } -void GtkThemeProvider::SetThemeColorFromGtk(int id, const GdkColor* color) { +void GtkThemeService::SetThemeColorFromGtk(int id, const GdkColor* color) { colors_[id] = GdkToSkColor(color); } -void GtkThemeProvider::SetThemeTintFromGtk(int id, const GdkColor* color) { +void GtkThemeService::SetThemeTintFromGtk(int id, const GdkColor* color) { color_utils::HSL default_tint = GetDefaultTint(id); color_utils::HSL hsl; color_utils::SkColorToHSL(GdkToSkColor(color), &hsl); @@ -880,11 +879,11 @@ void GtkThemeProvider::SetThemeTintFromGtk(int id, const GdkColor* color) { tints_[id] = hsl; } -GdkColor GtkThemeProvider::BuildAndSetFrameColor(const GdkColor* base, - const GdkColor* gtk_base, - const color_utils::HSL& tint, - int color_id, - int tint_id) { +GdkColor GtkThemeService::BuildAndSetFrameColor(const GdkColor* base, + const GdkColor* gtk_base, + const color_utils::HSL& tint, + int color_id, + int tint_id) { GdkColor out_color = *base; if (gtk_base) { // The theme author specified a color to use, use it without modification. @@ -900,7 +899,7 @@ GdkColor GtkThemeProvider::BuildAndSetFrameColor(const GdkColor* base, return out_color; } -void GtkThemeProvider::FreePerDisplaySurfaces( +void GtkThemeService::FreePerDisplaySurfaces( PerDisplaySurfaceMap* per_display_map) { for (PerDisplaySurfaceMap::iterator it = per_display_map->begin(); it != per_display_map->end(); ++it) { @@ -912,14 +911,14 @@ void GtkThemeProvider::FreePerDisplaySurfaces( per_display_map->clear(); } -void GtkThemeProvider::FreeIconSets() { +void GtkThemeService::FreeIconSets() { if (fullscreen_icon_set_) { gtk_icon_set_unref(fullscreen_icon_set_); fullscreen_icon_set_ = NULL; } } -SkBitmap* GtkThemeProvider::GenerateGtkThemeBitmap(int id) const { +SkBitmap* GtkThemeService::GenerateGtkThemeBitmap(int id) const { switch (id) { case IDR_THEME_TOOLBAR: { GtkStyle* style = gtk_rc_get_style(fake_window_); @@ -936,17 +935,17 @@ SkBitmap* GtkThemeProvider::GenerateGtkThemeBitmap(int id) const { case IDR_THEME_TAB_BACKGROUND_INCOGNITO: return GenerateTabImage(IDR_THEME_FRAME_INCOGNITO); case IDR_THEME_FRAME: - return GenerateFrameImage(BrowserThemeProvider::COLOR_FRAME, + return GenerateFrameImage(ThemeService::COLOR_FRAME, "frame-gradient-color"); case IDR_THEME_FRAME_INACTIVE: - return GenerateFrameImage(BrowserThemeProvider::COLOR_FRAME_INACTIVE, + return GenerateFrameImage(ThemeService::COLOR_FRAME_INACTIVE, "inactive-frame-gradient-color"); case IDR_THEME_FRAME_INCOGNITO: - return GenerateFrameImage(BrowserThemeProvider::COLOR_FRAME_INCOGNITO, + return GenerateFrameImage(ThemeService::COLOR_FRAME_INCOGNITO, "incognito-frame-gradient-color"); case IDR_THEME_FRAME_INCOGNITO_INACTIVE: { return GenerateFrameImage( - BrowserThemeProvider::COLOR_FRAME_INCOGNITO_INACTIVE, + ThemeService::COLOR_FRAME_INCOGNITO_INACTIVE, "incognito-inactive-frame-gradient-color"); } // Icons that sit inside the omnibox shouldn't receive TINT_BUTTONS and @@ -977,7 +976,7 @@ SkBitmap* GtkThemeProvider::GenerateGtkThemeBitmap(int id) const { } } -SkBitmap* GtkThemeProvider::GenerateFrameImage( +SkBitmap* GtkThemeService::GenerateFrameImage( int color_id, const char* gradient_name) const { // We use two colors: the main color (passed in) and a lightened version of @@ -1015,15 +1014,15 @@ SkBitmap* GtkThemeProvider::GenerateFrameImage( return new SkBitmap(canvas.ExtractBitmap()); } -SkBitmap* GtkThemeProvider::GenerateTabImage(int base_id) const { +SkBitmap* GtkThemeService::GenerateTabImage(int base_id) const { SkBitmap* base_image = GetBitmapNamed(base_id); SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap( - *base_image, GetTint(BrowserThemeProvider::TINT_BACKGROUND_TAB)); + *base_image, GetTint(ThemeService::TINT_BACKGROUND_TAB)); return new SkBitmap(SkBitmapOperations::CreateTiledBitmap( bg_tint, 0, 0, bg_tint.width(), bg_tint.height())); } -SkBitmap* GtkThemeProvider::GenerateTintedIcon( +SkBitmap* GtkThemeService::GenerateTintedIcon( int base_id, const color_utils::HSL& tint) const { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -1032,7 +1031,7 @@ SkBitmap* GtkThemeProvider::GenerateTintedIcon( *button, tint)); } -void GtkThemeProvider::GetNormalButtonTintHSL( +void GtkThemeService::GetNormalButtonTintHSL( color_utils::HSL* tint) const { GtkStyle* window_style = gtk_rc_get_style(fake_window_); const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED]; @@ -1044,7 +1043,7 @@ void GtkThemeProvider::GetNormalButtonTintHSL( PickButtonTintFromColors(accent_gdk_color, text_color, base_color, tint); } -void GtkThemeProvider::GetNormalEntryForegroundHSL( +void GtkThemeService::GetNormalEntryForegroundHSL( color_utils::HSL* tint) const { GtkStyle* window_style = gtk_rc_get_style(fake_window_); const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED]; @@ -1056,7 +1055,7 @@ void GtkThemeProvider::GetNormalEntryForegroundHSL( PickButtonTintFromColors(accent_gdk_color, text_color, base_color, tint); } -void GtkThemeProvider::GetSelectedEntryForegroundHSL( +void GtkThemeService::GetSelectedEntryForegroundHSL( color_utils::HSL* tint) const { // The simplest of all the tints. We just use the selected text in the entry // since the icons tinted this way will only be displayed against @@ -1066,7 +1065,7 @@ void GtkThemeProvider::GetSelectedEntryForegroundHSL( color_utils::SkColorToHSL(GdkToSkColor(&color), tint); } -CairoCachedSurface* GtkThemeProvider::GetSurfaceNamedImpl( +CairoCachedSurface* GtkThemeService::GetSurfaceNamedImpl( int id, PerDisplaySurfaceMap* display_surface_map, GdkPixbuf* pixbuf, @@ -1087,15 +1086,15 @@ CairoCachedSurface* GtkThemeProvider::GetSurfaceNamedImpl( return surface; } -void GtkThemeProvider::OnDestroyChromeButton(GtkWidget* button) { +void GtkThemeService::OnDestroyChromeButton(GtkWidget* button) { std::vector<GtkWidget*>::iterator it = find(chrome_buttons_.begin(), chrome_buttons_.end(), button); if (it != chrome_buttons_.end()) chrome_buttons_.erase(it); } -gboolean GtkThemeProvider::OnSeparatorExpose(GtkWidget* widget, - GdkEventExpose* event) { +gboolean GtkThemeService::OnSeparatorExpose(GtkWidget* widget, + GdkEventExpose* event) { if (UseGtkTheme()) return FALSE; @@ -1103,7 +1102,7 @@ gboolean GtkThemeProvider::OnSeparatorExpose(GtkWidget* widget, gdk_cairo_rectangle(cr, &event->area); cairo_clip(cr); - GdkColor bottom_color = GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); + GdkColor bottom_color = GetGdkColor(ThemeService::COLOR_TOOLBAR); double bottom_color_rgb[] = { static_cast<double>(bottom_color.red / 257) / 255.0, static_cast<double>(bottom_color.green / 257) / 255.0, @@ -1130,7 +1129,7 @@ gboolean GtkThemeProvider::OnSeparatorExpose(GtkWidget* widget, cairo_set_line_width(cr, 1.0); cairo_move_to(cr, start_x, widget->allocation.y); cairo_line_to(cr, start_x, - widget->allocation.y + widget->allocation.height); + widget->allocation.y + widget->allocation.height); cairo_stroke(cr); cairo_destroy(cr); cairo_pattern_destroy(pattern); diff --git a/chrome/browser/ui/gtk/gtk_theme_provider.h b/chrome/browser/ui/gtk/gtk_theme_service.h index cdaed61..0b3f3da 100644 --- a/chrome/browser/ui/gtk/gtk_theme_provider.h +++ b/chrome/browser/ui/gtk/gtk_theme_service.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_ -#define CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_ +#ifndef CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ +#define CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ #pragma once #include <map> @@ -11,7 +11,7 @@ #include "base/scoped_ptr.h" #include "chrome/browser/prefs/pref_change_registrar.h" -#include "chrome/browser/themes/browser_theme_provider.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/gtk/owned_widget_gtk.h" #include "content/common/notification_observer.h" #include "ui/base/gtk/gtk_integers.h" @@ -32,24 +32,24 @@ typedef struct _GtkIconSet GtkIconSet; typedef struct _GtkStyle GtkStyle; typedef struct _GtkWidget GtkWidget; -// Specialization of BrowserThemeProvider which supplies system colors. -class GtkThemeProvider : public BrowserThemeProvider, - public NotificationObserver { +// Specialization of ThemeService which supplies system colors. +class GtkThemeService : public ThemeService, + public NotificationObserver { public: - // Returns GtkThemeProvider, casted from our superclass. - static GtkThemeProvider* GetFrom(Profile* profile); + // Returns GtkThemeService, casted from our superclass. + static GtkThemeService* GetFrom(Profile* profile); - GtkThemeProvider(); - virtual ~GtkThemeProvider(); + GtkThemeService(); + virtual ~GtkThemeService(); // Calls |observer|.Observe() for the browser theme with this provider as the // source. void InitThemesFor(NotificationObserver* observer); - // Overridden from BrowserThemeProvider: + // Overridden from ThemeService: // // Sets that we aren't using the system theme, then calls - // BrowserThemeProvider's implementation. + // ThemeService's implementation. virtual void Init(Profile* profile); virtual SkBitmap* GetBitmapNamed(int id) const; virtual SkColor GetColor(int id) const; @@ -107,7 +107,7 @@ class GtkThemeProvider : public BrowserThemeProvider, GtkWidget* widget_on_display); // Same as above, but gets the resource from the ResourceBundle instead of the - // BrowserThemeProvider. + // ThemeService. // NOTE: Never call this with resource IDs that are ever passed to the above // two functions! Depending on which call comes first, all callers will // either get the themed or the unthemed version. @@ -163,7 +163,7 @@ class GtkThemeProvider : public BrowserThemeProvider, virtual void FreePlatformCaches(); // Extracts colors and tints from the GTK theme, both for the - // BrowserThemeProvider interface and the colors we send to webkit. + // ThemeService interface and the colors we send to webkit. void LoadGtkValues(); // Reads in explicit theme frame colors from the ChromeGtkFrame style class @@ -192,9 +192,9 @@ class GtkThemeProvider : public BrowserThemeProvider, int tint_id); // Split out from FreePlatformCaches so it can be called in our destructor; - // FreePlatformCaches() is called from the BrowserThemeProvider's destructor, - // but by the time ~BrowserThemeProvider() is run, the vtable no longer - // points to GtkThemeProvider's version. + // FreePlatformCaches() is called from the ThemeService's destructor, + // but by the time ~ThemeService() is run, the vtable no longer + // points to GtkThemeService's version. void FreePerDisplaySurfaces(PerDisplaySurfaceMap* per_display_map); // Frees all the created GtkIconSets we use for the chrome menu. @@ -214,7 +214,7 @@ class GtkThemeProvider : public BrowserThemeProvider, SkBitmap* GenerateTabImage(int base_id) const; // Tints an icon based on tint. - SkBitmap* GenerateTintedIcon(int base_id, + SkBitmap* GenerateTintedIcon(int base_id, const color_utils::HSL& tint) const; // Returns the tint for buttons that contrasts with the normal window @@ -235,13 +235,13 @@ class GtkThemeProvider : public BrowserThemeProvider, GtkWidget* widget_on_display); // Handles signal from GTK that our theme has been changed. - CHROMEGTK_CALLBACK_1(GtkThemeProvider, void, OnStyleSet, GtkStyle*); + CHROMEGTK_CALLBACK_1(GtkThemeService, void, OnStyleSet, GtkStyle*); // A notification from the GtkChromeButton GObject destructor that we should // remove it from our internal list. - CHROMEGTK_CALLBACK_0(GtkThemeProvider, void, OnDestroyChromeButton); + CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyChromeButton); - CHROMEGTK_CALLBACK_1(GtkThemeProvider, gboolean, OnSeparatorExpose, + CHROMEGTK_CALLBACK_1(GtkThemeService, gboolean, OnSeparatorExpose, GdkEventExpose*); // Whether we should be using gtk rendering. @@ -310,4 +310,4 @@ class GtkThemeProvider : public BrowserThemeProvider, static GdkPixbuf* default_bookmark_icon_; }; -#endif // CHROME_BROWSER_UI_GTK_GTK_THEME_PROVIDER_H_ +#endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ diff --git a/chrome/browser/ui/gtk/gtk_theme_provider_unittest.cc b/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc index 28d2fab..7ba0313 100644 --- a/chrome/browser/ui/gtk/gtk_theme_provider_unittest.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service_unittest.cc @@ -6,7 +6,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "grit/theme_resources.h" @@ -23,37 +23,37 @@ SkColor GdkToSkColor(GdkColor* color) { } // namespace -class GtkThemeProviderTest : public testing::Test { +class GtkThemeServiceTest : public testing::Test { public: - GtkThemeProviderTest() : provider_(NULL) {} + GtkThemeServiceTest() : provider_(NULL) {} void SetUseGtkTheme(bool use_gtk_theme) { profile_.GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, use_gtk_theme); } void BuildProvider() { - provider_ = GtkThemeProvider::GetFrom(&profile_); + provider_ = GtkThemeService::GetFrom(&profile_); } protected: TestingProfile profile_; - GtkThemeProvider* provider_; + GtkThemeService* provider_; }; -TEST_F(GtkThemeProviderTest, DefaultValues) { +TEST_F(GtkThemeServiceTest, DefaultValues) { SetUseGtkTheme(false); BuildProvider(); // Test that we get the default theme colors back when in normal mode. - for (int i = BrowserThemeProvider::COLOR_FRAME; - i <= BrowserThemeProvider::COLOR_BUTTON_BACKGROUND; ++i) { - EXPECT_EQ(provider_->GetColor(i), BrowserThemeProvider::GetDefaultColor(i)) + for (int i = ThemeService::COLOR_FRAME; + i <= ThemeService::COLOR_BUTTON_BACKGROUND; ++i) { + EXPECT_EQ(provider_->GetColor(i), ThemeService::GetDefaultColor(i)) << "Wrong default color for " << i; } } -TEST_F(GtkThemeProviderTest, UsingGtkValues) { +TEST_F(GtkThemeServiceTest, UsingGtkValues) { SetUseGtkTheme(true); BuildProvider(); @@ -65,6 +65,6 @@ TEST_F(GtkThemeProviderTest, UsingGtkValues) { GtkWidget* fake_label = provider_->fake_label(); GtkStyle* label_style = gtk_rc_get_style(fake_label); GdkColor label_color = label_style->fg[GTK_STATE_NORMAL]; - EXPECT_EQ(provider_->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), + EXPECT_EQ(provider_->GetColor(ThemeService::COLOR_TAB_TEXT), GdkToSkColor(&label_color)); } diff --git a/chrome/browser/ui/gtk/gtk_tree.cc b/chrome/browser/ui/gtk/gtk_tree.cc index 9ff0416..8351c3f 100644 --- a/chrome/browser/ui/gtk/gtk_tree.cc +++ b/chrome/browser/ui/gtk/gtk_tree.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/models/table_model.h" #include "ui/gfx/gtk_util.h" @@ -383,7 +383,7 @@ void TreeAdapter::FillRow(GtkTreeIter* iter, ui::TreeModelNode* node) { if (icon_index >= 0 && icon_index < static_cast<int>(pixbufs_.size())) pixbuf = pixbufs_[icon_index]; else - pixbuf = GtkThemeProvider::GetFolderIcon(true); + pixbuf = GtkThemeService::GetFolderIcon(true); gtk_tree_store_set(tree_store_, iter, COL_ICON, pixbuf, COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index a7b46eb..84e7e9b 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -25,7 +25,7 @@ #include "chrome/browser/browser_window.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/cairo_cached_surface.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "content/browser/disposition_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" @@ -809,17 +809,17 @@ void DrawThemedToolbarBackground(GtkWidget* widget, cairo_t* cr, GdkEventExpose* event, const gfx::Point& tabstrip_origin, - GtkThemeProvider* theme_provider) { + GtkThemeService* theme_service) { // Fill the entire region with the toolbar color. - GdkColor color = theme_provider->GetGdkColor( - BrowserThemeProvider::COLOR_TOOLBAR); + GdkColor color = theme_service->GetGdkColor( + ThemeService::COLOR_TOOLBAR); gdk_cairo_set_source_color(cr, &color); cairo_fill(cr); // The toolbar is supposed to blend in with the active tab, so we have to pass // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the // tab strip. - CairoCachedSurface* background = theme_provider->GetSurfaceNamed( + CairoCachedSurface* background = theme_service->GetSurfaceNamed( IDR_THEME_TOOLBAR, widget); background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); // We tile the toolbar background in both directions. diff --git a/chrome/browser/ui/gtk/gtk_util.h b/chrome/browser/ui/gtk/gtk_util.h index c0113c3..cd59366 100644 --- a/chrome/browser/ui/gtk/gtk_util.h +++ b/chrome/browser/ui/gtk/gtk_util.h @@ -22,7 +22,7 @@ typedef struct _GdkColor GdkColor; typedef struct _GtkWidget GtkWidget; class BrowserWindow; -class GtkThemeProvider; +class GtkThemeService; class GURL; class Profile; struct RendererPreferences; // from common/renderer_preferences.h @@ -252,7 +252,7 @@ void DrawThemedToolbarBackground(GtkWidget* widget, cairo_t* cr, GdkEventExpose* event, const gfx::Point& tabstrip_origin, - GtkThemeProvider* provider); + GtkThemeService* provider); // Returns the two colors averaged together. GdkColor AverageColors(GdkColor color_one, GdkColor color_two); diff --git a/chrome/browser/ui/gtk/info_bubble_gtk.cc b/chrome/browser/ui/gtk/info_bubble_gtk.cc index f942674..b6a037a 100644 --- a/chrome/browser/ui/gtk/info_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/info_bubble_gtk.cc @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/info_bubble_accelerators_gtk.h" #include "content/common/notification_service.h" @@ -51,7 +51,7 @@ InfoBubbleGtk* InfoBubbleGtk::Show(GtkWidget* anchor_widget, ArrowLocationGtk arrow_location, bool match_system_theme, bool grab_input, - GtkThemeProvider* provider, + GtkThemeService* provider, InfoBubbleGtkDelegate* delegate) { InfoBubbleGtk* bubble = new InfoBubbleGtk(provider, match_system_theme); bubble->Init(anchor_widget, rect, content, arrow_location, grab_input); @@ -59,11 +59,11 @@ InfoBubbleGtk* InfoBubbleGtk::Show(GtkWidget* anchor_widget, return bubble; } -InfoBubbleGtk::InfoBubbleGtk(GtkThemeProvider* provider, +InfoBubbleGtk::InfoBubbleGtk(GtkThemeService* provider, bool match_system_theme) : delegate_(NULL), window_(NULL), - theme_provider_(provider), + theme_service_(provider), accel_group_(gtk_accel_group_new()), toplevel_window_(NULL), anchor_widget_(NULL), @@ -182,7 +182,7 @@ void InfoBubbleGtk::Init(GtkWidget* anchor_widget, registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); } // NOTE: This seems a bit overcomplicated, but it requires a bunch of careful @@ -346,7 +346,7 @@ void InfoBubbleGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); - if (theme_provider_->UseGtkTheme() && match_system_theme_) { + if (theme_service_->UseGtkTheme() && match_system_theme_) { gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL); } else { // Set the background color, so we don't need to paint it manually. diff --git a/chrome/browser/ui/gtk/info_bubble_gtk.h b/chrome/browser/ui/gtk/info_bubble_gtk.h index f45f80c..891b27d 100644 --- a/chrome/browser/ui/gtk/info_bubble_gtk.h +++ b/chrome/browser/ui/gtk/info_bubble_gtk.h @@ -25,7 +25,7 @@ #include "ui/gfx/point.h" #include "ui/gfx/rect.h" -class GtkThemeProvider; +class GtkThemeService; class InfoBubbleGtk; namespace gfx { class Rect; @@ -68,7 +68,7 @@ class InfoBubbleGtk : public NotificationObserver { ArrowLocationGtk arrow_location, bool match_system_theme, bool grab_input, - GtkThemeProvider* provider, + GtkThemeService* provider, InfoBubbleGtkDelegate* delegate); // Close the bubble if it's open. This will delete the widgets and object, @@ -96,7 +96,7 @@ class InfoBubbleGtk : public NotificationObserver { FRAME_STROKE, }; - explicit InfoBubbleGtk(GtkThemeProvider* provider, bool match_system_theme); + explicit InfoBubbleGtk(GtkThemeService* provider, bool match_system_theme); virtual ~InfoBubbleGtk(); // Creates the InfoBubble. @@ -166,7 +166,7 @@ class InfoBubbleGtk : public NotificationObserver { GtkWidget* window_; // Provides colors and stuff. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The accel group attached to |window_|, to handle closing with escape. GtkAccelGroup* accel_group_; diff --git a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc index a125ee1..ef766a7 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc @@ -13,7 +13,7 @@ #include "chrome/browser/platform_util.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/ui/gtk/browser_window_gtk.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" #include "content/browser/tab_contents/tab_contents.h" @@ -178,7 +178,7 @@ void InfoBarContainerGtk::ShowArrowForDelegate(InfoBarDelegate* delegate, void InfoBarContainerGtk::AddInfoBar(InfoBarDelegate* delegate, bool animate) { InfoBar* infobar = delegate->CreateInfoBar(); infobar->set_container(this); - infobar->SetThemeProvider(GtkThemeProvider::GetFrom(profile_)); + infobar->SetThemeProvider(GtkThemeService::GetFrom(profile_)); gtk_box_pack_start(GTK_BOX(widget()), infobar->widget(), FALSE, FALSE, 0); diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc index 3df712a..453db8a 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc @@ -11,7 +11,7 @@ #include "chrome/browser/ui/gtk/browser_window_gtk.h" #include "chrome/browser/ui/gtk/custom_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" #include "content/common/notification_service.h" @@ -40,7 +40,7 @@ const int InfoBar::kButtonButtonSpacing = 3; InfoBar::InfoBar(InfoBarDelegate* delegate) : container_(NULL), delegate_(delegate), - theme_provider_(NULL), + theme_service_(NULL), arrow_model_(this) { // Create |hbox_| and pad the sides. hbox_ = gtk_hbox_new(FALSE, kElementPadding); @@ -148,13 +148,13 @@ void InfoBar::Closed() { Close(); } -void InfoBar::SetThemeProvider(GtkThemeProvider* theme_provider) { - if (theme_provider_) { +void InfoBar::SetThemeProvider(GtkThemeService* theme_service) { + if (theme_service_) { NOTREACHED(); return; } - theme_provider_ = theme_provider; + theme_service_ = theme_service; registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); UpdateBorderColor(); @@ -276,7 +276,7 @@ gboolean InfoBar::OnBackgroundExpose(GtkWidget* sender, cairo_pattern_destroy(pattern); // Draw the bottom border. - GdkColor border_color = theme_provider_->GetBorderColor(); + GdkColor border_color = theme_service_->GetBorderColor(); cairo_set_source_rgb(cr, border_color.red / 65535.0, border_color.green / 65535.0, border_color.blue / 65535.0); diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.h b/chrome/browser/ui/gtk/infobars/infobar_gtk.h index 3b5d23f..cda753d 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.h +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.h @@ -18,7 +18,7 @@ #include "ui/base/gtk/gtk_signal.h" class CustomDrawButton; -class GtkThemeProvider; +class GtkThemeService; class InfoBarContainerGtk; class InfoBarDelegate; @@ -59,7 +59,7 @@ class InfoBar : public SlideAnimatorGtk::Delegate, // Returns true if the infobar is showing the close animation. bool IsClosing(); - void SetThemeProvider(GtkThemeProvider* theme_provider); + void SetThemeProvider(GtkThemeService* theme_provider); // Show an arrow that originates from another infobar (i.e. a bar was added // below this one). If |other| is NULL, stop showing the arrow. @@ -124,7 +124,7 @@ class InfoBar : public SlideAnimatorGtk::Delegate, InfoBarDelegate* delegate_; // The theme provider, used for getting border colors. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The model that tracks the paint state of the arrow for the infobar // below this one (if it exists). diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 77af1c3..29768db 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -38,7 +38,7 @@ #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" #include "chrome/browser/ui/gtk/first_run_bubble.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/nine_box.h" #include "chrome/browser/ui/gtk/rounded_window.h" @@ -164,7 +164,7 @@ LocationBarViewGtk::LocationBarViewGtk(Browser* browser) transition_(PageTransition::TYPED), first_run_bubble_(this), popup_window_mode_(false), - theme_provider_(NULL), + theme_service_(NULL), hbox_width_(0), entry_box_width_(0), show_selected_keyword_(false), @@ -323,8 +323,8 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - theme_provider_ = GtkThemeProvider::GetFrom(profile_); - theme_provider_->InitThemesFor(this); + theme_service_ = GtkThemeService::GetFrom(profile_); + theme_service_->InitThemesFor(this); } void LocationBarViewGtk::BuildSiteTypeArea() { @@ -452,7 +452,7 @@ void LocationBarViewGtk::Update(const TabContents* contents) { UpdatePageActions(); location_entry_->Update(contents); // The security level (background color) could have changed, etc. - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { // In GTK mode, we need our parent to redraw, as it draws the text entry // border. gtk_widget_queue_draw(widget()->parent); @@ -761,11 +761,11 @@ void LocationBarViewGtk::Observe(NotificationType type, const NotificationDetails& details) { DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { gtk_widget_modify_bg(tab_to_search_box_, GTK_STATE_NORMAL, NULL); - GdkColor border_color = theme_provider_->GetGdkColor( - BrowserThemeProvider::COLOR_FRAME); + GdkColor border_color = theme_service_->GetGdkColor( + ThemeService::COLOR_FRAME); gtk_util::SetRoundedWindowBorderColor(tab_to_search_box_, border_color); gtk_util::SetLabelColor(tab_to_search_full_label_, NULL); @@ -831,7 +831,7 @@ gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, // If we're not using GTK theming, draw our own border over the edge pixels // of the background. if (!profile_ || - !GtkThemeProvider::GetFrom(profile_)->UseGtkTheme()) { + !GtkThemeService::GetFrom(profile_)->UseGtkTheme()) { int left, center, right; if (popup_window_mode_) { left = right = IDR_LOCATIONBG_POPUPMODE_EDGE; @@ -861,7 +861,7 @@ void LocationBarViewGtk::UpdateSiteTypeArea() { int resource_id = location_entry_->GetIcon(); gtk_image_set_from_pixbuf(GTK_IMAGE(location_icon_image_), - theme_provider_->GetPixbufNamed(resource_id)); + theme_service_->GetPixbufNamed(resource_id)); if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { if (!gtk_util::IsActingAsRoundedWindow(site_type_event_box_)) { @@ -1085,7 +1085,7 @@ void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, if (!pixbuf) return; drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf, - GetTitle(), theme_provider_); + GetTitle(), theme_service_); g_object_unref(pixbuf); gtk_drag_set_icon_widget(context, drag_icon_, 0, 0); } @@ -1140,7 +1140,7 @@ void LocationBarViewGtk::UpdateStarIcon() { return; gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), - theme_provider_->GetPixbufNamed( + theme_service_->GetPixbufNamed( starred_ ? IDR_STAR_LIT : IDR_STAR)); } @@ -1270,7 +1270,7 @@ void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromTabContents( } gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), - GtkThemeProvider::GetFrom(profile_)->GetPixbufNamed( + GtkThemeService::GetFrom(profile_)->GetPixbufNamed( content_setting_image_model_->get_icon())); gtk_widget_set_tooltip_text(widget(), diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index 5d489b2..c0fb744 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -38,7 +38,7 @@ class CommandUpdater; class ContentSettingImageModel; class ContentSettingBubbleGtk; class ExtensionAction; -class GtkThemeProvider; +class GtkThemeService; class Profile; class SkBitmap; class TabContents; @@ -430,7 +430,7 @@ class LocationBarViewGtk : public AutocompleteEditController, bool popup_window_mode_; // Provides colors and rendering mode. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc index 064c5cc..102507c 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc @@ -20,9 +20,9 @@ #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_options_menu_model.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/themes/browser_theme_provider.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/gtk/custom_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/info_bubble_gtk.h" #include "chrome/browser/ui/gtk/menu_gtk.h" @@ -201,7 +201,7 @@ void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) { } void BalloonViewImpl::Show(Balloon* balloon) { - theme_provider_ = GtkThemeProvider::GetFrom(balloon->profile()); + theme_service_ = GtkThemeService::GetFrom(balloon->profile()); const std::string source_label_text = l10n_util::GetStringFUTF8( IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h index f065af9..49fa4db 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h @@ -23,7 +23,7 @@ class BalloonCollection; class CustomDrawButton; -class GtkThemeProvider; +class GtkThemeService; class MenuGtk; class NotificationDetails; class NotificationOptionsMenuModel; @@ -96,7 +96,7 @@ class BalloonViewImpl : public BalloonView, // Non-owned pointer to the balloon which owns this object. Balloon* balloon_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The window that contains the frame of the notification. GtkWidget* frame_container_; diff --git a/chrome/browser/ui/gtk/overflow_button.cc b/chrome/browser/ui/gtk/overflow_button.cc index 7762370..c2cab94 100644 --- a/chrome/browser/ui/gtk/overflow_button.cc +++ b/chrome/browser/ui/gtk/overflow_button.cc @@ -7,19 +7,19 @@ #include <gtk/gtk.h> #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "content/common/notification_service.h" #include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { - widget_.Own(GtkThemeProvider::GetFrom(profile)->BuildChromeButton()); + widget_.Own(GtkThemeService::GetFrom(profile)->BuildChromeButton()); gtk_widget_set_no_show_all(widget_.get(), TRUE); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); - GtkThemeProvider::GetFrom(profile)->InitThemesFor(this); + GtkThemeService::GetFrom(profile)->InitThemesFor(this); } OverflowButton::~OverflowButton() { @@ -34,7 +34,7 @@ void OverflowButton::Observe(NotificationType type, gtk_widget_destroy(former_child); GtkWidget* new_child = - GtkThemeProvider::GetFrom(profile_)->UseGtkTheme() ? + GtkThemeService::GetFrom(profile_)->UseGtkTheme() ? gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE) : gtk_image_new_from_pixbuf(ResourceBundle::GetSharedInstance(). GetRTLEnabledPixbufNamed(IDR_BOOKMARK_BAR_CHEVRONS)); diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc index 76b09cd..5a6ee14 100644 --- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc @@ -15,7 +15,7 @@ #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" #include "chrome/browser/ui/gtk/browser_window_gtk.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/info_bubble_gtk.h" #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" @@ -86,7 +86,7 @@ class PageInfoBubbleGtk : public PageInfoModel::PageInfoModelObserver, GtkWidget* anchor_; // Provides colors and stuff. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The various elements in the interface we keep track of for theme changes. std::vector<GtkWidget*> labels_; @@ -110,7 +110,7 @@ PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, cert_id_(ssl.cert_id()), parent_(parent), contents_(NULL), - theme_provider_(GtkThemeProvider::GetFrom(profile)) { + theme_service_(GtkThemeService::GetFrom(profile)) { BrowserWindowGtk* browser_window = BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); @@ -131,7 +131,7 @@ PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, arrow_location, true, // |match_system_theme| true, // |grab_input| - theme_provider_, + theme_service_, this); // |delegate| if (!bubble_) { NOTREACHED(); @@ -155,10 +155,10 @@ void PageInfoBubbleGtk::Observe(NotificationType type, it != links_.end(); ++it) { gtk_chrome_link_button_set_use_gtk_theme( GTK_CHROME_LINK_BUTTON(*it), - theme_provider_->UseGtkTheme()); + theme_service_->UseGtkTheme()); } - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { for (std::vector<GtkWidget*>::iterator it = labels_.begin(); it != labels_.end(); ++it) { gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, NULL); @@ -206,7 +206,7 @@ void PageInfoBubbleGtk::InitContents() { g_signal_connect(help_link, "clicked", G_CALLBACK(OnHelpLinkClickedThunk), this); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); gtk_widget_show_all(contents_); } diff --git a/chrome/browser/ui/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc index a91931f..34ffdf9 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.cc +++ b/chrome/browser/ui/gtk/reload_button_gtk.cc @@ -10,7 +10,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" #include "content/common/notification_source.h" @@ -32,10 +32,10 @@ ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, browser_(browser), intended_mode_(MODE_RELOAD), visible_mode_(MODE_RELOAD), - theme_provider_(browser ? - GtkThemeProvider::GetFrom(browser->profile()) : NULL), - reload_(theme_provider_, IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0), - stop_(theme_provider_, IDR_STOP, IDR_STOP_P, IDR_STOP_H, IDR_STOP_D), + theme_service_(browser ? + GtkThemeService::GetFrom(browser->profile()) : NULL), + reload_(theme_service_, IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0), + stop_(theme_service_, IDR_STOP, IDR_STOP_P, IDR_STOP_H, IDR_STOP_D), widget_(gtk_chrome_button_new()), stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)), testing_mouse_hovered_(false), @@ -57,11 +57,11 @@ ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, hover_controller_.Init(widget()); gtk_util::SetButtonTriggersNavigation(widget()); - if (theme_provider_) { - theme_provider_->InitThemesFor(this); + if (theme_service_) { + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - Source<GtkThemeProvider>(theme_provider_)); + Source<GtkThemeService>(theme_service_)); } // Set the default double-click timer delay to the system double-click time. @@ -131,9 +131,9 @@ void ReloadButtonGtk::Observe(NotificationType type, const NotificationDetails& /* details */) { DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); - GtkThemeProvider* provider = static_cast<GtkThemeProvider*>( - Source<GtkThemeProvider>(source).ptr()); - DCHECK_EQ(provider, theme_provider_); + GtkThemeService* provider = static_cast<GtkThemeService*>( + Source<GtkThemeService>(source).ptr()); + DCHECK_EQ(provider, theme_service_); GtkButtonWidth = 0; UpdateThemeButtons(); } @@ -194,7 +194,7 @@ void ReloadButtonGtk::OnClicked(GtkWidget* /* sender */) { gboolean ReloadButtonGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e) { - if (theme_provider_ && theme_provider_->UseGtkTheme()) + if (theme_service_ && theme_service_->UseGtkTheme()) return FALSE; return ((visible_mode_ == MODE_RELOAD) ? reload_ : stop_).OnExpose( widget, e, hover_controller_.GetCurrentValue()); @@ -222,7 +222,7 @@ gboolean ReloadButtonGtk::OnQueryTooltip(GtkWidget* /* sender */, } void ReloadButtonGtk::UpdateThemeButtons() { - bool use_gtk = theme_provider_ && theme_provider_->UseGtkTheme(); + bool use_gtk = theme_service_ && theme_service_->UseGtkTheme(); if (use_gtk) { gtk_widget_ensure_style(widget()); diff --git a/chrome/browser/ui/gtk/reload_button_gtk.h b/chrome/browser/ui/gtk/reload_button_gtk.h index 356b1e6..d5752fa 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.h +++ b/chrome/browser/ui/gtk/reload_button_gtk.h @@ -17,7 +17,7 @@ #include "ui/base/gtk/gtk_signal.h" class Browser; -class GtkThemeProvider; +class GtkThemeService; class LocationBarViewGtk; class Task; @@ -77,7 +77,7 @@ class ReloadButtonGtk : public NotificationObserver { // Used to listen for theme change notifications. NotificationRegistrar registrar_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; CustomDrawButtonBase reload_; CustomDrawButtonBase stop_; diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.cc b/chrome/browser/ui/gtk/status_bubble_gtk.cc index de735bb..1be0c4f 100644 --- a/chrome/browser/ui/gtk/status_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/status_bubble_gtk.cc @@ -11,7 +11,7 @@ #include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/rounded_window.h" #include "chrome/browser/ui/gtk/slide_animator_gtk.h" @@ -38,7 +38,7 @@ const int kMousePadding = 20; } // namespace StatusBubbleGtk::StatusBubbleGtk(Profile* profile) - : theme_provider_(GtkThemeProvider::GetFrom(profile)), + : theme_service_(GtkThemeService::GetFrom(profile)), padding_(NULL), flip_horizontally_(false), y_offset_(0), @@ -48,7 +48,7 @@ StatusBubbleGtk::StatusBubbleGtk(Profile* profile) ignore_next_left_content_(false) { InitWidgets(); - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); } @@ -278,7 +278,7 @@ void StatusBubbleGtk::InitWidgets() { } void StatusBubbleGtk::UserChangedTheme() { - if (theme_provider_->UseGtkTheme()) { + if (theme_service_->UseGtkTheme()) { gtk_widget_modify_fg(label_.get(), GTK_STATE_NORMAL, NULL); gtk_widget_modify_bg(container_.get(), GTK_STATE_NORMAL, NULL); } else { @@ -286,16 +286,16 @@ void StatusBubbleGtk::UserChangedTheme() { // toolbar" that I can find. Maybe in later iterations of the theme system, // there will be a better color to pick. GdkColor bookmark_text = - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + theme_service_->GetGdkColor(ThemeService::COLOR_BOOKMARK_TEXT); gtk_widget_modify_fg(label_.get(), GTK_STATE_NORMAL, &bookmark_text); GdkColor toolbar_color = - theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); + theme_service_->GetGdkColor(ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(container_.get(), GTK_STATE_NORMAL, &toolbar_color); } gtk_util::SetRoundedWindowBorderColor(container_.get(), - theme_provider_->GetBorderColor()); + theme_service_->GetBorderColor()); } void StatusBubbleGtk::SetFlipHorizontally(bool flip_horizontally) { diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.h b/chrome/browser/ui/gtk/status_bubble_gtk.h index 484d852..6d8c2c7 100644 --- a/chrome/browser/ui/gtk/status_bubble_gtk.h +++ b/chrome/browser/ui/gtk/status_bubble_gtk.h @@ -21,7 +21,7 @@ #include "ui/base/gtk/gtk_signal.h" #include "ui/gfx/point.h" -class GtkThemeProvider; +class GtkThemeService; class Profile; namespace ui { @@ -114,7 +114,7 @@ class StatusBubbleGtk : public StatusBubble, NotificationRegistrar registrar_; // Provides colors. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The toplevel event box. OwnedWidgetGtk container_; diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc index a557fe3..f3ff218 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc @@ -11,8 +11,8 @@ #include "base/i18n/rtl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model.h" -#include "chrome/browser/themes/browser_theme_provider.h" #include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" #include "content/browser/renderer_host/backing_store_x.h" diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index 18f0867..77ec714 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -13,7 +13,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" #include "chrome/browser/ui/gtk/custom_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "content/browser/tab_contents/tab_contents.h" @@ -149,7 +149,7 @@ SkColor TabRendererGtk::unselected_title_color_ = SkColorSetRGB(64, 64, 64); TabRendererGtk::LoadingAnimation::LoadingAnimation( ui::ThemeProvider* theme_provider) : data_(new Data(theme_provider)), - theme_provider_(theme_provider), + theme_service_(theme_provider), animation_state_(ANIMATION_NONE), animation_frame_(0) { registrar_.Add(this, @@ -160,7 +160,7 @@ TabRendererGtk::LoadingAnimation::LoadingAnimation( TabRendererGtk::LoadingAnimation::LoadingAnimation( const LoadingAnimation::Data& data) : data_(new Data(data)), - theme_provider_(NULL), + theme_service_(NULL), animation_state_(ANIMATION_NONE), animation_frame_(0) { } @@ -201,7 +201,7 @@ void TabRendererGtk::LoadingAnimation::Observe( const NotificationSource& source, const NotificationDetails& details) { DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); - data_.reset(new Data(theme_provider_)); + data_.reset(new Data(theme_service_)); } //////////////////////////////////////////////////////////////////////////////// @@ -285,7 +285,7 @@ void TabRendererGtk::UpdateData(TabContents* contents, bool app, bool loading_only) { DCHECK(contents); - theme_provider_ = GtkThemeProvider::GetFrom(contents->profile()); + theme_service_ = GtkThemeService::GetFrom(contents->profile()); if (!loading_only) { data_.title = contents->GetTitle(); @@ -391,10 +391,10 @@ void TabRendererGtk::PaintFaviconArea(GdkEventExpose* event) { } else { theme_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; } - if (!theme_provider_->HasCustomImage(theme_id)) + if (!theme_service_->HasCustomImage(theme_id)) offset_y = background_offset_y_; } - SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id); + SkBitmap* tab_bg = theme_service_->GetBitmapNamed(theme_id); canvas.TileImageInt(*tab_bg, x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(), favicon_bounds_.x(), favicon_bounds_.y(), @@ -409,7 +409,7 @@ void TabRendererGtk::PaintFaviconArea(GdkEventExpose* event) { canvas.saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff), SkCanvas::kARGB_ClipLayer_SaveFlag); canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); - SkBitmap* active_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR); + SkBitmap* active_bg = theme_service_->GetBitmapNamed(IDR_THEME_TOOLBAR); canvas.TileImageInt(*active_bg, x() + favicon_bounds_.x(), favicon_bounds_.y(), favicon_bounds_.x(), favicon_bounds_.y(), @@ -702,9 +702,9 @@ void TabRendererGtk::Layout() { close_button_height_); // If the close button color has changed, generate a new one. - if (theme_provider_) { + if (theme_service_) { SkColor tab_text_color = - theme_provider_->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT); + theme_service_->GetColor(ThemeService::COLOR_TAB_TEXT); if (!close_button_color_ || tab_text_color != close_button_color_) { close_button_color_ = tab_text_color; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -837,8 +837,8 @@ void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { true); } else { if (!data_.favicon.isNull()) { - if (data_.is_default_favicon && theme_provider_->UseGtkTheme()) { - GdkPixbuf* favicon = GtkThemeProvider::GetDefaultFavicon(true); + if (data_.is_default_favicon && theme_service_->UseGtkTheme()) { + GdkPixbuf* favicon = GtkThemeService::GetDefaultFavicon(true); canvas->AsCanvasSkia()->DrawGdkPixbuf( favicon, favicon_bounds_.x(), favicon_bounds_.y() + favicon_hiding_offset_); @@ -897,12 +897,12 @@ void TabRendererGtk::PaintInactiveTabBackground(gfx::Canvas* canvas) { int tab_id = data_.incognito ? IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND; - SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(tab_id); + SkBitmap* tab_bg = theme_service_->GetBitmapNamed(tab_id); // If the theme is providing a custom background image, then its top edge // should be at the top of the tab. Otherwise, we assume that the background // image is a composited foreground + frame image. - int offset_y = theme_provider_->HasCustomImage(tab_id) ? + int offset_y = theme_service_->HasCustomImage(tab_id) ? 0 : background_offset_y_; // Draw left edge. @@ -932,7 +932,7 @@ void TabRendererGtk::PaintInactiveTabBackground(gfx::Canvas* canvas) { void TabRendererGtk::PaintActiveTabBackground(gfx::Canvas* canvas) { int offset_x = background_offset_x_; - SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR); + SkBitmap* tab_bg = theme_service_->GetBitmapNamed(IDR_THEME_TOOLBAR); // Draw left edge. SkBitmap* theme_l = GetMaskedBitmap(tab_alpha_.image_l, tab_bg, offset_x, 0); diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h index 43c6b36..d061710 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h @@ -27,7 +27,7 @@ class Size; } // namespace gfx class CustomDrawButton; -class GtkThemeProvider; +class GtkThemeService; class TabContents; namespace ui { @@ -93,7 +93,7 @@ class TabRendererGtk : public ui::AnimationDelegate, NotificationRegistrar registrar_; // Gives us our throbber images. - ui::ThemeProvider* theme_provider_; + ui::ThemeProvider* theme_service_; // Current state of the animation. AnimationState animation_state_; @@ -439,7 +439,7 @@ class TabRendererGtk : public ui::AnimationDelegate, // alignment in the BrowserTitlebar. int background_offset_y_; - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The close button. scoped_ptr<CustomDrawButton> close_button_; diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 383fbf0..aa22e47 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -14,12 +14,12 @@ #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model_delegate.h" -#include "chrome/browser/themes/browser_theme_provider.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/gtk/browser_window_gtk.h" #include "chrome/browser/ui/gtk/custom_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" @@ -697,10 +697,10 @@ TabStripGtk::TabStripGtk(TabStripModel* model, BrowserWindowGtk* window) tab_vertical_offset_(0), model_(model), window_(window), - theme_provider_(GtkThemeProvider::GetFrom(model->profile())), + theme_service_(GtkThemeService::GetFrom(model->profile())), resize_layout_factory_(this), added_as_message_loop_observer_(false) { - theme_provider_->InitThemesFor(this); + theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, NotificationService::AllSources()); } @@ -1207,7 +1207,7 @@ bool TabStripGtk::HasAvailableDragActions() const { } ui::ThemeProvider* TabStripGtk::GetThemeProvider() { - return theme_provider_; + return theme_service_; } /////////////////////////////////////////////////////////////////////////////// @@ -1235,10 +1235,10 @@ void TabStripGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::BROWSER_THEME_CHANGED) { - TabRendererGtk::SetSelectedTitleColor(theme_provider_->GetColor( - BrowserThemeProvider::COLOR_TAB_TEXT)); - TabRendererGtk::SetUnselectedTitleColor(theme_provider_->GetColor( - BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT)); + TabRendererGtk::SetSelectedTitleColor(theme_service_->GetColor( + ThemeService::COLOR_TAB_TEXT)); + TabRendererGtk::SetUnselectedTitleColor(theme_service_->GetColor( + ThemeService::COLOR_BACKGROUND_TAB_TEXT)); } } diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h index c3391ba..febe4bc 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h @@ -24,7 +24,7 @@ class BrowserWindowGtk; class CustomDrawButton; class DraggedTabControllerGtk; -class GtkThemeProvider; +class GtkThemeService; class TabStripGtk : public TabStripModelObserver, public TabGtk::TabDelegate, @@ -438,7 +438,7 @@ class TabStripGtk : public TabStripModelObserver, BrowserWindowGtk* window_; // Theme resources. - GtkThemeProvider* theme_provider_; + GtkThemeService* theme_service_; // The currently running animation. scoped_ptr<TabAnimation> active_animation_; diff --git a/chrome/browser/ui/gtk/task_manager_gtk.cc b/chrome/browser/ui/gtk/task_manager_gtk.cc index 62a3a4e..d137122 100644 --- a/chrome/browser/ui/gtk/task_manager_gtk.cc +++ b/chrome/browser/ui/gtk/task_manager_gtk.cc @@ -20,7 +20,7 @@ #include "chrome/browser/memory_purger.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" -#include "chrome/browser/ui/gtk/gtk_theme_provider.h" +#include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_tree.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/common/chrome_switches.h" @@ -724,7 +724,7 @@ GdkPixbuf* TaskManagerGtk::GetModelIcon(int row) { ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_DEFAULT_FAVICON)->pixelRef()) { return static_cast<GdkPixbuf*>(g_object_ref( - GtkThemeProvider::GetDefaultFavicon(true))); + GtkThemeService::GetDefaultFavicon(true))); } return gfx::GdkPixbufFromSkBitmap(&icon); |