Upstream version 9.37.195.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / tabs / tab.h
index d5b71cd..1275619 100644 (file)
@@ -24,12 +24,13 @@ class TabController;
 namespace gfx {
 class Animation;
 class AnimationContainer;
-class Font;
 class LinearAnimation;
 class MultiAnimation;
+class ThrobAnimation;
 }
 namespace views {
 class ImageButton;
+class Label;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -56,6 +57,11 @@ class Tab : public gfx::AnimationDelegate,
   void set_dragging(bool dragging) { dragging_ = dragging; }
   bool dragging() const { return dragging_; }
 
+  // Used to mark the tab as having been detached.  Once this has happened, the
+  // tab should be invisibly closed.  This is irreversible.
+  void set_detached() { detached_ = true; }
+  bool detached() const { return detached_; }
+
   // Sets the container all animations run from.
   void set_animation_container(gfx::AnimationContainer* container);
 
@@ -99,6 +105,17 @@ class Tab : public gfx::AnimationDelegate,
     return &hover_controller_;
   }
 
+  // Returns the inset within the first dragged tab to use when calculating the
+  // "drag insertion point".  If we simply used the x-coordinate of the tab,
+  // we'd be calculating based on a point well before where the user considers
+  // the tab to "be".  The value here is chosen to "feel good" based on the
+  // widths of the tab images and the tab overlap.
+  //
+  // Note that this must return a value smaller than the midpoint of any tab's
+  // width, or else the user won't be able to drag a tab to the left of the
+  // first tab in the strip.
+  static int leading_width_for_drag() { return 16; }
+
   // Returns the minimum possible size of a single unselected Tab.
   static gfx::Size GetMinimumUnselectedSize();
   // Returns the minimum possible size of a selected Tab. Selected tabs must
@@ -185,10 +202,6 @@ class Tab : public gfx::AnimationDelegate,
   // Overridden from ui::EventHandler:
   virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
 
-  // Returns the bounds of the title and icon.
-  const gfx::Rect& GetTitleBounds() const;
-  const gfx::Rect& GetIconBounds() const;
-
   // Invoked from Layout to adjust the position of the favicon or media
   // indicator for mini tabs.
   void MaybeAdjustLeftForMiniTab(gfx::Rect* bounds) const;
@@ -204,18 +217,15 @@ class Tab : public gfx::AnimationDelegate,
 
   // Paint various portions of the Tab
   void PaintTabBackground(gfx::Canvas* canvas);
-  void PaintInactiveTabBackgroundWithTitleChange(
-      gfx::Canvas* canvas,
-      gfx::MultiAnimation* animation);
+  void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas);
   void PaintInactiveTabBackground(gfx::Canvas* canvas);
   void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas,
                                                  int tab_id);
   void PaintActiveTabBackground(gfx::Canvas* canvas);
 
-  // Paints the favicon, media indicator icon, etc., mirrored for RTL if needed.
+  // Paints the favicon and media indicator icon, mirrored for RTL if needed.
   void PaintIcon(gfx::Canvas* canvas);
   void PaintMediaIndicator(gfx::Canvas* canvas);
-  void PaintTitle(gfx::Canvas* canvas, SkColor title_color);
 
   // Invoked if data_.network_state changes, or the network_state is not none.
   void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state,
@@ -299,6 +309,9 @@ class Tab : public gfx::AnimationDelegate,
   // True if the tab is being dragged.
   bool dragging_;
 
+  // True if the tab has been detached.
+  bool detached_;
+
   // The offset used to animate the favicon location. This is used when the tab
   // crashes.
   int favicon_hiding_offset_;
@@ -313,7 +326,9 @@ class Tab : public gfx::AnimationDelegate,
   bool should_display_crashed_favicon_;
 
   // Whole-tab throbbing "pulse" animation.
-  scoped_ptr<gfx::Animation> tab_animation_;
+  scoped_ptr<gfx::ThrobAnimation> pulse_animation_;
+
+  scoped_ptr<gfx::MultiAnimation> mini_title_change_animation_;
 
   // Crash icon animation (in place of favicon).
   scoped_ptr<gfx::LinearAnimation> crash_icon_animation_;
@@ -326,6 +341,7 @@ class Tab : public gfx::AnimationDelegate,
   scoped_refptr<gfx::AnimationContainer> animation_container_;
 
   views::ImageButton* close_button_;
+  views::Label* title_;
 
   bool tab_activated_with_last_gesture_begin_;
 
@@ -333,7 +349,6 @@ class Tab : public gfx::AnimationDelegate,
 
   // The bounds of various sections of the display.
   gfx::Rect favicon_bounds_;
-  gfx::Rect title_bounds_;
   gfx::Rect media_indicator_bounds_;
 
   // The offset used to paint the inactive background image.
@@ -365,9 +380,6 @@ class Tab : public gfx::AnimationDelegate,
   // The current color of the close button.
   SkColor close_button_color_;
 
-  static gfx::Font* font_;
-  static int font_height_;
-
   // As the majority of the tabs are inactive, and painting tabs is slowish,
   // we cache a handful of the inactive tab backgrounds here.
   static ImageCache* image_cache_;