| 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 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/ui/tabs/tab_audio_indicator.h" |
| 13 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 14 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| 14 #include "ui/base/animation/animation_delegate.h" | 15 #include "ui/base/animation/animation_delegate.h" |
| 15 #include "ui/base/layout.h" | 16 #include "ui/base/layout.h" |
| 16 #include "ui/gfx/point.h" | 17 #include "ui/gfx/point.h" |
| 17 #include "ui/views/context_menu_controller.h" | 18 #include "ui/views/context_menu_controller.h" |
| 18 #include "ui/views/controls/button/button.h" | 19 #include "ui/views/controls/button/button.h" |
| 19 #include "ui/views/controls/glow_hover_controller.h" | 20 #include "ui/views/controls/glow_hover_controller.h" |
| 20 #include "ui/views/view.h" | 21 #include "ui/views/view.h" |
| 21 | 22 |
| 22 class TabController; | 23 class TabController; |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 class Font; | 26 class Font; |
| 26 } | 27 } |
| 27 namespace ui { | 28 namespace ui { |
| 28 class Animation; | 29 class Animation; |
| 29 class AnimationContainer; | 30 class AnimationContainer; |
| 30 class LinearAnimation; | 31 class LinearAnimation; |
| 31 class MultiAnimation; | 32 class MultiAnimation; |
| 32 } | 33 } |
| 33 namespace views { | 34 namespace views { |
| 34 class ImageButton; | 35 class ImageButton; |
| 35 } | 36 } |
| 36 | 37 |
| 37 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
| 38 // | 39 // |
| 39 // A View that renders a Tab, either in a TabStrip or in a DraggedTabView. | 40 // A View that renders a Tab, either in a TabStrip or in a DraggedTabView. |
| 40 // | 41 // |
| 41 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
| 42 class Tab : public ui::AnimationDelegate, | 43 class Tab : public TabAudioIndicator::Delegate, |
| 44 public ui::AnimationDelegate, |
| 43 public views::ButtonListener, | 45 public views::ButtonListener, |
| 44 public views::ContextMenuController, | 46 public views::ContextMenuController, |
| 45 public views::View { | 47 public views::View { |
| 46 public: | 48 public: |
| 47 // The menu button's class name. | 49 // The menu button's class name. |
| 48 static const char kViewClassName[]; | 50 static const char kViewClassName[]; |
| 49 | 51 |
| 50 explicit Tab(TabController* controller); | 52 explicit Tab(TabController* controller); |
| 51 virtual ~Tab(); | 53 virtual ~Tab(); |
| 52 | 54 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 139 |
| 138 // Scale factor we're drawing it. | 140 // Scale factor we're drawing it. |
| 139 ui::ScaleFactor scale_factor; | 141 ui::ScaleFactor scale_factor; |
| 140 | 142 |
| 141 // The image. | 143 // The image. |
| 142 gfx::ImageSkia image; | 144 gfx::ImageSkia image; |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 typedef std::list<ImageCacheEntry> ImageCache; | 147 typedef std::list<ImageCacheEntry> ImageCache; |
| 146 | 148 |
| 149 // Overridden from TabAudioIndicator::Delegate: |
| 150 virtual void ScheduleAudioIndicatorPaint() OVERRIDE; |
| 151 |
| 147 // Overridden from ui::AnimationDelegate: | 152 // Overridden from ui::AnimationDelegate: |
| 148 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 153 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 149 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 154 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
| 150 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 155 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 151 | 156 |
| 152 // Overridden from views::ButtonListener: | 157 // Overridden from views::ButtonListener: |
| 153 virtual void ButtonPressed(views::Button* sender, | 158 virtual void ButtonPressed(views::Button* sender, |
| 154 const ui::Event& event) OVERRIDE; | 159 const ui::Event& event) OVERRIDE; |
| 155 | 160 |
| 156 // Overridden from views::ContextMenuController: | 161 // Overridden from views::ContextMenuController: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Set the temporary offset for the favicon. This is used during the crash | 235 // Set the temporary offset for the favicon. This is used during the crash |
| 231 // animation. | 236 // animation. |
| 232 void SetFaviconHidingOffset(int offset); | 237 void SetFaviconHidingOffset(int offset); |
| 233 | 238 |
| 234 void DisplayCrashedFavicon(); | 239 void DisplayCrashedFavicon(); |
| 235 void ResetCrashedFavicon(); | 240 void ResetCrashedFavicon(); |
| 236 | 241 |
| 237 void StopIconAnimation(); | 242 void StopIconAnimation(); |
| 238 void StartCrashAnimation(); | 243 void StartCrashAnimation(); |
| 239 void StartRecordingAnimation(); | 244 void StartRecordingAnimation(); |
| 240 void StartAudioPlayingAnimation(); | |
| 241 | 245 |
| 242 // Returns true if the crash animation is currently running. | 246 // Returns true if the crash animation is currently running. |
| 243 bool IsPerformingCrashAnimation() const; | 247 bool IsPerformingCrashAnimation() const; |
| 244 | 248 |
| 245 // Schedules repaint task for icon. | 249 // Schedules repaint task for icon. |
| 246 void ScheduleIconPaint(); | 250 void ScheduleIconPaint(); |
| 247 | 251 |
| 248 // Returns the rectangle for the light bar in immersive mode. | 252 // Returns the rectangle for the light bar in immersive mode. |
| 249 gfx::Rect GetImmersiveBarRect() const; | 253 gfx::Rect GetImmersiveBarRect() const; |
| 250 | 254 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 305 |
| 302 // The tab and the icon can both be animating. The tab 'throbs' by changing | 306 // The tab and the icon can both be animating. The tab 'throbs' by changing |
| 303 // color. The icon can have one of several of animations like crashing, | 307 // color. The icon can have one of several of animations like crashing, |
| 304 // recording, projecting, etc. Note that the icon animation related to network | 308 // recording, projecting, etc. Note that the icon animation related to network |
| 305 // state does not have an animation associated with it. | 309 // state does not have an animation associated with it. |
| 306 scoped_ptr<ui::Animation> tab_animation_; | 310 scoped_ptr<ui::Animation> tab_animation_; |
| 307 scoped_ptr<ui::LinearAnimation> icon_animation_; | 311 scoped_ptr<ui::LinearAnimation> icon_animation_; |
| 308 | 312 |
| 309 scoped_refptr<ui::AnimationContainer> animation_container_; | 313 scoped_refptr<ui::AnimationContainer> animation_container_; |
| 310 | 314 |
| 315 scoped_ptr<TabAudioIndicator> tab_audio_indicator_; |
| 316 |
| 311 views::ImageButton* close_button_; | 317 views::ImageButton* close_button_; |
| 312 | 318 |
| 313 ui::ThemeProvider* theme_provider_; | 319 ui::ThemeProvider* theme_provider_; |
| 314 | 320 |
| 315 views::GlowHoverController hover_controller_; | 321 views::GlowHoverController hover_controller_; |
| 316 | 322 |
| 317 // The bounds of various sections of the display. | 323 // The bounds of various sections of the display. |
| 318 gfx::Rect favicon_bounds_; | 324 gfx::Rect favicon_bounds_; |
| 319 gfx::Rect title_bounds_; | 325 gfx::Rect title_bounds_; |
| 320 | 326 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 348 static int font_height_; | 354 static int font_height_; |
| 349 | 355 |
| 350 // As the majority of the tabs are inactive, and painting tabs is slowish, | 356 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 351 // we cache a handful of the inactive tab backgrounds here. | 357 // we cache a handful of the inactive tab backgrounds here. |
| 352 static ImageCache* image_cache_; | 358 static ImageCache* image_cache_; |
| 353 | 359 |
| 354 DISALLOW_COPY_AND_ASSIGN(Tab); | 360 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 355 }; | 361 }; |
| 356 | 362 |
| 357 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 363 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |