OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
18 #include "ui/base/animation/animation_delegate.h" | |
19 #include "ui/base/gtk/gtk_signal.h" | 18 #include "ui/base/gtk/gtk_signal.h" |
20 #include "ui/base/gtk/owned_widget_gtk.h" | 19 #include "ui/base/gtk/owned_widget_gtk.h" |
| 20 #include "ui/gfx/animation/animation_delegate.h" |
21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
22 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
23 #include "ui/gfx/image/cairo_cached_surface.h" | 23 #include "ui/gfx/image/cairo_cached_surface.h" |
24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
25 | 25 |
26 namespace gfx { | 26 namespace gfx { |
27 class CairoCachedSurface; | 27 class CairoCachedSurface; |
28 class Image; | 28 class Image; |
29 class Size; | 29 class Size; |
| 30 class SlideAnimation; |
| 31 class ThrobAnimation; |
30 } // namespace gfx | 32 } // namespace gfx |
31 | 33 |
32 class CustomDrawButton; | 34 class CustomDrawButton; |
33 class GtkThemeService; | 35 class GtkThemeService; |
34 | 36 |
35 namespace content { | 37 namespace content { |
36 class WebContents; | 38 class WebContents; |
37 } | 39 } |
38 | 40 |
39 namespace ui { | 41 class TabRendererGtk : public gfx::AnimationDelegate, |
40 class SlideAnimation; | |
41 class ThrobAnimation; | |
42 } | |
43 | |
44 class TabRendererGtk : public ui::AnimationDelegate, | |
45 public content::NotificationObserver { | 42 public content::NotificationObserver { |
46 public: | 43 public: |
47 // Possible animation states. | 44 // Possible animation states. |
48 enum AnimationState { | 45 enum AnimationState { |
49 ANIMATION_NONE, | 46 ANIMATION_NONE, |
50 ANIMATION_WAITING, | 47 ANIMATION_WAITING, |
51 ANIMATION_LOADING | 48 ANIMATION_LOADING |
52 }; | 49 }; |
53 | 50 |
54 class LoadingAnimation : public content::NotificationObserver { | 51 class LoadingAnimation : public content::NotificationObserver { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 bool crashed; | 258 bool crashed; |
262 bool incognito; | 259 bool incognito; |
263 bool show_icon; | 260 bool show_icon; |
264 bool mini; | 261 bool mini; |
265 bool blocked; | 262 bool blocked; |
266 bool animating_mini_change; | 263 bool animating_mini_change; |
267 bool app; | 264 bool app; |
268 CaptureState capture_state; | 265 CaptureState capture_state; |
269 }; | 266 }; |
270 | 267 |
271 // Overridden from ui::AnimationDelegate: | 268 // Overridden from gfx::AnimationDelegate: |
272 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 269 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
273 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 270 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; |
274 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 271 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
275 | 272 |
276 // Starts/Stops the crash animation. | 273 // Starts/Stops the crash animation. |
277 void StartCrashAnimation(); | 274 void StartCrashAnimation(); |
278 void StopCrashAnimation(); | 275 void StopCrashAnimation(); |
279 | 276 |
280 // Return true if the crash animation is currently running. | 277 // Return true if the crash animation is currently running. |
281 bool IsPerformingCrashAnimation() const; | 278 bool IsPerformingCrashAnimation() const; |
282 | 279 |
283 // Set the temporary offset for the favicon. This is used during animation. | 280 // Set the temporary offset for the favicon. This is used during animation. |
284 void SetFaviconHidingOffset(int offset); | 281 void SetFaviconHidingOffset(int offset); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 bool should_display_crashed_favicon_; | 398 bool should_display_crashed_favicon_; |
402 | 399 |
403 // The bounds of this Tab. | 400 // The bounds of this Tab. |
404 gfx::Rect bounds_; | 401 gfx::Rect bounds_; |
405 | 402 |
406 // The requested bounds of this tab. These bounds are relative to the | 403 // The requested bounds of this tab. These bounds are relative to the |
407 // tabstrip. | 404 // tabstrip. |
408 gfx::Rect requisition_; | 405 gfx::Rect requisition_; |
409 | 406 |
410 // Hover animation. | 407 // Hover animation. |
411 scoped_ptr<ui::SlideAnimation> hover_animation_; | 408 scoped_ptr<gfx::SlideAnimation> hover_animation_; |
412 | 409 |
413 // Animation used when the title of an inactive mini-tab changes. | 410 // Animation used when the title of an inactive mini-tab changes. |
414 scoped_ptr<ui::ThrobAnimation> mini_title_animation_; | 411 scoped_ptr<gfx::ThrobAnimation> mini_title_animation_; |
415 | 412 |
416 // Animation used when the favicon has an overlay (e.g. for recording). | 413 // Animation used when the favicon has an overlay (e.g. for recording). |
417 scoped_ptr<ui::ThrobAnimation> favicon_overlay_animation_; | 414 scoped_ptr<gfx::ThrobAnimation> favicon_overlay_animation_; |
418 | 415 |
419 // Contains the loading animation state. | 416 // Contains the loading animation state. |
420 LoadingAnimation loading_animation_; | 417 LoadingAnimation loading_animation_; |
421 | 418 |
422 // The offset used to paint the tab theme images. | 419 // The offset used to paint the tab theme images. |
423 int background_offset_x_; | 420 int background_offset_x_; |
424 | 421 |
425 // The vertical offset used to paint the tab theme images. Controlled by the | 422 // The vertical offset used to paint the tab theme images. Controlled by the |
426 // tabstrip and plumbed here to offset the theme image by the size of the | 423 // tabstrip and plumbed here to offset the theme image by the size of the |
427 // alignment in the BrowserTitlebar. | 424 // alignment in the BrowserTitlebar. |
(...skipping 13 matching lines...) Expand all Loading... |
441 // Color of the title text on the selected tab. | 438 // Color of the title text on the selected tab. |
442 SkColor selected_title_color_; | 439 SkColor selected_title_color_; |
443 | 440 |
444 // Color of the title text on an unselected tab. | 441 // Color of the title text on an unselected tab. |
445 SkColor unselected_title_color_; | 442 SkColor unselected_title_color_; |
446 | 443 |
447 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); | 444 DISALLOW_COPY_AND_ASSIGN(TabRendererGtk); |
448 }; | 445 }; |
449 | 446 |
450 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ | 447 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_RENDERER_GTK_H_ |
OLD | NEW |