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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class Tab : public gfx::AnimationDelegate, | 43 class Tab : public gfx::AnimationDelegate, |
44 public views::ButtonListener, | 44 public views::ButtonListener, |
45 public views::ContextMenuController, | 45 public views::ContextMenuController, |
46 public views::MaskedTargeterDelegate, | 46 public views::MaskedTargeterDelegate, |
47 public views::View { | 47 public views::View { |
48 public: | 48 public: |
49 // The Tab's class name. | 49 // The Tab's class name. |
50 static const char kViewClassName[]; | 50 static const char kViewClassName[]; |
51 | 51 |
52 explicit Tab(TabController* controller); | 52 explicit Tab(TabController* controller); |
53 virtual ~Tab(); | 53 ~Tab() override; |
54 | 54 |
55 TabController* controller() const { return controller_; } | 55 TabController* controller() const { return controller_; } |
56 | 56 |
57 // Used to set/check whether this Tab is being animated closed. | 57 // Used to set/check whether this Tab is being animated closed. |
58 void set_closing(bool closing) { closing_ = closing; } | 58 void set_closing(bool closing) { closing_ = closing; } |
59 bool closing() const { return closing_; } | 59 bool closing() const { return closing_; } |
60 | 60 |
61 // See description above field. | 61 // See description above field. |
62 void set_dragging(bool dragging) { dragging_ = dragging; } | 62 void set_dragging(bool dragging) { dragging_ = dragging; } |
63 bool dragging() const { return dragging_; } | 63 bool dragging() const { return dragging_; } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Scale factor we're drawing it. | 163 // Scale factor we're drawing it. |
164 ui::ScaleFactor scale_factor; | 164 ui::ScaleFactor scale_factor; |
165 | 165 |
166 // The image. | 166 // The image. |
167 gfx::ImageSkia image; | 167 gfx::ImageSkia image; |
168 }; | 168 }; |
169 | 169 |
170 typedef std::list<ImageCacheEntry> ImageCache; | 170 typedef std::list<ImageCacheEntry> ImageCache; |
171 | 171 |
172 // gfx::AnimationDelegate: | 172 // gfx::AnimationDelegate: |
173 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 173 void AnimationProgressed(const gfx::Animation* animation) override; |
174 virtual void AnimationCanceled(const gfx::Animation* animation) override; | 174 void AnimationCanceled(const gfx::Animation* animation) override; |
175 virtual void AnimationEnded(const gfx::Animation* animation) override; | 175 void AnimationEnded(const gfx::Animation* animation) override; |
176 | 176 |
177 // views::ButtonListener: | 177 // views::ButtonListener: |
178 virtual void ButtonPressed(views::Button* sender, | 178 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
179 const ui::Event& event) override; | |
180 | 179 |
181 // views::ContextMenuController: | 180 // views::ContextMenuController: |
182 virtual void ShowContextMenuForView(views::View* source, | 181 void ShowContextMenuForView(views::View* source, |
183 const gfx::Point& point, | 182 const gfx::Point& point, |
184 ui::MenuSourceType source_type) override; | 183 ui::MenuSourceType source_type) override; |
185 | 184 |
186 // views::MaskedTargeterDelegate: | 185 // views::MaskedTargeterDelegate: |
187 virtual bool GetHitTestMask(gfx::Path* mask) const override; | 186 bool GetHitTestMask(gfx::Path* mask) const override; |
188 | 187 |
189 // views::View: | 188 // views::View: |
190 virtual void OnPaint(gfx::Canvas* canvas) override; | 189 void OnPaint(gfx::Canvas* canvas) override; |
191 virtual void Layout() override; | 190 void Layout() override; |
192 virtual void OnThemeChanged() override; | 191 void OnThemeChanged() override; |
193 virtual const char* GetClassName() const override; | 192 const char* GetClassName() const override; |
194 virtual bool GetTooltipText(const gfx::Point& p, | 193 bool GetTooltipText(const gfx::Point& p, |
195 base::string16* tooltip) const override; | 194 base::string16* tooltip) const override; |
196 virtual bool GetTooltipTextOrigin(const gfx::Point& p, | 195 bool GetTooltipTextOrigin(const gfx::Point& p, |
197 gfx::Point* origin) const override; | 196 gfx::Point* origin) const override; |
198 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 197 bool OnMousePressed(const ui::MouseEvent& event) override; |
199 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; | 198 bool OnMouseDragged(const ui::MouseEvent& event) override; |
200 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 199 void OnMouseReleased(const ui::MouseEvent& event) override; |
201 virtual void OnMouseCaptureLost() override; | 200 void OnMouseCaptureLost() override; |
202 virtual void OnMouseEntered(const ui::MouseEvent& event) override; | 201 void OnMouseEntered(const ui::MouseEvent& event) override; |
203 virtual void OnMouseMoved(const ui::MouseEvent& event) override; | 202 void OnMouseMoved(const ui::MouseEvent& event) override; |
204 virtual void OnMouseExited(const ui::MouseEvent& event) override; | 203 void OnMouseExited(const ui::MouseEvent& event) override; |
205 virtual void GetAccessibleState(ui::AXViewState* state) override; | 204 void GetAccessibleState(ui::AXViewState* state) override; |
206 | 205 |
207 // ui::EventHandler: | 206 // ui::EventHandler: |
208 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 207 void OnGestureEvent(ui::GestureEvent* event) override; |
209 | 208 |
210 // Invoked from Layout to adjust the position of the favicon or media | 209 // Invoked from Layout to adjust the position of the favicon or media |
211 // indicator for mini tabs. | 210 // indicator for mini tabs. |
212 void MaybeAdjustLeftForMiniTab(gfx::Rect* bounds) const; | 211 void MaybeAdjustLeftForMiniTab(gfx::Rect* bounds) const; |
213 | 212 |
214 // Invoked from SetData after |data_| has been updated to the new data. | 213 // Invoked from SetData after |data_| has been updated to the new data. |
215 void DataChanged(const TabRendererData& old); | 214 void DataChanged(const TabRendererData& old); |
216 | 215 |
217 // Paint with the normal tab style. | 216 // Paint with the normal tab style. |
218 void PaintTab(gfx::Canvas* canvas); | 217 void PaintTab(gfx::Canvas* canvas); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 SkColor close_button_color_; | 378 SkColor close_button_color_; |
380 | 379 |
381 // As the majority of the tabs are inactive, and painting tabs is slowish, | 380 // As the majority of the tabs are inactive, and painting tabs is slowish, |
382 // we cache a handful of the inactive tab backgrounds here. | 381 // we cache a handful of the inactive tab backgrounds here. |
383 static ImageCache* image_cache_; | 382 static ImageCache* image_cache_; |
384 | 383 |
385 DISALLOW_COPY_AND_ASSIGN(Tab); | 384 DISALLOW_COPY_AND_ASSIGN(Tab); |
386 }; | 385 }; |
387 | 386 |
388 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 387 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
OLD | NEW |