| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 15 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| 16 #include "ui/base/layout.h" | 16 #include "ui/base/layout.h" |
| 17 #include "ui/gfx/animation/animation_delegate.h" | 17 #include "ui/gfx/animation/animation_delegate.h" |
| 18 #include "ui/gfx/geometry/point.h" | 18 #include "ui/gfx/geometry/point.h" |
| 19 #include "ui/gfx/image/image_skia.h" |
| 19 #include "ui/gfx/paint_throbber.h" | 20 #include "ui/gfx/paint_throbber.h" |
| 20 #include "ui/views/context_menu_controller.h" | 21 #include "ui/views/context_menu_controller.h" |
| 21 #include "ui/views/controls/button/button.h" | 22 #include "ui/views/controls/button/button.h" |
| 22 #include "ui/views/controls/glow_hover_controller.h" | 23 #include "ui/views/controls/glow_hover_controller.h" |
| 23 #include "ui/views/masked_targeter_delegate.h" | 24 #include "ui/views/masked_targeter_delegate.h" |
| 24 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 25 | 26 |
| 26 class AlertIndicatorButton; | 27 class AlertIndicatorButton; |
| 27 class TabController; | 28 class TabController; |
| 28 | 29 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 285 |
| 285 // Gets the throb value for the tab. When a tab is not selected the | 286 // Gets the throb value for the tab. When a tab is not selected the |
| 286 // active background is drawn at |GetThrobValue()|%. This is used for hover, | 287 // active background is drawn at |GetThrobValue()|%. This is used for hover, |
| 287 // mini tab title change and pulsing. | 288 // mini tab title change and pulsing. |
| 288 double GetThrobValue(); | 289 double GetThrobValue(); |
| 289 | 290 |
| 290 // Set the temporary offset for the favicon. This is used during the crash | 291 // Set the temporary offset for the favicon. This is used during the crash |
| 291 // animation. | 292 // animation. |
| 292 void SetFaviconHidingOffset(int offset); | 293 void SetFaviconHidingOffset(int offset); |
| 293 | 294 |
| 294 void set_should_display_crashed_favicon() { | 295 void SetShouldDisplayCrashedFavicon(bool value); |
| 295 should_display_crashed_favicon_ = true; | |
| 296 } | |
| 297 | 296 |
| 298 // Recalculates the correct |button_color_| and resets the title, alert | 297 // Recalculates the correct |button_color_| and resets the title, alert |
| 299 // indicator, and close button colors if necessary. This should be called any | 298 // indicator, and close button colors if necessary. This should be called any |
| 300 // time the theme or active state may have changed. | 299 // time the theme or active state may have changed. |
| 301 void OnButtonColorMaybeChanged(); | 300 void OnButtonColorMaybeChanged(); |
| 302 | 301 |
| 303 // Schedules repaint task for icon. | 302 // Schedules repaint task for icon. |
| 304 void ScheduleIconPaint(); | 303 void ScheduleIconPaint(); |
| 305 | 304 |
| 306 // Computes a path corresponding to the tab's content region inside the outer | 305 // Computes a path corresponding to the tab's content region inside the outer |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // detect when it changes and layout appropriately. | 388 // detect when it changes and layout appropriately. |
| 390 bool showing_alert_indicator_; | 389 bool showing_alert_indicator_; |
| 391 | 390 |
| 392 // Whether we are showing the close button. It is cached so that we can | 391 // Whether we are showing the close button. It is cached so that we can |
| 393 // detect when it changes and layout appropriately. | 392 // detect when it changes and layout appropriately. |
| 394 bool showing_close_button_; | 393 bool showing_close_button_; |
| 395 | 394 |
| 396 // The current color of the alert indicator and close button icons. | 395 // The current color of the alert indicator and close button icons. |
| 397 SkColor button_color_; | 396 SkColor button_color_; |
| 398 | 397 |
| 398 // The favicon for the tab. This might be the sad tab icon or a copy of |
| 399 // data().favicon and may be modified for theming. It is created on demand |
| 400 // and thus may be null. |
| 401 gfx::ImageSkia favicon_; |
| 402 |
| 399 // As the majority of the tabs are inactive, and painting tabs is slowish, | 403 // As the majority of the tabs are inactive, and painting tabs is slowish, |
| 400 // we cache a handful of the inactive tab backgrounds here. | 404 // we cache a handful of the inactive tab backgrounds here. |
| 401 static ImageCache* image_cache_; | 405 static ImageCache* image_cache_; |
| 402 | 406 |
| 403 DISALLOW_COPY_AND_ASSIGN(Tab); | 407 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 404 }; | 408 }; |
| 405 | 409 |
| 406 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 410 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |