diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 22:50:21 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 22:50:21 +0000 |
commit | 9c8ae2730a8da2aa7fbeaf843754fb731d6f7334 (patch) | |
tree | 136c8fc20393fda74694f1847541c705aff7dac3 /chrome | |
parent | 57313614561d4d7c53d7f41e33b275b6f5199fcf (diff) | |
download | chromium_src-9c8ae2730a8da2aa7fbeaf843754fb731d6f7334.zip chromium_src-9c8ae2730a8da2aa7fbeaf843754fb731d6f7334.tar.gz chromium_src-9c8ae2730a8da2aa7fbeaf843754fb731d6f7334.tar.bz2 |
Revert "GTK Themes: Tint throbbers like we tint all other buttons in the interface."
This reverts commit 3dfa509662e99282b5212490bfe19b32da357741 (r20799).
TBR=estade
Review URL: http://codereview.chromium.org/155598
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/dragged_tab_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_gtk.h | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 78 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.h | 23 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.h | 1 |
8 files changed, 42 insertions, 79 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index 14a4f6e..5bf91fe 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -132,7 +132,7 @@ static const int kToolbarButtonIDs[] = { IDR_MENU_PAGE, IDR_MENU_PAGE_RTL, IDR_MENU_CHROME, IDR_MENU_CHROME_RTL, IDR_MENU_DROPARROW, - IDR_THROBBER, IDR_THROBBER_WAITING, IDR_THROBBER_LIGHT + IDR_THROBBER, }; // A map for kToolbarButtonIDs. diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc index afe79c7..124f6eb 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc @@ -10,7 +10,6 @@ #include "app/gfx/canvas_paint.h" #include "base/gfx/gtk_util.h" -#include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" @@ -44,7 +43,7 @@ DraggedTabGtk::DraggedTabGtk(TabContents* datasource, const gfx::Point& mouse_tab_offset, const gfx::Size& contents_size) : backing_store_(NULL), - renderer_(new TabRendererGtk(datasource->profile()->GetThemeProvider())), + renderer_(new TabRendererGtk), attached_(false), mouse_tab_offset_(mouse_tab_offset), attached_tab_size_(TabRendererGtk::GetMinimumSelectedSize()), diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index bd63a5e..34ffee1 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -108,7 +108,7 @@ class TabGtk::ContextMenuController : public MenuGtk::Delegate { // TabGtk, public: TabGtk::TabGtk(TabDelegate* delegate) - : TabRendererGtk(delegate->GetThemeProvider()), + : TabRendererGtk(), delegate_(delegate), closing_(false), dragging_(false) { diff --git a/chrome/browser/gtk/tabs/tab_gtk.h b/chrome/browser/gtk/tabs/tab_gtk.h index 384f7f6..9abe929 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.h +++ b/chrome/browser/gtk/tabs/tab_gtk.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ #define CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ -#include "app/theme_provider.h" #include "base/basictypes.h" #include "base/message_loop.h" #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" @@ -15,8 +14,6 @@ namespace gfx { class Path; } -class ThemeProvider; - class TabGtk : public TabRendererGtk, public MessageLoopForUI::Observer { public: @@ -67,12 +64,9 @@ class TabGtk : public TabRendererGtk, // itself should move the window in cases where there's only one // non drag-able Tab. virtual bool HasAvailableDragActions() const = 0; - - // Returns the theme provider for icons and colors. - virtual ThemeProvider* GetThemeProvider() = 0; }; - TabGtk(TabDelegate* delegate); + explicit TabGtk(TabDelegate* delegate); virtual ~TabGtk(); // Access the delegate. diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 5f097d5..55e4b32 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -14,7 +14,6 @@ #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gtk_util.h" -#include "chrome/common/notification_service.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -52,39 +51,43 @@ const int kCloseButtonHorzFuzz = 5; SkBitmap* crashed_fav_icon = NULL; -} // namespace +TabRendererGtk::LoadingAnimation::Data loading_animation_data; -TabRendererGtk::LoadingAnimation::Data::Data(ThemeProvider* theme_provider) { +// Loads the loading animation images and data. +void InitializeLoadingAnimationData( + ResourceBundle* rb, TabRendererGtk::LoadingAnimation::Data* data) { // The loading animation image is a strip of states. Each state must be // square, so the height must divide the width evenly. - loading_animation_frames = theme_provider->GetBitmapNamed(IDR_THROBBER); - DCHECK(loading_animation_frames); - DCHECK_EQ(loading_animation_frames->width() % - loading_animation_frames->height(), 0); - loading_animation_frame_count = - loading_animation_frames->width() / - loading_animation_frames->height(); - - waiting_animation_frames = - theme_provider->GetBitmapNamed(IDR_THROBBER_WAITING); - DCHECK(waiting_animation_frames); - DCHECK_EQ(waiting_animation_frames->width() % - waiting_animation_frames->height(), 0); - waiting_animation_frame_count = - waiting_animation_frames->width() / - waiting_animation_frames->height(); - - waiting_to_loading_frame_count_ratio = - waiting_animation_frame_count / - loading_animation_frame_count; + data->loading_animation_frames = rb->GetBitmapNamed(IDR_THROBBER); + DCHECK(data->loading_animation_frames); + DCHECK_EQ(data->loading_animation_frames->width() % + data->loading_animation_frames->height(), 0); + data->loading_animation_frame_count = + data->loading_animation_frames->width() / + data->loading_animation_frames->height(); + + data->waiting_animation_frames = + rb->GetBitmapNamed(IDR_THROBBER_WAITING); + DCHECK(data->waiting_animation_frames); + DCHECK_EQ(data->waiting_animation_frames->width() % + data->waiting_animation_frames->height(), 0); + data->waiting_animation_frame_count = + data->waiting_animation_frames->width() / + data->waiting_animation_frames->height(); + + data->waiting_to_loading_frame_count_ratio = + data->waiting_animation_frame_count / + data->loading_animation_frame_count; // TODO(beng): eventually remove this when we have a proper themeing system. // themes not supporting IDR_THROBBER_WAITING are causing this // value to be 0 which causes DIV0 crashes. The value of 5 // matches the current bitmaps in our source. - if (waiting_to_loading_frame_count_ratio == 0) - waiting_to_loading_frame_count_ratio = 5; + if (data->waiting_to_loading_frame_count_ratio == 0) + data->waiting_to_loading_frame_count_ratio = 5; } +} // namespace + bool TabRendererGtk::initialized_ = false; TabRendererGtk::TabImage TabRendererGtk::tab_active_ = {0}; TabRendererGtk::TabImage TabRendererGtk::tab_inactive_ = {0}; @@ -101,15 +104,8 @@ int TabRendererGtk::pinned_tab_pref_width_ = 0; //////////////////////////////////////////////////////////////////////////////// // TabRendererGtk::LoadingAnimation, public: // -TabRendererGtk::LoadingAnimation::LoadingAnimation( - ThemeProvider* theme_provider) - : data_(new Data(theme_provider)), - theme_provider_(theme_provider), - animation_state_(ANIMATION_NONE), - animation_frame_(0) { - registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); +TabRendererGtk::LoadingAnimation::LoadingAnimation(const Data* data) + : data_(data), animation_state_(ANIMATION_NONE), animation_frame_(0) { } void TabRendererGtk::LoadingAnimation::ValidateLoadingAnimation( @@ -137,14 +133,6 @@ void TabRendererGtk::LoadingAnimation::ValidateLoadingAnimation( } } -void TabRendererGtk::LoadingAnimation::Observe( - NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); - data_.reset(new Data(theme_provider_)); -} - //////////////////////////////////////////////////////////////////////////////// // FaviconCrashAnimation // @@ -187,12 +175,12 @@ class TabRendererGtk::FavIconCrashAnimation : public Animation, //////////////////////////////////////////////////////////////////////////////// // TabRendererGtk, public: -TabRendererGtk::TabRendererGtk(ThemeProvider* theme_provider) +TabRendererGtk::TabRendererGtk() : showing_icon_(false), showing_close_button_(false), fav_icon_hiding_offset_(0), should_display_crashed_favicon_(false), - loading_animation_(theme_provider) { + loading_animation_(&loading_animation_data) { InitResources(); data_.pinned = false; @@ -807,6 +795,8 @@ void TabRendererGtk::InitResources() { title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 10)); title_font_height_ = title_font_->height(); + InitializeLoadingAnimationData(&rb, &loading_animation_data); + crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); initialized_ = true; diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h index a5e8e04..9f52a6c 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h @@ -14,8 +14,6 @@ #include "base/basictypes.h" #include "base/gfx/rect.h" #include "base/string16.h" -#include "chrome/common/notification_observer.h" -#include "chrome/common/notification_registrar.h" #include "chrome/common/owned_widget_gtk.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -36,11 +34,9 @@ class TabRendererGtk : public AnimationDelegate { ANIMATION_LOADING }; - class LoadingAnimation : public NotificationObserver { + class LoadingAnimation { public: struct Data { - explicit Data(ThemeProvider* theme_provider); - SkBitmap* waiting_animation_frames; SkBitmap* loading_animation_frames; int loading_animation_frame_count; @@ -48,7 +44,7 @@ class TabRendererGtk : public AnimationDelegate { int waiting_to_loading_frame_count_ratio; }; - explicit LoadingAnimation(ThemeProvider* theme_provider); + explicit LoadingAnimation(const Data* data); // Advance the loading animation to the next frame, or hide the animation if // the tab isn't loading. @@ -64,19 +60,8 @@ class TabRendererGtk : public AnimationDelegate { return data_->loading_animation_frames; } - // Provide NotificationObserver implementation. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - private: - scoped_ptr<Data> data_; - - // Used to listen for theme change notifications. - NotificationRegistrar registrar_; - - // Gives us our throbber images. - ThemeProvider* theme_provider_; + const Data* const data_; // Current state of the animation. AnimationState animation_state_; @@ -87,7 +72,7 @@ class TabRendererGtk : public AnimationDelegate { DISALLOW_COPY_AND_ASSIGN(LoadingAnimation); }; - explicit TabRendererGtk(ThemeProvider* theme_provider); + TabRendererGtk(); virtual ~TabRendererGtk(); // TabContents. If only the loading state was updated, the loading_only flag diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index ed28ffc..67e94d1 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -1088,10 +1088,6 @@ bool TabStripGtk::HasAvailableDragActions() const { return model_->delegate()->GetDragActions() != 0; } -ThemeProvider* TabStripGtk::GetThemeProvider() { - return theme_provider_; -} - /////////////////////////////////////////////////////////////////////////////// // TabStripGtk, MessageLoop::Observer implementation: diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index 94328ba..44bc870 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -121,7 +121,6 @@ class TabStripGtk : public TabStripModelObserver, virtual void ContinueDrag(GdkDragContext* context); virtual bool EndDrag(bool canceled); virtual bool HasAvailableDragActions() const; - virtual ThemeProvider* GetThemeProvider(); // MessageLoop::Observer implementation: virtual void WillProcessEvent(GdkEvent* event); |