| 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> |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Returns the preferred size of a single Tab, assuming space is | 148 // Returns the preferred size of a single Tab, assuming space is |
| 149 // available. | 149 // available. |
| 150 static gfx::Size GetStandardSize(); | 150 static gfx::Size GetStandardSize(); |
| 151 | 151 |
| 152 // Returns the width for touch tabs. | 152 // Returns the width for touch tabs. |
| 153 static int GetTouchWidth(); | 153 static int GetTouchWidth(); |
| 154 | 154 |
| 155 // Returns the width for pinned tabs. Pinned tabs always have this width. | 155 // Returns the width for pinned tabs. Pinned tabs always have this width. |
| 156 static int GetPinnedWidth(); | 156 static int GetPinnedWidth(); |
| 157 | 157 |
| 158 // Returns the height for immersive mode tabs. | |
| 159 static int GetImmersiveHeight(); | |
| 160 | |
| 161 // Returns the inverse of the slope of the diagonal portion of the tab outer | 158 // Returns the inverse of the slope of the diagonal portion of the tab outer |
| 162 // border. (This is a positive value, so it's specifically for the slope of | 159 // border. (This is a positive value, so it's specifically for the slope of |
| 163 // the leading edge.) | 160 // the leading edge.) |
| 164 // | 161 // |
| 165 // This returns the inverse (dx/dy instead of dy/dx) because we use exact | 162 // This returns the inverse (dx/dy instead of dy/dx) because we use exact |
| 166 // values for the vertical distances between points and then compute the | 163 // values for the vertical distances between points and then compute the |
| 167 // horizontal deltas from those. | 164 // horizontal deltas from those. |
| 168 static float GetInverseDiagonalSlope(); | 165 static float GetInverseDiagonalSlope(); |
| 169 | 166 |
| 170 private: | 167 private: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // indicator for pinned tabs. | 220 // indicator for pinned tabs. |
| 224 void MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds) const; | 221 void MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds) const; |
| 225 | 222 |
| 226 // Invoked from SetData after |data_| has been updated to the new data. | 223 // Invoked from SetData after |data_| has been updated to the new data. |
| 227 void DataChanged(const TabRendererData& old); | 224 void DataChanged(const TabRendererData& old); |
| 228 | 225 |
| 229 // Paint with the normal tab style. If |clip| is non-empty, the tab border | 226 // Paint with the normal tab style. If |clip| is non-empty, the tab border |
| 230 // should be clipped against it. | 227 // should be clipped against it. |
| 231 void PaintTab(gfx::Canvas* canvas, const gfx::Path& clip); | 228 void PaintTab(gfx::Canvas* canvas, const gfx::Path& clip); |
| 232 | 229 |
| 233 // Paint with the "immersive mode" light-bar style. | |
| 234 void PaintImmersiveTab(gfx::Canvas* canvas); | |
| 235 | |
| 236 // Paint various portions of the Tab. | 230 // Paint various portions of the Tab. |
| 237 void PaintInactiveTabBackground(gfx::Canvas* canvas, const gfx::Path& clip); | 231 void PaintInactiveTabBackground(gfx::Canvas* canvas, const gfx::Path& clip); |
| 238 void PaintTabBackgroundUsingFillId(gfx::Canvas* fill_canvas, | 232 void PaintTabBackgroundUsingFillId(gfx::Canvas* fill_canvas, |
| 239 gfx::Canvas* stroke_canvas, | 233 gfx::Canvas* stroke_canvas, |
| 240 bool is_active, | 234 bool is_active, |
| 241 int fill_id, | 235 int fill_id, |
| 242 bool has_custom_image, | 236 bool has_custom_image, |
| 243 int y_offset); | 237 int y_offset); |
| 244 | 238 |
| 245 // Paints the pinned tab title changed indicator and |favicon_|. |favicon_| | 239 // Paints the pinned tab title changed indicator and |favicon_|. |favicon_| |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void SetShouldDisplayCrashedFavicon(bool value); | 278 void SetShouldDisplayCrashedFavicon(bool value); |
| 285 | 279 |
| 286 // Recalculates the correct |button_color_| and resets the title, alert | 280 // Recalculates the correct |button_color_| and resets the title, alert |
| 287 // indicator, and close button colors if necessary. This should be called any | 281 // indicator, and close button colors if necessary. This should be called any |
| 288 // time the theme or active state may have changed. | 282 // time the theme or active state may have changed. |
| 289 void OnButtonColorMaybeChanged(); | 283 void OnButtonColorMaybeChanged(); |
| 290 | 284 |
| 291 // Schedules repaint task for icon. | 285 // Schedules repaint task for icon. |
| 292 void ScheduleIconPaint(); | 286 void ScheduleIconPaint(); |
| 293 | 287 |
| 294 // Returns the rectangle for the light bar in immersive mode. | |
| 295 gfx::Rect GetImmersiveBarRect() const; | |
| 296 | |
| 297 // The controller, never NULL. | 288 // The controller, never NULL. |
| 298 TabController* const controller_; | 289 TabController* const controller_; |
| 299 | 290 |
| 300 TabRendererData data_; | 291 TabRendererData data_; |
| 301 | 292 |
| 302 // True if the tab is being animated closed. | 293 // True if the tab is being animated closed. |
| 303 bool closing_; | 294 bool closing_; |
| 304 | 295 |
| 305 // True if the tab is being dragged. | 296 // True if the tab is being dragged. |
| 306 bool dragging_; | 297 bool dragging_; |
| 307 | 298 |
| 308 // True if the tab has been detached. | 299 // True if the tab has been detached. |
| 309 bool detached_; | 300 bool detached_; |
| 310 | 301 |
| 311 // The offset used to animate the favicon location. This is used when the tab | 302 // The offset used to animate the favicon location. This is used when the tab |
| 312 // crashes. | 303 // crashes. |
| 313 int favicon_hiding_offset_; | 304 int favicon_hiding_offset_; |
| 314 | 305 |
| 315 // Step in the immersive loading progress indicator. | |
| 316 int immersive_loading_step_; | |
| 317 | |
| 318 bool should_display_crashed_favicon_; | 306 bool should_display_crashed_favicon_; |
| 319 | 307 |
| 320 bool showing_pinned_tab_title_changed_indicator_ = false; | 308 bool showing_pinned_tab_title_changed_indicator_ = false; |
| 321 | 309 |
| 322 // Whole-tab throbbing "pulse" animation. | 310 // Whole-tab throbbing "pulse" animation. |
| 323 std::unique_ptr<gfx::ThrobAnimation> pulse_animation_; | 311 std::unique_ptr<gfx::ThrobAnimation> pulse_animation_; |
| 324 | 312 |
| 325 // Crash icon animation (in place of favicon). | 313 // Crash icon animation (in place of favicon). |
| 326 std::unique_ptr<gfx::LinearAnimation> crash_icon_animation_; | 314 std::unique_ptr<gfx::LinearAnimation> crash_icon_animation_; |
| 327 | 315 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 347 |
| 360 // The favicon for the tab. This might be the sad tab icon or a copy of | 348 // The favicon for the tab. This might be the sad tab icon or a copy of |
| 361 // data().favicon and may be modified for theming. It is created on demand | 349 // data().favicon and may be modified for theming. It is created on demand |
| 362 // and thus may be null. | 350 // and thus may be null. |
| 363 gfx::ImageSkia favicon_; | 351 gfx::ImageSkia favicon_; |
| 364 | 352 |
| 365 DISALLOW_COPY_AND_ASSIGN(Tab); | 353 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 366 }; | 354 }; |
| 367 | 355 |
| 368 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ | 356 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ |
| OLD | NEW |