| 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_VIEWS_TABS_TAB_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void ActiveStateChanged(); | 82 void ActiveStateChanged(); |
| 83 | 83 |
| 84 // Returns true if the tab is selected. | 84 // Returns true if the tab is selected. |
| 85 bool IsSelected() const; | 85 bool IsSelected() const; |
| 86 | 86 |
| 87 // Sets the data this tabs displays. Invokes DataChanged. Should only be | 87 // Sets the data this tabs displays. Invokes DataChanged. Should only be |
| 88 // called after Tab is added to widget hierarchy. | 88 // called after Tab is added to widget hierarchy. |
| 89 void SetData(const TabRendererData& data); | 89 void SetData(const TabRendererData& data); |
| 90 const TabRendererData& data() const { return data_; } | 90 const TabRendererData& data() const { return data_; } |
| 91 | 91 |
| 92 // Sets the network state. If the network state changes NetworkStateChanged is | 92 // Sets the network state. |
| 93 // invoked. | |
| 94 void UpdateLoadingAnimation(TabRendererData::NetworkState state); | 93 void UpdateLoadingAnimation(TabRendererData::NetworkState state); |
| 95 | 94 |
| 96 // Starts/Stops a pulse animation. | 95 // Starts/Stops a pulse animation. |
| 97 void StartPulse(); | 96 void StartPulse(); |
| 98 void StopPulse(); | 97 void StopPulse(); |
| 99 | 98 |
| 100 // Start/stop the pinned tab title animation. | 99 // Start/stop the pinned tab title animation. |
| 101 void StartPinnedTabTitleAnimation(); | 100 void StartPinnedTabTitleAnimation(); |
| 102 void StopPinnedTabTitleAnimation(); | 101 void StopPinnedTabTitleAnimation(); |
| 103 | 102 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 private: | 156 private: |
| 158 friend class TabTest; | 157 friend class TabTest; |
| 159 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); | 158 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); |
| 160 | 159 |
| 161 friend class TabStripTest; | 160 friend class TabStripTest; |
| 162 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); | 161 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); |
| 163 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); | 162 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); |
| 164 | 163 |
| 165 // The animation object used to swap the favicon with the sad tab icon. | 164 // The animation object used to swap the favicon with the sad tab icon. |
| 166 class FaviconCrashAnimation; | 165 class FaviconCrashAnimation; |
| 166 |
| 167 class TabCloseButton; | 167 class TabCloseButton; |
| 168 class ThrobberView; |
| 168 | 169 |
| 169 // Contains a cached image and the values used to generate it. | 170 // Contains a cached image and the values used to generate it. |
| 170 struct ImageCacheEntry { | 171 struct ImageCacheEntry { |
| 171 ImageCacheEntry(); | 172 ImageCacheEntry(); |
| 172 ~ImageCacheEntry(); | 173 ~ImageCacheEntry(); |
| 173 | 174 |
| 174 // ID of the resource used. | 175 // ID of the resource used. |
| 175 int resource_id; | 176 int resource_id; |
| 176 | 177 |
| 177 // Scale factor we're drawing it. | 178 // Scale factor we're drawing it. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); | 241 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); |
| 241 void PaintInactiveTabBackground(gfx::Canvas* canvas); | 242 void PaintInactiveTabBackground(gfx::Canvas* canvas); |
| 242 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, | 243 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, |
| 243 int tab_id); | 244 int tab_id); |
| 244 void PaintActiveTabBackground(gfx::Canvas* canvas); | 245 void PaintActiveTabBackground(gfx::Canvas* canvas); |
| 245 | 246 |
| 246 // Paints the favicon, mirrored for RTL if needed. | 247 // Paints the favicon, mirrored for RTL if needed. |
| 247 void PaintIcon(gfx::Canvas* canvas); | 248 void PaintIcon(gfx::Canvas* canvas); |
| 248 | 249 |
| 249 // Invoked if data_.network_state changes, or the network_state is not none. | 250 // Invoked if data_.network_state changes, or the network_state is not none. |
| 250 void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, | 251 void AdvanceLoadingAnimation(); |
| 251 TabRendererData::NetworkState state); | |
| 252 | 252 |
| 253 // Returns the number of favicon-size elements that can fit in the tab's | 253 // Returns the number of favicon-size elements that can fit in the tab's |
| 254 // current size. | 254 // current size. |
| 255 int IconCapacity() const; | 255 int IconCapacity() const; |
| 256 | 256 |
| 257 // Returns whether the Tab should display a favicon. | 257 // Returns whether the Tab should display a favicon. |
| 258 bool ShouldShowIcon() const; | 258 bool ShouldShowIcon() const; |
| 259 | 259 |
| 260 // Returns whether the Tab should display the media indicator. | 260 // Returns whether the Tab should display the media indicator. |
| 261 bool ShouldShowMediaIndicator() const; | 261 bool ShouldShowMediaIndicator() const; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // True if the tab is being dragged. | 327 // True if the tab is being dragged. |
| 328 bool dragging_; | 328 bool dragging_; |
| 329 | 329 |
| 330 // True if the tab has been detached. | 330 // True if the tab has been detached. |
| 331 bool detached_; | 331 bool detached_; |
| 332 | 332 |
| 333 // The offset used to animate the favicon location. This is used when the tab | 333 // The offset used to animate the favicon location. This is used when the tab |
| 334 // crashes. | 334 // crashes. |
| 335 int favicon_hiding_offset_; | 335 int favicon_hiding_offset_; |
| 336 | 336 |
| 337 // The point in time when the tab icon was first painted in the waiting state. | |
| 338 base::TimeTicks waiting_start_time_; | |
| 339 | |
| 340 // The point in time when the tab icon was first painted in the loading state. | |
| 341 base::TimeTicks loading_start_time_; | |
| 342 | |
| 343 // Paint state for the throbber after the most recent waiting paint. | |
| 344 gfx::ThrobberWaitingState waiting_state_; | |
| 345 | |
| 346 // Step in the immersive loading progress indicator. | 337 // Step in the immersive loading progress indicator. |
| 347 int immersive_loading_step_; | 338 int immersive_loading_step_; |
| 348 | 339 |
| 349 bool should_display_crashed_favicon_; | 340 bool should_display_crashed_favicon_; |
| 350 | 341 |
| 351 // Whole-tab throbbing "pulse" animation. | 342 // Whole-tab throbbing "pulse" animation. |
| 352 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; | 343 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; |
| 353 | 344 |
| 354 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; | 345 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; |
| 355 | 346 |
| 356 // Crash icon animation (in place of favicon). | 347 // Crash icon animation (in place of favicon). |
| 357 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; | 348 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; |
| 358 | 349 |
| 359 scoped_refptr<gfx::AnimationContainer> animation_container_; | 350 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 360 | 351 |
| 352 ThrobberView* throbber_; |
| 361 MediaIndicatorButton* media_indicator_button_; | 353 MediaIndicatorButton* media_indicator_button_; |
| 362 views::ImageButton* close_button_; | 354 views::ImageButton* close_button_; |
| 363 views::Label* title_; | 355 views::Label* title_; |
| 364 | 356 |
| 365 bool tab_activated_with_last_tap_down_; | 357 bool tab_activated_with_last_tap_down_; |
| 366 | 358 |
| 367 views::GlowHoverController hover_controller_; | 359 views::GlowHoverController hover_controller_; |
| 368 | 360 |
| 369 // The bounds of various sections of the display. | 361 // The bounds of various sections of the display. |
| 370 gfx::Rect favicon_bounds_; | 362 gfx::Rect favicon_bounds_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 399 SkColor button_color_; | 391 SkColor button_color_; |
| 400 | 392 |
| 401 // As the majority of the tabs are inactive, and painting tabs is slowish, | 393 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 402 // we cache a handful of the inactive tab backgrounds here. | 394 // we cache a handful of the inactive tab backgrounds here. |
| 403 static ImageCache* image_cache_; | 395 static ImageCache* image_cache_; |
| 404 | 396 |
| 405 DISALLOW_COPY_AND_ASSIGN(Tab); | 397 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 406 }; | 398 }; |
| 407 | 399 |
| 408 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 400 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |