Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/ui/views/tabs/base_tab.h

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_UI_VIEWS_TABS_BASE_TAB_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
7 #pragma once 7 #pragma once
8 8
9 #include "app/animation_container.h"
10 #include "app/animation_delegate.h"
11 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
13 #include "chrome/browser/views/tabs/tab_renderer_data.h" 11 #include "chrome/browser/views/tabs/tab_renderer_data.h"
12 #include "ui/base/animation/animation_container.h"
13 #include "ui/base/animation/animation_delegate.h"
14 #include "views/controls/button/button.h" 14 #include "views/controls/button/button.h"
15 #include "views/view.h" 15 #include "views/view.h"
16 16
17 class AnimationContainer;
18 class BaseTab; 17 class BaseTab;
19 class SlideAnimation;
20 class TabController; 18 class TabController;
21 class ThrobAnimation;
22 19
23 namespace gfx { 20 namespace gfx {
24 class Font; 21 class Font;
25 } // namespace gfx 22 }
23
24 namespace ui {
25 class AnimationContainer;
26 class SlideAnimation;
27 class ThrobAnimation;
28 }
26 29
27 namespace views { 30 namespace views {
28 class ImageButton; 31 class ImageButton;
29 } // namespace views 32 }
30 33
31 // Base class for tab renderers. 34 // Base class for tab renderers.
32 class BaseTab : public AnimationDelegate, 35 class BaseTab : public ui::AnimationDelegate,
33 public views::ButtonListener, 36 public views::ButtonListener,
34 public views::ContextMenuController, 37 public views::ContextMenuController,
35 public views::View { 38 public views::View {
36 public: 39 public:
37 explicit BaseTab(TabController* controller); 40 explicit BaseTab(TabController* controller);
38 virtual ~BaseTab(); 41 virtual ~BaseTab();
39 42
40 // Sets the data this tabs displays. Invokes DataChanged for subclasses to 43 // Sets the data this tabs displays. Invokes DataChanged for subclasses to
41 // update themselves appropriately. 44 // update themselves appropriately.
42 void SetData(const TabRendererData& data); 45 void SetData(const TabRendererData& data);
43 const TabRendererData& data() const { return data_; } 46 const TabRendererData& data() const { return data_; }
44 47
45 // Sets the network state. If the network state changes NetworkStateChanged is 48 // Sets the network state. If the network state changes NetworkStateChanged is
46 // invoked. 49 // invoked.
47 virtual void UpdateLoadingAnimation(TabRendererData::NetworkState state); 50 virtual void UpdateLoadingAnimation(TabRendererData::NetworkState state);
48 51
49 // Starts/Stops a pulse animation. 52 // Starts/Stops a pulse animation.
50 void StartPulse(); 53 void StartPulse();
51 void StopPulse(); 54 void StopPulse();
52 55
53 // Used to set/check whether this Tab is being animated closed. 56 // Used to set/check whether this Tab is being animated closed.
54 void set_closing(bool closing) { closing_ = closing; } 57 void set_closing(bool closing) { closing_ = closing; }
55 bool closing() const { return closing_; } 58 bool closing() const { return closing_; }
56 59
57 // See description above field. 60 // See description above field.
58 void set_dragging(bool dragging) { dragging_ = dragging; } 61 void set_dragging(bool dragging) { dragging_ = dragging; }
59 bool dragging() const { return dragging_; } 62 bool dragging() const { return dragging_; }
60 63
61 // Sets the container all animations run from. 64 // Sets the container all animations run from.
62 void set_animation_container(AnimationContainer* container) { 65 void set_animation_container(ui::AnimationContainer* container) {
63 animation_container_ = container; 66 animation_container_ = container;
64 } 67 }
65 AnimationContainer* animation_container() const { 68 ui::AnimationContainer* animation_container() const {
66 return animation_container_.get(); 69 return animation_container_.get();
67 } 70 }
68 71
69 // Set the theme provider - because we get detached, we are frequently 72 // Set the theme provider - because we get detached, we are frequently
70 // outside of a hierarchy with a theme provider at the top. This should be 73 // outside of a hierarchy with a theme provider at the top. This should be
71 // called whenever we're detached or attached to a hierarchy. 74 // called whenever we're detached or attached to a hierarchy.
72 void set_theme_provider(ThemeProvider* provider) { 75 void set_theme_provider(ThemeProvider* provider) {
73 theme_provider_ = provider; 76 theme_provider_ = provider;
74 } 77 }
75 78
(...skipping 19 matching lines...) Expand all
95 virtual void DataChanged(const TabRendererData& old) {} 98 virtual void DataChanged(const TabRendererData& old) {}
96 99
97 // Invoked if data_.network_state changes, or the network_state is not none. 100 // Invoked if data_.network_state changes, or the network_state is not none.
98 virtual void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, 101 virtual void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state,
99 TabRendererData::NetworkState state); 102 TabRendererData::NetworkState state);
100 103
101 TabController* controller() const { return controller_; } 104 TabController* controller() const { return controller_; }
102 105
103 // Returns the pulse animation. The pulse animation is non-null if StartPulse 106 // Returns the pulse animation. The pulse animation is non-null if StartPulse
104 // has been invoked. 107 // has been invoked.
105 ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); } 108 ui::ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); }
106 109
107 // Returns the hover animation. This may return null. 110 // Returns the hover animation. This may return null.
108 const SlideAnimation* hover_animation() const { 111 const ui::SlideAnimation* hover_animation() const {
109 return hover_animation_.get(); 112 return hover_animation_.get();
110 } 113 }
111 114
112 views::ImageButton* close_button() const { return close_button_; } 115 views::ImageButton* close_button() const { return close_button_; }
113 116
114 // Paints the icon at the specified coordinates, mirrored for RTL if needed. 117 // Paints the icon at the specified coordinates, mirrored for RTL if needed.
115 void PaintIcon(gfx::Canvas* canvas, int x, int y); 118 void PaintIcon(gfx::Canvas* canvas, int x, int y);
116 void PaintTitle(gfx::Canvas* canvas, SkColor title_color); 119 void PaintTitle(gfx::Canvas* canvas, SkColor title_color);
117 120
118 // Overridden from AnimationDelegate: 121 // Overridden from AnimationDelegate:
119 virtual void AnimationProgressed(const Animation* animation); 122 virtual void AnimationProgressed(const ui::Animation* animation);
120 virtual void AnimationCanceled(const Animation* animation); 123 virtual void AnimationCanceled(const ui::Animation* animation);
121 virtual void AnimationEnded(const Animation* animation); 124 virtual void AnimationEnded(const ui::Animation* animation);
122 125
123 // views::ButtonListener overrides: 126 // views::ButtonListener overrides:
124 virtual void ButtonPressed(views::Button* sender, 127 virtual void ButtonPressed(views::Button* sender,
125 const views::Event& event); 128 const views::Event& event);
126 129
127 // views::ContextMenuController overrides: 130 // views::ContextMenuController overrides:
128 virtual void ShowContextMenu(views::View* source, 131 virtual void ShowContextMenu(views::View* source,
129 const gfx::Point& p, 132 const gfx::Point& p,
130 bool is_mouse_gesture); 133 bool is_mouse_gesture);
131 134
(...skipping 29 matching lines...) Expand all
161 164
162 TabRendererData data_; 165 TabRendererData data_;
163 166
164 // True if the tab is being animated closed. 167 // True if the tab is being animated closed.
165 bool closing_; 168 bool closing_;
166 169
167 // True if the tab is being dragged. 170 // True if the tab is being dragged.
168 bool dragging_; 171 bool dragging_;
169 172
170 // Pulse animation. 173 // Pulse animation.
171 scoped_ptr<ThrobAnimation> pulse_animation_; 174 scoped_ptr<ui::ThrobAnimation> pulse_animation_;
172 175
173 // Hover animation. 176 // Hover animation.
174 scoped_ptr<SlideAnimation> hover_animation_; 177 scoped_ptr<ui::SlideAnimation> hover_animation_;
175 178
176 // Crash animation. 179 // Crash animation.
177 scoped_ptr<FavIconCrashAnimation> crash_animation_; 180 scoped_ptr<FavIconCrashAnimation> crash_animation_;
178 181
179 scoped_refptr<AnimationContainer> animation_container_; 182 scoped_refptr<ui::AnimationContainer> animation_container_;
180 183
181 views::ImageButton* close_button_; 184 views::ImageButton* close_button_;
182 185
183 // The current index of the loading animation. 186 // The current index of the loading animation.
184 int loading_animation_frame_; 187 int loading_animation_frame_;
185 188
186 // Whether to disable throbber animations. Only true if this is an app tab 189 // Whether to disable throbber animations. Only true if this is an app tab
187 // renderer and a command line flag has been passed in to disable the 190 // renderer and a command line flag has been passed in to disable the
188 // animations. 191 // animations.
189 bool throbber_disabled_; 192 bool throbber_disabled_;
190 193
191 ThemeProvider* theme_provider_; 194 ThemeProvider* theme_provider_;
192 195
193 // The offset used to animate the favicon location. This is used when the tab 196 // The offset used to animate the favicon location. This is used when the tab
194 // crashes. 197 // crashes.
195 int fav_icon_hiding_offset_; 198 int fav_icon_hiding_offset_;
196 199
197 bool should_display_crashed_favicon_; 200 bool should_display_crashed_favicon_;
198 201
199 static gfx::Font* font_; 202 static gfx::Font* font_;
200 static int font_height_; 203 static int font_height_;
201 204
202 DISALLOW_COPY_AND_ASSIGN(BaseTab); 205 DISALLOW_COPY_AND_ASSIGN(BaseTab);
203 }; 206 };
204 207
205 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_ 208 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/status_bubble_views.cc ('k') | chrome/browser/ui/views/tabs/base_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698