| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 bool is_active, | 251 bool is_active, |
| 251 int fill_id, | 252 int fill_id, |
| 252 bool has_custom_image, | 253 bool has_custom_image, |
| 253 int y_offset); | 254 int y_offset); |
| 254 void PaintTabFill(gfx::Canvas* canvas, | 255 void PaintTabFill(gfx::Canvas* canvas, |
| 255 gfx::ImageSkia* fill_image, | 256 gfx::ImageSkia* fill_image, |
| 256 int x_offset, | 257 int x_offset, |
| 257 int y_offset, | 258 int y_offset, |
| 258 bool is_active); | 259 bool is_active); |
| 259 | 260 |
| 260 // Paints the pinned tab title changed indicator and favicon. |favicon| may | 261 // Paints the pinned tab title changed indicator and |favicon_|. |favicon_| |
| 261 // be null. |favicon_draw_bounds| is |favicon_bounds_| adjusted for rtl and | 262 // may be null. |favicon_draw_bounds| is |favicon_bounds_| adjusted for rtl |
| 262 // clipped to the bounds of the tab. | 263 // and clipped to the bounds of the tab. |
| 263 void PaintPinnedTabTitleChangedIndicatorAndIcon( | 264 void PaintPinnedTabTitleChangedIndicatorAndIcon( |
| 264 gfx::Canvas* canvas, | 265 gfx::Canvas* canvas, |
| 265 const gfx::ImageSkia& favicon, | |
| 266 const gfx::Rect& favicon_draw_bounds); | 266 const gfx::Rect& favicon_draw_bounds); |
| 267 | 267 |
| 268 // Paints the favicon, mirrored for RTL if needed. | 268 // Paints the favicon, mirrored for RTL if needed. |
| 269 void PaintIcon(gfx::Canvas* canvas); | 269 void PaintIcon(gfx::Canvas* canvas); |
| 270 | 270 |
| 271 // Invoked if data_.network_state changes, or the network_state is not none. | 271 // Invoked if data_.network_state changes, or the network_state is not none. |
| 272 void AdvanceLoadingAnimation(); | 272 void AdvanceLoadingAnimation(); |
| 273 | 273 |
| 274 // Returns the number of favicon-size elements that can fit in the tab's | 274 // Returns the number of favicon-size elements that can fit in the tab's |
| 275 // current size. | 275 // current size. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 290 | 290 |
| 291 // Gets the throb value for the tab. When a tab is not selected the | 291 // Gets the throb value for the tab. When a tab is not selected the |
| 292 // active background is drawn at |GetThrobValue()|%. This is used for hover, | 292 // active background is drawn at |GetThrobValue()|%. This is used for hover, |
| 293 // mini tab title change and pulsing. | 293 // mini tab title change and pulsing. |
| 294 double GetThrobValue(); | 294 double GetThrobValue(); |
| 295 | 295 |
| 296 // Set the temporary offset for the favicon. This is used during the crash | 296 // Set the temporary offset for the favicon. This is used during the crash |
| 297 // animation. | 297 // animation. |
| 298 void SetFaviconHidingOffset(int offset); | 298 void SetFaviconHidingOffset(int offset); |
| 299 | 299 |
| 300 void set_should_display_crashed_favicon() { | 300 void SetShouldDisplayCrashedFavicon(bool value); |
| 301 should_display_crashed_favicon_ = true; | |
| 302 } | |
| 303 | 301 |
| 304 // Recalculates the correct |button_color_| and resets the title, alert | 302 // Recalculates the correct |button_color_| and resets the title, alert |
| 305 // indicator, and close button colors if necessary. This should be called any | 303 // indicator, and close button colors if necessary. This should be called any |
| 306 // time the theme or active state may have changed. | 304 // time the theme or active state may have changed. |
| 307 void OnButtonColorMaybeChanged(); | 305 void OnButtonColorMaybeChanged(); |
| 308 | 306 |
| 309 // Schedules repaint task for icon. | 307 // Schedules repaint task for icon. |
| 310 void ScheduleIconPaint(); | 308 void ScheduleIconPaint(); |
| 311 | 309 |
| 312 // Computes a path corresponding to the tab's content region inside the outer | 310 // 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... |
| 395 // detect when it changes and layout appropriately. | 393 // detect when it changes and layout appropriately. |
| 396 bool showing_alert_indicator_; | 394 bool showing_alert_indicator_; |
| 397 | 395 |
| 398 // Whether we are showing the close button. It is cached so that we can | 396 // Whether we are showing the close button. It is cached so that we can |
| 399 // detect when it changes and layout appropriately. | 397 // detect when it changes and layout appropriately. |
| 400 bool showing_close_button_; | 398 bool showing_close_button_; |
| 401 | 399 |
| 402 // The current color of the alert indicator and close button icons. | 400 // The current color of the alert indicator and close button icons. |
| 403 SkColor button_color_; | 401 SkColor button_color_; |
| 404 | 402 |
| 403 // The favicon for the tab. This might be the sad tab icon or a copy of |
| 404 // data().favicon and may be modified for theming. It is created on demand |
| 405 // and thus may be null. |
| 406 gfx::ImageSkia favicon_; |
| 407 |
| 405 // 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, |
| 406 // we cache a handful of the inactive tab backgrounds here. | 409 // we cache a handful of the inactive tab backgrounds here. |
| 407 static ImageCache* image_cache_; | 410 static ImageCache* image_cache_; |
| 408 | 411 |
| 409 DISALLOW_COPY_AND_ASSIGN(Tab); | 412 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 410 }; | 413 }; |
| 411 | 414 |
| 412 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 415 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |