| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 /////////////////////////////////////////////////////////////////////////////// | 45 /////////////////////////////////////////////////////////////////////////////// |
| 46 class Tab : public gfx::AnimationDelegate, | 46 class Tab : public gfx::AnimationDelegate, |
| 47 public views::ButtonListener, | 47 public views::ButtonListener, |
| 48 public views::ContextMenuController, | 48 public views::ContextMenuController, |
| 49 public views::MaskedTargeterDelegate, | 49 public views::MaskedTargeterDelegate, |
| 50 public views::View { | 50 public views::View { |
| 51 public: | 51 public: |
| 52 // The Tab's class name. | 52 // The Tab's class name. |
| 53 static const char kViewClassName[]; | 53 static const char kViewClassName[]; |
| 54 | 54 |
| 55 explicit Tab(TabController* controller); | 55 Tab(TabController* controller, gfx::AnimationContainer* container); |
| 56 ~Tab() override; | 56 ~Tab() override; |
| 57 | 57 |
| 58 TabController* controller() const { return controller_; } | 58 TabController* controller() const { return controller_; } |
| 59 | 59 |
| 60 // Used to set/check whether this Tab is being animated closed. | 60 // Used to set/check whether this Tab is being animated closed. |
| 61 void set_closing(bool closing) { closing_ = closing; } | 61 void set_closing(bool closing) { closing_ = closing; } |
| 62 bool closing() const { return closing_; } | 62 bool closing() const { return closing_; } |
| 63 | 63 |
| 64 // See description above field. | 64 // See description above field. |
| 65 void set_dragging(bool dragging) { dragging_ = dragging; } | 65 void set_dragging(bool dragging) { dragging_ = dragging; } |
| 66 bool dragging() const { return dragging_; } | 66 bool dragging() const { return dragging_; } |
| 67 | 67 |
| 68 // Used to mark the tab as having been detached. Once this has happened, the | 68 // Used to mark the tab as having been detached. Once this has happened, the |
| 69 // tab should be invisibly closed. This is irreversible. | 69 // tab should be invisibly closed. This is irreversible. |
| 70 void set_detached() { detached_ = true; } | 70 void set_detached() { detached_ = true; } |
| 71 bool detached() const { return detached_; } | 71 bool detached() const { return detached_; } |
| 72 | 72 |
| 73 SkColor button_color() const { return button_color_; } | 73 SkColor button_color() const { return button_color_; } |
| 74 | 74 |
| 75 // Sets the container all animations run from. | |
| 76 void SetAnimationContainer(gfx::AnimationContainer* container); | |
| 77 | |
| 78 // Returns true if this tab is the active tab. | 75 // Returns true if this tab is the active tab. |
| 79 bool IsActive() const; | 76 bool IsActive() const; |
| 80 | 77 |
| 81 // Notifies the MediaIndicatorButton that the active state of this tab has | 78 // Notifies the MediaIndicatorButton that the active state of this tab has |
| 82 // changed. | 79 // changed. |
| 83 void ActiveStateChanged(); | 80 void ActiveStateChanged(); |
| 84 | 81 |
| 85 // Called when the media indicator has changed states. | 82 // Called when the media indicator has changed states. |
| 86 void MediaStateChanged(); | 83 void MediaStateChanged(); |
| 87 | 84 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 237 |
| 241 // Invoked from SetData after |data_| has been updated to the new data. | 238 // Invoked from SetData after |data_| has been updated to the new data. |
| 242 void DataChanged(const TabRendererData& old); | 239 void DataChanged(const TabRendererData& old); |
| 243 | 240 |
| 244 // Paint with the normal tab style. | 241 // Paint with the normal tab style. |
| 245 void PaintTab(gfx::Canvas* canvas); | 242 void PaintTab(gfx::Canvas* canvas); |
| 246 | 243 |
| 247 // Paint with the "immersive mode" light-bar style. | 244 // Paint with the "immersive mode" light-bar style. |
| 248 void PaintImmersiveTab(gfx::Canvas* canvas); | 245 void PaintImmersiveTab(gfx::Canvas* canvas); |
| 249 | 246 |
| 250 // Paint various portions of the Tab | 247 // Paint various portions of the Tab. |
| 251 void PaintTabBackground(gfx::Canvas* canvas); | 248 void PaintTabBackground(gfx::Canvas* canvas); |
| 252 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); | 249 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); |
| 253 void PaintInactiveTabBackground(gfx::Canvas* canvas); | 250 void PaintInactiveTabBackground(gfx::Canvas* canvas); |
| 254 void PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, | 251 void PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, |
| 255 bool is_active, | 252 bool is_active, |
| 256 int fill_id, | 253 int fill_id, |
| 257 bool has_custom_image, | 254 bool has_custom_image, |
| 258 int y_offset); | 255 int y_offset); |
| 259 void PaintTabFill(gfx::Canvas* canvas, | 256 void PaintTabFill(gfx::Canvas* canvas, |
| 260 gfx::ImageSkia* fill_image, | 257 gfx::ImageSkia* fill_image, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 SkColor button_color_; | 397 SkColor button_color_; |
| 401 | 398 |
| 402 // As the majority of the tabs are inactive, and painting tabs is slowish, | 399 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 403 // we cache a handful of the inactive tab backgrounds here. | 400 // we cache a handful of the inactive tab backgrounds here. |
| 404 static ImageCache* image_cache_; | 401 static ImageCache* image_cache_; |
| 405 | 402 |
| 406 DISALLOW_COPY_AND_ASSIGN(Tab); | 403 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 407 }; | 404 }; |
| 408 | 405 |
| 409 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 406 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |