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