| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/views/masked_targeter_delegate.h" | 23 #include "ui/views/masked_targeter_delegate.h" |
| 24 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
| 25 | 25 |
| 26 class AlertIndicatorButton; | 26 class AlertIndicatorButton; |
| 27 class TabController; | 27 class TabController; |
| 28 | 28 |
| 29 namespace gfx { | 29 namespace gfx { |
| 30 class Animation; | 30 class Animation; |
| 31 class AnimationContainer; | 31 class AnimationContainer; |
| 32 class LinearAnimation; | 32 class LinearAnimation; |
| 33 class MultiAnimation; | |
| 34 class ThrobAnimation; | 33 class ThrobAnimation; |
| 35 } | 34 } |
| 36 namespace views { | 35 namespace views { |
| 37 class ImageButton; | 36 class ImageButton; |
| 38 class Label; | 37 class Label; |
| 39 } | 38 } |
| 40 | 39 |
| 41 /////////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////////// |
| 42 // | 41 // |
| 43 // A View that renders a Tab in a TabStrip. | 42 // A View that renders a Tab in a TabStrip. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void SetData(const TabRendererData& data); | 89 void SetData(const TabRendererData& data); |
| 91 const TabRendererData& data() const { return data_; } | 90 const TabRendererData& data() const { return data_; } |
| 92 | 91 |
| 93 // Sets the network state. | 92 // Sets the network state. |
| 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 // Sets the visibility of the indicator shown when the tab title changes of |
| 101 void StartPinnedTabTitleAnimation(); | 100 // an inactive pinned tab. |
| 102 void StopPinnedTabTitleAnimation(); | 101 void SetPinnedTabTitleChangedIndicatorVisible(bool value); |
| 103 | 102 |
| 104 // Set the background offset used to match the image in the inactive tab | 103 // Set the background offset used to match the image in the inactive tab |
| 105 // to the frame image. | 104 // to the frame image. |
| 106 void set_background_offset(const gfx::Point& offset) { | 105 void set_background_offset(const gfx::Point& offset) { |
| 107 background_offset_ = offset; | 106 background_offset_ = offset; |
| 108 } | 107 } |
| 109 | 108 |
| 110 // Returns true if this tab became the active tab selected in | 109 // Returns true if this tab became the active tab selected in |
| 111 // response to the last ui::ET_TAP_DOWN gesture dispatched to | 110 // response to the last ui::ET_TAP_DOWN gesture dispatched to |
| 112 // this tab. Only used for collecting UMA metrics. | 111 // this tab. Only used for collecting UMA metrics. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 void DataChanged(const TabRendererData& old); | 238 void DataChanged(const TabRendererData& old); |
| 240 | 239 |
| 241 // Paint with the normal tab style. | 240 // Paint with the normal tab style. |
| 242 void PaintTab(gfx::Canvas* canvas); | 241 void PaintTab(gfx::Canvas* canvas); |
| 243 | 242 |
| 244 // Paint with the "immersive mode" light-bar style. | 243 // Paint with the "immersive mode" light-bar style. |
| 245 void PaintImmersiveTab(gfx::Canvas* canvas); | 244 void PaintImmersiveTab(gfx::Canvas* canvas); |
| 246 | 245 |
| 247 // Paint various portions of the Tab. | 246 // Paint various portions of the Tab. |
| 248 void PaintTabBackground(gfx::Canvas* canvas); | 247 void PaintTabBackground(gfx::Canvas* canvas); |
| 249 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); | |
| 250 void PaintInactiveTabBackground(gfx::Canvas* canvas); | 248 void PaintInactiveTabBackground(gfx::Canvas* canvas); |
| 251 void PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, | 249 void PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, |
| 252 bool is_active, | 250 bool is_active, |
| 253 int fill_id, | 251 int fill_id, |
| 254 bool has_custom_image, | 252 bool has_custom_image, |
| 255 int y_offset); | 253 int y_offset); |
| 256 void PaintTabFill(gfx::Canvas* canvas, | 254 void PaintTabFill(gfx::Canvas* canvas, |
| 257 gfx::ImageSkia* fill_image, | 255 gfx::ImageSkia* fill_image, |
| 258 int x_offset, | 256 int x_offset, |
| 259 int y_offset, | 257 int y_offset, |
| 260 bool is_active); | 258 bool is_active); |
| 261 | 259 |
| 260 // Paints the pinned tab title changed indicator and favicon. |favicon| may |
| 261 // be null. |favicon_draw_bounds| is |favicon_bounds_| adjusted for rtl and |
| 262 // clipped to the bounds of the tab. |
| 263 void PaintPinnedTabTitleChangedIndicatorAndIcon( |
| 264 gfx::Canvas* canvas, |
| 265 const gfx::ImageSkia& favicon, |
| 266 const gfx::Rect& favicon_draw_bounds); |
| 267 |
| 262 // Paints the favicon, mirrored for RTL if needed. | 268 // Paints the favicon, mirrored for RTL if needed. |
| 263 void PaintIcon(gfx::Canvas* canvas); | 269 void PaintIcon(gfx::Canvas* canvas); |
| 264 | 270 |
| 265 // Invoked if data_.network_state changes, or the network_state is not none. | 271 // Invoked if data_.network_state changes, or the network_state is not none. |
| 266 void AdvanceLoadingAnimation(); | 272 void AdvanceLoadingAnimation(); |
| 267 | 273 |
| 268 // Returns the number of favicon-size elements that can fit in the tab's | 274 // Returns the number of favicon-size elements that can fit in the tab's |
| 269 // current size. | 275 // current size. |
| 270 int IconCapacity() const; | 276 int IconCapacity() const; |
| 271 | 277 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 344 |
| 339 // The offset used to animate the favicon location. This is used when the tab | 345 // The offset used to animate the favicon location. This is used when the tab |
| 340 // crashes. | 346 // crashes. |
| 341 int favicon_hiding_offset_; | 347 int favicon_hiding_offset_; |
| 342 | 348 |
| 343 // Step in the immersive loading progress indicator. | 349 // Step in the immersive loading progress indicator. |
| 344 int immersive_loading_step_; | 350 int immersive_loading_step_; |
| 345 | 351 |
| 346 bool should_display_crashed_favicon_; | 352 bool should_display_crashed_favicon_; |
| 347 | 353 |
| 354 bool showing_pinned_tab_title_changed_indicator_ = false; |
| 355 |
| 348 // Whole-tab throbbing "pulse" animation. | 356 // Whole-tab throbbing "pulse" animation. |
| 349 std::unique_ptr<gfx::ThrobAnimation> pulse_animation_; | 357 std::unique_ptr<gfx::ThrobAnimation> pulse_animation_; |
| 350 | 358 |
| 351 std::unique_ptr<gfx::MultiAnimation> pinned_title_change_animation_; | |
| 352 | |
| 353 // Crash icon animation (in place of favicon). | 359 // Crash icon animation (in place of favicon). |
| 354 std::unique_ptr<gfx::LinearAnimation> crash_icon_animation_; | 360 std::unique_ptr<gfx::LinearAnimation> crash_icon_animation_; |
| 355 | 361 |
| 356 scoped_refptr<gfx::AnimationContainer> animation_container_; | 362 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 357 | 363 |
| 358 ThrobberView* throbber_; | 364 ThrobberView* throbber_; |
| 359 AlertIndicatorButton* alert_indicator_button_; | 365 AlertIndicatorButton* alert_indicator_button_; |
| 360 views::ImageButton* close_button_; | 366 views::ImageButton* close_button_; |
| 361 views::Label* title_; | 367 views::Label* title_; |
| 362 | 368 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 SkColor button_color_; | 403 SkColor button_color_; |
| 398 | 404 |
| 399 // As the majority of the tabs are inactive, and painting tabs is slowish, | 405 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 400 // we cache a handful of the inactive tab backgrounds here. | 406 // we cache a handful of the inactive tab backgrounds here. |
| 401 static ImageCache* image_cache_; | 407 static ImageCache* image_cache_; |
| 402 | 408 |
| 403 DISALLOW_COPY_AND_ASSIGN(Tab); | 409 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 404 }; | 410 }; |
| 405 | 411 |
| 406 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 412 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |