| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_TABS_TAB_RENDERER_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ |
| 6 #define CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ | 6 #define CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ |
| 7 | 7 |
| 8 #include "app/animation.h" | 8 #include "app/animation.h" |
| 9 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
| 10 #include "app/throb_animation.h" | 10 #include "app/throb_animation.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 int IconCapacity() const; | 128 int IconCapacity() const; |
| 129 | 129 |
| 130 // Returns whether the Tab should display a favicon. | 130 // Returns whether the Tab should display a favicon. |
| 131 bool ShouldShowIcon() const; | 131 bool ShouldShowIcon() const; |
| 132 | 132 |
| 133 // Returns whether the Tab should display a close button. | 133 // Returns whether the Tab should display a close button. |
| 134 bool ShouldShowCloseBox() const; | 134 bool ShouldShowCloseBox() const; |
| 135 | 135 |
| 136 // The bounds of various sections of the display. | 136 // The bounds of various sections of the display. |
| 137 gfx::Rect favicon_bounds_; | 137 gfx::Rect favicon_bounds_; |
| 138 gfx::Rect download_icon_bounds_; | |
| 139 gfx::Rect title_bounds_; | 138 gfx::Rect title_bounds_; |
| 140 | 139 |
| 141 // Current state of the animation. | 140 // Current state of the animation. |
| 142 AnimationState animation_state_; | 141 AnimationState animation_state_; |
| 143 | 142 |
| 144 // The current index into the Animation image strip. | 143 // The current index into the Animation image strip. |
| 145 int animation_frame_; | 144 int animation_frame_; |
| 146 | 145 |
| 147 // Close Button. | 146 // Close Button. |
| 148 views::ImageButton* close_button_; | 147 views::ImageButton* close_button_; |
| 149 | 148 |
| 150 // Hover animation. | 149 // Hover animation. |
| 151 scoped_ptr<SlideAnimation> hover_animation_; | 150 scoped_ptr<SlideAnimation> hover_animation_; |
| 152 | 151 |
| 153 // Pulse animation. | 152 // Pulse animation. |
| 154 scoped_ptr<ThrobAnimation> pulse_animation_; | 153 scoped_ptr<ThrobAnimation> pulse_animation_; |
| 155 | 154 |
| 156 // Model data. We store this here so that we don't need to ask the underlying | 155 // Model data. We store this here so that we don't need to ask the underlying |
| 157 // model, which is tricky since instances of this object can outlive the | 156 // model, which is tricky since instances of this object can outlive the |
| 158 // corresponding objects in the underlying model. | 157 // corresponding objects in the underlying model. |
| 159 struct TabData { | 158 struct TabData { |
| 160 SkBitmap favicon; | 159 SkBitmap favicon; |
| 161 std::wstring title; | 160 std::wstring title; |
| 162 bool loading; | 161 bool loading; |
| 163 bool crashed; | 162 bool crashed; |
| 164 bool off_the_record; | 163 bool off_the_record; |
| 165 bool show_icon; | 164 bool show_icon; |
| 166 bool show_download_icon; | |
| 167 }; | 165 }; |
| 168 TabData data_; | 166 TabData data_; |
| 169 | 167 |
| 170 struct TabImage { | 168 struct TabImage { |
| 171 SkBitmap* image_l; | 169 SkBitmap* image_l; |
| 172 SkBitmap* image_c; | 170 SkBitmap* image_c; |
| 173 SkBitmap* image_r; | 171 SkBitmap* image_r; |
| 174 int l_width; | 172 int l_width; |
| 175 int r_width; | 173 int r_width; |
| 176 }; | 174 }; |
| 177 static TabImage tab_active; | 175 static TabImage tab_active; |
| 178 static TabImage tab_inactive; | 176 static TabImage tab_inactive; |
| 179 static TabImage tab_alpha; | 177 static TabImage tab_alpha; |
| 180 static TabImage tab_hover; | 178 static TabImage tab_hover; |
| 181 | 179 |
| 182 // Whether we're showing the icon. It is cached so that we can detect when it | 180 // Whether we're showing the icon. It is cached so that we can detect when it |
| 183 // changes and layout appropriately. | 181 // changes and layout appropriately. |
| 184 bool showing_icon_; | 182 bool showing_icon_; |
| 185 | 183 |
| 186 // Whether we are showing the download icon. Comes from the model. | |
| 187 bool showing_download_icon_; | |
| 188 | |
| 189 // Whether we are showing the close button. It is cached so that we can | 184 // Whether we are showing the close button. It is cached so that we can |
| 190 // detect when it changes and layout appropriately. | 185 // detect when it changes and layout appropriately. |
| 191 bool showing_close_button_; | 186 bool showing_close_button_; |
| 192 | 187 |
| 193 // The offset used to animate the favicon location. | 188 // The offset used to animate the favicon location. |
| 194 int fav_icon_hiding_offset_; | 189 int fav_icon_hiding_offset_; |
| 195 | 190 |
| 196 // The animation object used to swap the favicon with the sad tab icon. | 191 // The animation object used to swap the favicon with the sad tab icon. |
| 197 class FavIconCrashAnimation; | 192 class FavIconCrashAnimation; |
| 198 FavIconCrashAnimation* crash_animation_; | 193 FavIconCrashAnimation* crash_animation_; |
| 199 | 194 |
| 200 bool should_display_crashed_favicon_; | 195 bool should_display_crashed_favicon_; |
| 201 | 196 |
| 202 ThemeProvider* theme_provider_; | 197 ThemeProvider* theme_provider_; |
| 203 | 198 |
| 204 static void InitClass(); | 199 static void InitClass(); |
| 205 static bool initialized_; | 200 static bool initialized_; |
| 206 | 201 |
| 207 DISALLOW_EVIL_CONSTRUCTORS(TabRenderer); | 202 DISALLOW_EVIL_CONSTRUCTORS(TabRenderer); |
| 208 }; | 203 }; |
| 209 | 204 |
| 210 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ | 205 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ |
| OLD | NEW |