| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 static int GetTouchWidth(); | 148 static int GetTouchWidth(); |
| 150 | 149 |
| 151 // Returns the width for pinned tabs. Pinned tabs always have this width. | 150 // Returns the width for pinned tabs. Pinned tabs always have this width. |
| 152 static int GetPinnedWidth(); | 151 static int GetPinnedWidth(); |
| 153 | 152 |
| 154 // Returns the height for immersive mode tabs. | 153 // Returns the height for immersive mode tabs. |
| 155 static int GetImmersiveHeight(); | 154 static int GetImmersiveHeight(); |
| 156 | 155 |
| 157 private: | 156 private: |
| 158 friend class TabTest; | 157 friend class TabTest; |
| 159 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); | |
| 160 | |
| 161 friend class TabStripTest; | 158 friend class TabStripTest; |
| 162 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); | 159 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); |
| 163 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); | 160 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); |
| 164 | 161 |
| 165 // The animation object used to swap the favicon with the sad tab icon. | 162 // The animation object used to swap the favicon with the sad tab icon. |
| 166 class FaviconCrashAnimation; | 163 class FaviconCrashAnimation; |
| 164 |
| 167 class TabCloseButton; | 165 class TabCloseButton; |
| 166 class ThrobberView; |
| 168 | 167 |
| 169 // Contains a cached image and the values used to generate it. | 168 // Contains a cached image and the values used to generate it. |
| 170 struct ImageCacheEntry { | 169 struct ImageCacheEntry { |
| 171 ImageCacheEntry(); | 170 ImageCacheEntry(); |
| 172 ~ImageCacheEntry(); | 171 ~ImageCacheEntry(); |
| 173 | 172 |
| 174 // ID of the resource used. | 173 // ID of the resource used. |
| 175 int resource_id; | 174 int resource_id; |
| 176 | 175 |
| 177 // Scale factor we're drawing it. | 176 // 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); | 239 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); |
| 241 void PaintInactiveTabBackground(gfx::Canvas* canvas); | 240 void PaintInactiveTabBackground(gfx::Canvas* canvas); |
| 242 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, | 241 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, |
| 243 int tab_id); | 242 int tab_id); |
| 244 void PaintActiveTabBackground(gfx::Canvas* canvas); | 243 void PaintActiveTabBackground(gfx::Canvas* canvas); |
| 245 | 244 |
| 246 // Paints the favicon, mirrored for RTL if needed. | 245 // Paints the favicon, mirrored for RTL if needed. |
| 247 void PaintIcon(gfx::Canvas* canvas); | 246 void PaintIcon(gfx::Canvas* canvas); |
| 248 | 247 |
| 249 // Invoked if data_.network_state changes, or the network_state is not none. | 248 // Invoked if data_.network_state changes, or the network_state is not none. |
| 250 void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, | 249 void AdvanceLoadingAnimation(); |
| 251 TabRendererData::NetworkState state); | |
| 252 | 250 |
| 253 // Returns the number of favicon-size elements that can fit in the tab's | 251 // Returns the number of favicon-size elements that can fit in the tab's |
| 254 // current size. | 252 // current size. |
| 255 int IconCapacity() const; | 253 int IconCapacity() const; |
| 256 | 254 |
| 257 // Returns whether the Tab should display a favicon. | 255 // Returns whether the Tab should display a favicon. |
| 258 bool ShouldShowIcon() const; | 256 bool ShouldShowIcon() const; |
| 259 | 257 |
| 260 // Returns whether the Tab should display the media indicator. | 258 // Returns whether the Tab should display the media indicator. |
| 261 bool ShouldShowMediaIndicator() const; | 259 bool ShouldShowMediaIndicator() const; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // True if the tab is being dragged. | 325 // True if the tab is being dragged. |
| 328 bool dragging_; | 326 bool dragging_; |
| 329 | 327 |
| 330 // True if the tab has been detached. | 328 // True if the tab has been detached. |
| 331 bool detached_; | 329 bool detached_; |
| 332 | 330 |
| 333 // The offset used to animate the favicon location. This is used when the tab | 331 // The offset used to animate the favicon location. This is used when the tab |
| 334 // crashes. | 332 // crashes. |
| 335 int favicon_hiding_offset_; | 333 int favicon_hiding_offset_; |
| 336 | 334 |
| 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. | 335 // Step in the immersive loading progress indicator. |
| 347 int immersive_loading_step_; | 336 int immersive_loading_step_; |
| 348 | 337 |
| 349 bool should_display_crashed_favicon_; | 338 bool should_display_crashed_favicon_; |
| 350 | 339 |
| 351 // Whole-tab throbbing "pulse" animation. | 340 // Whole-tab throbbing "pulse" animation. |
| 352 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; | 341 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; |
| 353 | 342 |
| 354 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; | 343 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; |
| 355 | 344 |
| 356 // Crash icon animation (in place of favicon). | 345 // Crash icon animation (in place of favicon). |
| 357 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; | 346 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; |
| 358 | 347 |
| 359 scoped_refptr<gfx::AnimationContainer> animation_container_; | 348 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 360 | 349 |
| 350 ThrobberView* throbber_; |
| 361 MediaIndicatorButton* media_indicator_button_; | 351 MediaIndicatorButton* media_indicator_button_; |
| 362 views::ImageButton* close_button_; | 352 views::ImageButton* close_button_; |
| 363 views::Label* title_; | 353 views::Label* title_; |
| 364 | 354 |
| 365 bool tab_activated_with_last_tap_down_; | 355 bool tab_activated_with_last_tap_down_; |
| 366 | 356 |
| 367 views::GlowHoverController hover_controller_; | 357 views::GlowHoverController hover_controller_; |
| 368 | 358 |
| 369 // The bounds of various sections of the display. | 359 // The bounds of various sections of the display. |
| 370 gfx::Rect favicon_bounds_; | 360 gfx::Rect favicon_bounds_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 399 SkColor button_color_; | 389 SkColor button_color_; |
| 400 | 390 |
| 401 // As the majority of the tabs are inactive, and painting tabs is slowish, | 391 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 402 // we cache a handful of the inactive tab backgrounds here. | 392 // we cache a handful of the inactive tab backgrounds here. |
| 403 static ImageCache* image_cache_; | 393 static ImageCache* image_cache_; |
| 404 | 394 |
| 405 DISALLOW_COPY_AND_ASSIGN(Tab); | 395 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 406 }; | 396 }; |
| 407 | 397 |
| 408 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 398 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |