| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Returns the Y inset within the tab bounds for drawing the background image. | 156 // Returns the Y inset within the tab bounds for drawing the background image. |
| 158 // This is necessary for correct vertical alignment of the frame, tab, and | 157 // This is necessary for correct vertical alignment of the frame, tab, and |
| 159 // toolbar images with custom themes. | 158 // toolbar images with custom themes. |
| 160 static int GetYInsetForActiveTabBackground(); | 159 static int GetYInsetForActiveTabBackground(); |
| 161 | 160 |
| 162 private: | 161 private: |
| 163 friend class TabTest; | 162 friend class TabTest; |
| 164 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); | |
| 165 | |
| 166 friend class TabStripTest; | 163 friend class TabStripTest; |
| 167 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); | 164 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); |
| 168 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); | 165 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); |
| 169 | 166 |
| 170 // The animation object used to swap the favicon with the sad tab icon. | 167 // The animation object used to swap the favicon with the sad tab icon. |
| 171 class FaviconCrashAnimation; | 168 class FaviconCrashAnimation; |
| 169 |
| 172 class TabCloseButton; | 170 class TabCloseButton; |
| 171 class ThrobberView; |
| 173 | 172 |
| 174 // Contains a cached image and the values used to generate it. | 173 // Contains a cached image and the values used to generate it. |
| 175 struct ImageCacheEntry { | 174 struct ImageCacheEntry { |
| 176 ImageCacheEntry(); | 175 ImageCacheEntry(); |
| 177 ~ImageCacheEntry(); | 176 ~ImageCacheEntry(); |
| 178 | 177 |
| 179 // ID of the resource used. | 178 // ID of the resource used. |
| 180 int resource_id; | 179 int resource_id; |
| 181 | 180 |
| 182 // Scale factor we're drawing it. | 181 // Scale factor we're drawing it. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void PaintTabFill(gfx::Canvas* canvas, | 251 void PaintTabFill(gfx::Canvas* canvas, |
| 253 gfx::ImageSkia* fill_image, | 252 gfx::ImageSkia* fill_image, |
| 254 int x_offset, | 253 int x_offset, |
| 255 int y_offset, | 254 int y_offset, |
| 256 bool is_active); | 255 bool is_active); |
| 257 | 256 |
| 258 // Paints the favicon, mirrored for RTL if needed. | 257 // Paints the favicon, mirrored for RTL if needed. |
| 259 void PaintIcon(gfx::Canvas* canvas); | 258 void PaintIcon(gfx::Canvas* canvas); |
| 260 | 259 |
| 261 // Invoked if data_.network_state changes, or the network_state is not none. | 260 // Invoked if data_.network_state changes, or the network_state is not none. |
| 262 void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, | 261 void AdvanceLoadingAnimation(); |
| 263 TabRendererData::NetworkState state); | |
| 264 | 262 |
| 265 // Returns the number of favicon-size elements that can fit in the tab's | 263 // Returns the number of favicon-size elements that can fit in the tab's |
| 266 // current size. | 264 // current size. |
| 267 int IconCapacity() const; | 265 int IconCapacity() const; |
| 268 | 266 |
| 269 // Returns whether the Tab should display a favicon. | 267 // Returns whether the Tab should display a favicon. |
| 270 bool ShouldShowIcon() const; | 268 bool ShouldShowIcon() const; |
| 271 | 269 |
| 272 // Returns whether the Tab should display the media indicator. | 270 // Returns whether the Tab should display the media indicator. |
| 273 bool ShouldShowMediaIndicator() const; | 271 bool ShouldShowMediaIndicator() const; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // True if the tab is being dragged. | 329 // True if the tab is being dragged. |
| 332 bool dragging_; | 330 bool dragging_; |
| 333 | 331 |
| 334 // True if the tab has been detached. | 332 // True if the tab has been detached. |
| 335 bool detached_; | 333 bool detached_; |
| 336 | 334 |
| 337 // The offset used to animate the favicon location. This is used when the tab | 335 // The offset used to animate the favicon location. This is used when the tab |
| 338 // crashes. | 336 // crashes. |
| 339 int favicon_hiding_offset_; | 337 int favicon_hiding_offset_; |
| 340 | 338 |
| 341 // The point in time when the tab icon was first painted in the waiting state. | |
| 342 base::TimeTicks waiting_start_time_; | |
| 343 | |
| 344 // The point in time when the tab icon was first painted in the loading state. | |
| 345 base::TimeTicks loading_start_time_; | |
| 346 | |
| 347 // Paint state for the throbber after the most recent waiting paint. | |
| 348 gfx::ThrobberWaitingState waiting_state_; | |
| 349 | |
| 350 // Step in the immersive loading progress indicator. | 339 // Step in the immersive loading progress indicator. |
| 351 int immersive_loading_step_; | 340 int immersive_loading_step_; |
| 352 | 341 |
| 353 bool should_display_crashed_favicon_; | 342 bool should_display_crashed_favicon_; |
| 354 | 343 |
| 355 // Whole-tab throbbing "pulse" animation. | 344 // Whole-tab throbbing "pulse" animation. |
| 356 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; | 345 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; |
| 357 | 346 |
| 358 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; | 347 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; |
| 359 | 348 |
| 360 // Crash icon animation (in place of favicon). | 349 // Crash icon animation (in place of favicon). |
| 361 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; | 350 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; |
| 362 | 351 |
| 363 scoped_refptr<gfx::AnimationContainer> animation_container_; | 352 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 364 | 353 |
| 354 ThrobberView* throbber_; |
| 365 MediaIndicatorButton* media_indicator_button_; | 355 MediaIndicatorButton* media_indicator_button_; |
| 366 views::ImageButton* close_button_; | 356 views::ImageButton* close_button_; |
| 367 views::Label* title_; | 357 views::Label* title_; |
| 368 | 358 |
| 369 bool tab_activated_with_last_tap_down_; | 359 bool tab_activated_with_last_tap_down_; |
| 370 | 360 |
| 371 views::GlowHoverController hover_controller_; | 361 views::GlowHoverController hover_controller_; |
| 372 | 362 |
| 373 // The bounds of various sections of the display. | 363 // The bounds of various sections of the display. |
| 374 gfx::Rect favicon_bounds_; | 364 gfx::Rect favicon_bounds_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 403 SkColor button_color_; | 393 SkColor button_color_; |
| 404 | 394 |
| 405 // As the majority of the tabs are inactive, and painting tabs is slowish, | 395 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 406 // we cache a handful of the inactive tab backgrounds here. | 396 // we cache a handful of the inactive tab backgrounds here. |
| 407 static ImageCache* image_cache_; | 397 static ImageCache* image_cache_; |
| 408 | 398 |
| 409 DISALLOW_COPY_AND_ASSIGN(Tab); | 399 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 410 }; | 400 }; |
| 411 | 401 |
| 412 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 402 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |