OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 15 #include "base/string16.h" |
15 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | 16 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "ui/base/animation/animation_delegate.h" | 20 #include "ui/base/animation/animation_delegate.h" |
20 #include "ui/base/gtk/gtk_signal.h" | 21 #include "ui/base/gtk/gtk_signal.h" |
21 #include "ui/base/gtk/owned_widget_gtk.h" | 22 #include "ui/base/gtk/owned_widget_gtk.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // the tab isn't loading. Returns |true| if the icon area needs to be | 70 // the tab isn't loading. Returns |true| if the icon area needs to be |
70 // repainted. | 71 // repainted. |
71 bool ValidateLoadingAnimation(AnimationState animation_state); | 72 bool ValidateLoadingAnimation(AnimationState animation_state); |
72 | 73 |
73 AnimationState animation_state() const { return animation_state_; } | 74 AnimationState animation_state() const { return animation_state_; } |
74 int animation_frame() const { return animation_frame_; } | 75 int animation_frame() const { return animation_frame_; } |
75 | 76 |
76 // Provide content::NotificationObserver implementation. | 77 // Provide content::NotificationObserver implementation. |
77 virtual void Observe(int type, | 78 virtual void Observe(int type, |
78 const content::NotificationSource& source, | 79 const content::NotificationSource& source, |
79 const content::NotificationDetails& details); | 80 const content::NotificationDetails& details) OVERRIDE; |
80 | 81 |
81 private: | 82 private: |
82 scoped_ptr<Data> data_; | 83 scoped_ptr<Data> data_; |
83 | 84 |
84 // Used to listen for theme change notifications. | 85 // Used to listen for theme change notifications. |
85 content::NotificationRegistrar registrar_; | 86 content::NotificationRegistrar registrar_; |
86 | 87 |
87 // Gives us our throbber images. | 88 // Gives us our throbber images. |
88 GtkThemeService* theme_service_; | 89 GtkThemeService* theme_service_; |
89 | 90 |
90 // Current state of the animation. | 91 // Current state of the animation. |
91 AnimationState animation_state_; | 92 AnimationState animation_state_; |
92 | 93 |
93 // The current index into the Animation image strip. | 94 // The current index into the Animation image strip. |
94 int animation_frame_; | 95 int animation_frame_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(LoadingAnimation); | 97 DISALLOW_COPY_AND_ASSIGN(LoadingAnimation); |
97 }; | 98 }; |
98 | 99 |
99 explicit TabRendererGtk(GtkThemeService* theme_service); | 100 explicit TabRendererGtk(GtkThemeService* theme_service); |
100 virtual ~TabRendererGtk(); | 101 virtual ~TabRendererGtk(); |
101 | 102 |
102 // Provide content::NotificationObserver implementation. | 103 // Provide content::NotificationObserver implementation. |
103 virtual void Observe(int type, | 104 virtual void Observe(int type, |
104 const content::NotificationSource& source, | 105 const content::NotificationSource& source, |
105 const content::NotificationDetails& details); | 106 const content::NotificationDetails& details) OVERRIDE; |
106 | 107 |
107 // TabContents. If only the loading state was updated, the loading_only flag | 108 // TabContents. If only the loading state was updated, the loading_only flag |
108 // should be specified. If other things change, set this flag to false to | 109 // should be specified. If other things change, set this flag to false to |
109 // update everything. | 110 // update everything. |
110 virtual void UpdateData(TabContents* contents, bool app, bool loading_only); | 111 virtual void UpdateData(TabContents* contents, bool app, bool loading_only); |
111 | 112 |
112 // Sets the blocked state of the tab. | 113 // Sets the blocked state of the tab. |
113 void SetBlocked(bool pinned); | 114 void SetBlocked(bool pinned); |
114 bool is_blocked() const; | 115 bool is_blocked() const; |
115 | 116 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 bool crashed; | 249 bool crashed; |
249 bool incognito; | 250 bool incognito; |
250 bool show_icon; | 251 bool show_icon; |
251 bool mini; | 252 bool mini; |
252 bool blocked; | 253 bool blocked; |
253 bool animating_mini_change; | 254 bool animating_mini_change; |
254 bool app; | 255 bool app; |
255 }; | 256 }; |
256 | 257 |
257 // Overridden from ui::AnimationDelegate: | 258 // Overridden from ui::AnimationDelegate: |
258 virtual void AnimationProgressed(const ui::Animation* animation); | 259 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
259 virtual void AnimationCanceled(const ui::Animation* animation); | 260 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
260 virtual void AnimationEnded(const ui::Animation* animation); | 261 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
261 | 262 |
262 // Starts/Stops the crash animation. | 263 // Starts/Stops the crash animation. |
263 void StartCrashAnimation(); | 264 void StartCrashAnimation(); |
264 void StopCrashAnimation(); | 265 void StopCrashAnimation(); |
265 | 266 |
266 // Return true if the crash animation is currently running. | 267 // Return true if the crash animation is currently running. |
267 bool IsPerformingCrashAnimation() const; | 268 bool IsPerformingCrashAnimation() const; |
268 | 269 |
269 // Set the temporary offset for the favicon. This is used during animation. | 270 // Set the temporary offset for the favicon. This is used during animation. |
270 void SetFaviconHidingOffset(int offset); | 271 void SetFaviconHidingOffset(int offset); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // Color of the title text on the selected tab. | 421 // Color of the title text on the selected tab. |
421 SkColor selected_title_color_; | 422 SkColor selected_title_color_; |
422 | 423 |
423 // Color of the title text on an unselected tab. | 424 // Color of the title text on an unselected tab. |
424 SkColor unselected_title_color_; | 425 SkColor unselected_title_color_; |
425 | 426 |
426 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); | 427 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); |
427 }; | 428 }; |
428 | 429 |
429 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ | 430 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ |
OLD | NEW |