OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GTK_TABS_TAB_RENDERER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_ |
6 #define CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_ | 6 #define CHROME_BROWSER_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 "app/animation_delegate.h" | |
13 #include "app/gtk_signal.h" | 12 #include "app/gtk_signal.h" |
14 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
15 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
16 #include "base/string16.h" | 15 #include "base/string16.h" |
17 #include "chrome/browser/gtk/owned_widget_gtk.h" | 16 #include "chrome/browser/gtk/owned_widget_gtk.h" |
18 #include "chrome/common/notification_observer.h" | 17 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/notification_registrar.h" | 18 #include "chrome/common/notification_registrar.h" |
20 #include "gfx/canvas.h" | 19 #include "gfx/canvas.h" |
21 #include "gfx/font.h" | 20 #include "gfx/font.h" |
22 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 22 #include "third_party/skia/include/core/SkBitmap.h" |
| 23 #include "ui/base/animation/animation_delegate.h" |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 class Size; | 26 class Size; |
27 } // namespace gfx | 27 } // namespace gfx |
28 | 28 |
29 class CustomDrawButton; | 29 class CustomDrawButton; |
30 class GtkThemeProvider; | 30 class GtkThemeProvider; |
31 class SlideAnimation; | |
32 class TabContents; | 31 class TabContents; |
33 class ThemeProvider; | 32 class ThemeProvider; |
| 33 |
| 34 namespace ui { |
| 35 class SlideAnimation; |
34 class ThrobAnimation; | 36 class ThrobAnimation; |
| 37 } |
35 | 38 |
36 class TabRendererGtk : public AnimationDelegate, | 39 class TabRendererGtk : public ui::AnimationDelegate, |
37 public NotificationObserver { | 40 public NotificationObserver { |
38 public: | 41 public: |
39 // Possible animation states. | 42 // Possible animation states. |
40 enum AnimationState { | 43 enum AnimationState { |
41 ANIMATION_NONE, | 44 ANIMATION_NONE, |
42 ANIMATION_WAITING, | 45 ANIMATION_WAITING, |
43 ANIMATION_LOADING | 46 ANIMATION_LOADING |
44 }; | 47 }; |
45 | 48 |
46 class LoadingAnimation : public NotificationObserver { | 49 class LoadingAnimation : public NotificationObserver { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // TODO(jhawkins): Move into TabResources class. | 284 // TODO(jhawkins): Move into TabResources class. |
282 struct TabImage { | 285 struct TabImage { |
283 SkBitmap* image_l; | 286 SkBitmap* image_l; |
284 SkBitmap* image_c; | 287 SkBitmap* image_c; |
285 SkBitmap* image_r; | 288 SkBitmap* image_r; |
286 int l_width; | 289 int l_width; |
287 int r_width; | 290 int r_width; |
288 int y_offset; | 291 int y_offset; |
289 }; | 292 }; |
290 | 293 |
291 // Overridden from AnimationDelegate: | 294 // Overridden from ui::AnimationDelegate: |
292 virtual void AnimationProgressed(const Animation* animation); | 295 virtual void AnimationProgressed(const ui::Animation* animation); |
293 virtual void AnimationCanceled(const Animation* animation); | 296 virtual void AnimationCanceled(const ui::Animation* animation); |
294 virtual void AnimationEnded(const Animation* animation); | 297 virtual void AnimationEnded(const ui::Animation* animation); |
295 | 298 |
296 // Starts/Stops the crash animation. | 299 // Starts/Stops the crash animation. |
297 void StartCrashAnimation(); | 300 void StartCrashAnimation(); |
298 void StopCrashAnimation(); | 301 void StopCrashAnimation(); |
299 | 302 |
300 // Return true if the crash animation is currently running. | 303 // Return true if the crash animation is currently running. |
301 bool IsPerformingCrashAnimation() const; | 304 bool IsPerformingCrashAnimation() const; |
302 | 305 |
303 // Set the temporary offset for the favicon. This is used during animation. | 306 // Set the temporary offset for the favicon. This is used during animation. |
304 void SetFavIconHidingOffset(int offset); | 307 void SetFavIconHidingOffset(int offset); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 bool should_display_crashed_favicon_; | 416 bool should_display_crashed_favicon_; |
414 | 417 |
415 // The bounds of this Tab. | 418 // The bounds of this Tab. |
416 gfx::Rect bounds_; | 419 gfx::Rect bounds_; |
417 | 420 |
418 // The requested bounds of this tab. These bounds are relative to the | 421 // The requested bounds of this tab. These bounds are relative to the |
419 // tabstrip. | 422 // tabstrip. |
420 gfx::Rect requisition_; | 423 gfx::Rect requisition_; |
421 | 424 |
422 // Hover animation. | 425 // Hover animation. |
423 scoped_ptr<SlideAnimation> hover_animation_; | 426 scoped_ptr<ui::SlideAnimation> hover_animation_; |
424 | 427 |
425 // Animation used when the title of an inactive mini-tab changes. | 428 // Animation used when the title of an inactive mini-tab changes. |
426 scoped_ptr<ThrobAnimation> mini_title_animation_; | 429 scoped_ptr<ui::ThrobAnimation> mini_title_animation_; |
427 | 430 |
428 // Contains the loading animation state. | 431 // Contains the loading animation state. |
429 LoadingAnimation loading_animation_; | 432 LoadingAnimation loading_animation_; |
430 | 433 |
431 // The offset used to paint the tab theme images. | 434 // The offset used to paint the tab theme images. |
432 int background_offset_x_; | 435 int background_offset_x_; |
433 | 436 |
434 // The vertical offset used to paint the tab theme images. Controlled by the | 437 // The vertical offset used to paint the tab theme images. Controlled by the |
435 // tabstrip and plumbed here to offset the theme image by the size of the | 438 // tabstrip and plumbed here to offset the theme image by the size of the |
436 // alignment in the BrowserTitlebar. | 439 // alignment in the BrowserTitlebar. |
437 int background_offset_y_; | 440 int background_offset_y_; |
438 | 441 |
439 GtkThemeProvider* theme_provider_; | 442 GtkThemeProvider* theme_provider_; |
440 | 443 |
441 // The close button. | 444 // The close button. |
442 scoped_ptr<CustomDrawButton> close_button_; | 445 scoped_ptr<CustomDrawButton> close_button_; |
443 | 446 |
444 // The current color of the close button. | 447 // The current color of the close button. |
445 SkColor close_button_color_; | 448 SkColor close_button_color_; |
446 | 449 |
447 // Used to listen for theme change notifications. | 450 // Used to listen for theme change notifications. |
448 NotificationRegistrar registrar_; | 451 NotificationRegistrar registrar_; |
449 | 452 |
450 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); | 453 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); |
451 }; | 454 }; |
452 | 455 |
453 #endif // CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_ | 456 #endif // CHROME_BROWSER_GTK_TABS_TAB_RENDERER_GTK_H_ |
OLD | NEW |