| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void StartMiniTabTitleAnimation(); | 89 void StartMiniTabTitleAnimation(); |
| 90 void StopMiniTabTitleAnimation(); | 90 void StopMiniTabTitleAnimation(); |
| 91 | 91 |
| 92 // Set the background offset used to match the image in the inactive tab | 92 // Set the background offset used to match the image in the inactive tab |
| 93 // to the frame image. | 93 // to the frame image. |
| 94 void set_background_offset(const gfx::Point& offset) { | 94 void set_background_offset(const gfx::Point& offset) { |
| 95 background_offset_ = offset; | 95 background_offset_ = offset; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Returns true if this tab became the active tab selected in | 98 // Returns true if this tab became the active tab selected in |
| 99 // response to the last ui::ET_GESTURE_BEGIN gesture dispatched to | 99 // response to the last ui::ET_GESTURE_TAP_DOWN gesture dispatched to |
| 100 // this tab. Only used for collecting UMA metrics. | 100 // this tab. Only used for collecting UMA metrics. |
| 101 // See ash/touch/touch_uma.cc. | 101 // See ash/touch/touch_uma.cc. |
| 102 bool tab_activated_with_last_gesture_begin() const { | 102 bool tab_activated_with_last_tap_down() const { |
| 103 return tab_activated_with_last_gesture_begin_; | 103 return tab_activated_with_last_tap_down_; |
| 104 } | 104 } |
| 105 | 105 |
| 106 views::GlowHoverController* hover_controller() { | 106 views::GlowHoverController* hover_controller() { |
| 107 return &hover_controller_; | 107 return &hover_controller_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Returns the inset within the first dragged tab to use when calculating the | 110 // Returns the inset within the first dragged tab to use when calculating the |
| 111 // "drag insertion point". If we simply used the x-coordinate of the tab, | 111 // "drag insertion point". If we simply used the x-coordinate of the tab, |
| 112 // we'd be calculating based on a point well before where the user considers | 112 // we'd be calculating based on a point well before where the user considers |
| 113 // the tab to "be". The value here is chosen to "feel good" based on the | 113 // the tab to "be". The value here is chosen to "feel good" based on the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 138 static int GetImmersiveHeight(); | 138 static int GetImmersiveHeight(); |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 friend class TabTest; | 141 friend class TabTest; |
| 142 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); | 142 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); |
| 143 | 143 |
| 144 friend class TabStripTest; | 144 friend class TabStripTest; |
| 145 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); | 145 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); |
| 146 FRIEND_TEST_ALL_PREFIXES(TabStripTest, ClippedTabCloseButton); | 146 FRIEND_TEST_ALL_PREFIXES(TabStripTest, ClippedTabCloseButton); |
| 147 | 147 |
| 148 friend class TabDragController; |
| 149 friend class TabDragControllerTest; |
| 150 FRIEND_TEST_ALL_PREFIXES(TabDragControllerTest, DragWithGesture); |
| 151 |
| 148 // The animation object used to swap the favicon with the sad tab icon. | 152 // The animation object used to swap the favicon with the sad tab icon. |
| 149 class FaviconCrashAnimation; | 153 class FaviconCrashAnimation; |
| 150 class TabCloseButton; | 154 class TabCloseButton; |
| 151 | 155 |
| 152 // Contains a cached image and the values used to generate it. | 156 // Contains a cached image and the values used to generate it. |
| 153 struct ImageCacheEntry { | 157 struct ImageCacheEntry { |
| 154 ImageCacheEntry(); | 158 ImageCacheEntry(); |
| 155 ~ImageCacheEntry(); | 159 ~ImageCacheEntry(); |
| 156 | 160 |
| 157 // ID of the resource used. | 161 // ID of the resource used. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // Media indicator fade-in/out animation (i.e., only on show/hide, not a | 342 // Media indicator fade-in/out animation (i.e., only on show/hide, not a |
| 339 // continuous animation). | 343 // continuous animation). |
| 340 scoped_ptr<gfx::Animation> media_indicator_animation_; | 344 scoped_ptr<gfx::Animation> media_indicator_animation_; |
| 341 TabMediaState animating_media_state_; | 345 TabMediaState animating_media_state_; |
| 342 | 346 |
| 343 scoped_refptr<gfx::AnimationContainer> animation_container_; | 347 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 344 | 348 |
| 345 views::ImageButton* close_button_; | 349 views::ImageButton* close_button_; |
| 346 views::Label* title_; | 350 views::Label* title_; |
| 347 | 351 |
| 348 bool tab_activated_with_last_gesture_begin_; | 352 bool tab_activated_with_last_tap_down_; |
| 349 | 353 |
| 350 views::GlowHoverController hover_controller_; | 354 views::GlowHoverController hover_controller_; |
| 351 | 355 |
| 352 // The bounds of various sections of the display. | 356 // The bounds of various sections of the display. |
| 353 gfx::Rect favicon_bounds_; | 357 gfx::Rect favicon_bounds_; |
| 354 gfx::Rect media_indicator_bounds_; | 358 gfx::Rect media_indicator_bounds_; |
| 355 | 359 |
| 356 // The offset used to paint the inactive background image. | 360 // The offset used to paint the inactive background image. |
| 357 gfx::Point background_offset_; | 361 gfx::Point background_offset_; |
| 358 | 362 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 383 SkColor close_button_color_; | 387 SkColor close_button_color_; |
| 384 | 388 |
| 385 // As the majority of the tabs are inactive, and painting tabs is slowish, | 389 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 386 // we cache a handful of the inactive tab backgrounds here. | 390 // we cache a handful of the inactive tab backgrounds here. |
| 387 static ImageCache* image_cache_; | 391 static ImageCache* image_cache_; |
| 388 | 392 |
| 389 DISALLOW_COPY_AND_ASSIGN(Tab); | 393 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 390 }; | 394 }; |
| 391 | 395 |
| 392 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 396 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |