| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 /////////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////////// |
| 45 class Tab : public gfx::AnimationDelegate, | 45 class Tab : public gfx::AnimationDelegate, |
| 46 public views::ButtonListener, | 46 public views::ButtonListener, |
| 47 public views::ContextMenuController, | 47 public views::ContextMenuController, |
| 48 public views::MaskedTargeterDelegate, | 48 public views::MaskedTargeterDelegate, |
| 49 public views::View { | 49 public views::View { |
| 50 public: | 50 public: |
| 51 // The Tab's class name. | 51 // The Tab's class name. |
| 52 static const char kViewClassName[]; | 52 static const char kViewClassName[]; |
| 53 | 53 |
| 54 // The color of an inactive tab. |
| 55 static const SkColor kInactiveTabColor; |
| 56 |
| 54 explicit Tab(TabController* controller); | 57 explicit Tab(TabController* controller); |
| 55 ~Tab() override; | 58 ~Tab() override; |
| 56 | 59 |
| 57 TabController* controller() const { return controller_; } | 60 TabController* controller() const { return controller_; } |
| 58 | 61 |
| 59 // Used to set/check whether this Tab is being animated closed. | 62 // Used to set/check whether this Tab is being animated closed. |
| 60 void set_closing(bool closing) { closing_ = closing; } | 63 void set_closing(bool closing) { closing_ = closing; } |
| 61 bool closing() const { return closing_; } | 64 bool closing() const { return closing_; } |
| 62 | 65 |
| 63 // See description above field. | 66 // See description above field. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 294 } |
| 292 | 295 |
| 293 // Recalculates the correct |button_color_| and resets the title, media | 296 // Recalculates the correct |button_color_| and resets the title, media |
| 294 // indicator, and close button colors if necessary. This should be called any | 297 // indicator, and close button colors if necessary. This should be called any |
| 295 // time the theme or active state may have changed. | 298 // time the theme or active state may have changed. |
| 296 void OnButtonColorMaybeChanged(); | 299 void OnButtonColorMaybeChanged(); |
| 297 | 300 |
| 298 // Schedules repaint task for icon. | 301 // Schedules repaint task for icon. |
| 299 void ScheduleIconPaint(); | 302 void ScheduleIconPaint(); |
| 300 | 303 |
| 304 // Computes a path corresponding to the tab's content region inside the outer |
| 305 // stroke. |
| 306 void GetFillPath(float scale, SkPath* path) const; |
| 307 |
| 308 // Computes a path corresponding to the tab's outer border for a given |scale| |
| 309 // and stores it in |path|. If |extend_to_top| is true, the path is extended |
| 310 // vertically to the top of the tab bounds. The caller uses this for Fitts' |
| 311 // Law purposes in maximized/fullscreen mode. |
| 312 void GetBorderPath(float scale, bool extend_to_top, SkPath* path) const; |
| 313 |
| 301 // Returns the rectangle for the light bar in immersive mode. | 314 // Returns the rectangle for the light bar in immersive mode. |
| 302 gfx::Rect GetImmersiveBarRect() const; | 315 gfx::Rect GetImmersiveBarRect() const; |
| 303 | 316 |
| 304 // Performs a one-time initialization of static resources such as tab images. | 317 // Performs a one-time initialization of static resources such as tab images. |
| 305 static void InitTabResources(); | 318 static void InitTabResources(); |
| 306 | 319 |
| 307 // Loads the images to be used for the tab background. | 320 // Loads the images to be used for the tab background. |
| 308 static void LoadTabImages(); | 321 static void LoadTabImages(); |
| 309 | 322 |
| 310 // Returns the cached image for the specified arguments, or an empty image if | 323 // Returns the cached image for the specified arguments, or an empty image if |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 SkColor button_color_; | 406 SkColor button_color_; |
| 394 | 407 |
| 395 // As the majority of the tabs are inactive, and painting tabs is slowish, | 408 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 396 // we cache a handful of the inactive tab backgrounds here. | 409 // we cache a handful of the inactive tab backgrounds here. |
| 397 static ImageCache* image_cache_; | 410 static ImageCache* image_cache_; |
| 398 | 411 |
| 399 DISALLOW_COPY_AND_ASSIGN(Tab); | 412 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 400 }; | 413 }; |
| 401 | 414 |
| 402 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 415 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |