Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: chrome/browser/ui/views/tabs/tab.h

Issue 1415873006: Revert of Paint tab-loading throbbers into a ui::Layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void ActiveStateChanged(); 82 void ActiveStateChanged();
83 83
84 // Returns true if the tab is selected. 84 // Returns true if the tab is selected.
85 bool IsSelected() const; 85 bool IsSelected() const;
86 86
87 // Sets the data this tabs displays. Invokes DataChanged. Should only be 87 // Sets the data this tabs displays. Invokes DataChanged. Should only be
88 // called after Tab is added to widget hierarchy. 88 // called after Tab is added to widget hierarchy.
89 void SetData(const TabRendererData& data); 89 void SetData(const TabRendererData& data);
90 const TabRendererData& data() const { return data_; } 90 const TabRendererData& data() const { return data_; }
91 91
92 // Sets the network state. 92 // Sets the network state. If the network state changes NetworkStateChanged is
93 // invoked.
93 void UpdateLoadingAnimation(TabRendererData::NetworkState state); 94 void UpdateLoadingAnimation(TabRendererData::NetworkState state);
94 95
95 // Starts/Stops a pulse animation. 96 // Starts/Stops a pulse animation.
96 void StartPulse(); 97 void StartPulse();
97 void StopPulse(); 98 void StopPulse();
98 99
99 // Start/stop the pinned tab title animation. 100 // Start/stop the pinned tab title animation.
100 void StartPinnedTabTitleAnimation(); 101 void StartPinnedTabTitleAnimation();
101 void StopPinnedTabTitleAnimation(); 102 void StopPinnedTabTitleAnimation();
102 103
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 static int GetTouchWidth(); 149 static int GetTouchWidth();
149 150
150 // Returns the width for pinned tabs. Pinned tabs always have this width. 151 // Returns the width for pinned tabs. Pinned tabs always have this width.
151 static int GetPinnedWidth(); 152 static int GetPinnedWidth();
152 153
153 // Returns the height for immersive mode tabs. 154 // Returns the height for immersive mode tabs.
154 static int GetImmersiveHeight(); 155 static int GetImmersiveHeight();
155 156
156 private: 157 private:
157 friend class TabTest; 158 friend class TabTest;
159 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout);
160
158 friend class TabStripTest; 161 friend class TabStripTest;
159 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); 162 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked);
160 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); 163 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked);
161 164
162 // The animation object used to swap the favicon with the sad tab icon. 165 // The animation object used to swap the favicon with the sad tab icon.
163 class FaviconCrashAnimation; 166 class FaviconCrashAnimation;
164
165 class TabCloseButton; 167 class TabCloseButton;
166 class ThrobberView;
167 168
168 // Contains a cached image and the values used to generate it. 169 // Contains a cached image and the values used to generate it.
169 struct ImageCacheEntry { 170 struct ImageCacheEntry {
170 ImageCacheEntry(); 171 ImageCacheEntry();
171 ~ImageCacheEntry(); 172 ~ImageCacheEntry();
172 173
173 // ID of the resource used. 174 // ID of the resource used.
174 int resource_id; 175 int resource_id;
175 176
176 // Scale factor we're drawing it. 177 // Scale factor we're drawing it.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); 240 void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas);
240 void PaintInactiveTabBackground(gfx::Canvas* canvas); 241 void PaintInactiveTabBackground(gfx::Canvas* canvas);
241 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas, 242 void PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas,
242 int tab_id); 243 int tab_id);
243 void PaintActiveTabBackground(gfx::Canvas* canvas); 244 void PaintActiveTabBackground(gfx::Canvas* canvas);
244 245
245 // Paints the favicon, mirrored for RTL if needed. 246 // Paints the favicon, mirrored for RTL if needed.
246 void PaintIcon(gfx::Canvas* canvas); 247 void PaintIcon(gfx::Canvas* canvas);
247 248
248 // Invoked if data_.network_state changes, or the network_state is not none. 249 // Invoked if data_.network_state changes, or the network_state is not none.
249 void AdvanceLoadingAnimation(); 250 void AdvanceLoadingAnimation(TabRendererData::NetworkState old_state,
251 TabRendererData::NetworkState state);
250 252
251 // Returns the number of favicon-size elements that can fit in the tab's 253 // Returns the number of favicon-size elements that can fit in the tab's
252 // current size. 254 // current size.
253 int IconCapacity() const; 255 int IconCapacity() const;
254 256
255 // Returns whether the Tab should display a favicon. 257 // Returns whether the Tab should display a favicon.
256 bool ShouldShowIcon() const; 258 bool ShouldShowIcon() const;
257 259
258 // Returns whether the Tab should display the media indicator. 260 // Returns whether the Tab should display the media indicator.
259 bool ShouldShowMediaIndicator() const; 261 bool ShouldShowMediaIndicator() const;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // True if the tab is being dragged. 327 // True if the tab is being dragged.
326 bool dragging_; 328 bool dragging_;
327 329
328 // True if the tab has been detached. 330 // True if the tab has been detached.
329 bool detached_; 331 bool detached_;
330 332
331 // The offset used to animate the favicon location. This is used when the tab 333 // The offset used to animate the favicon location. This is used when the tab
332 // crashes. 334 // crashes.
333 int favicon_hiding_offset_; 335 int favicon_hiding_offset_;
334 336
337 // The point in time when the tab icon was first painted in the waiting state.
338 base::TimeTicks waiting_start_time_;
339
340 // The point in time when the tab icon was first painted in the loading state.
341 base::TimeTicks loading_start_time_;
342
343 // Paint state for the throbber after the most recent waiting paint.
344 gfx::ThrobberWaitingState waiting_state_;
345
335 // Step in the immersive loading progress indicator. 346 // Step in the immersive loading progress indicator.
336 int immersive_loading_step_; 347 int immersive_loading_step_;
337 348
338 bool should_display_crashed_favicon_; 349 bool should_display_crashed_favicon_;
339 350
340 // Whole-tab throbbing "pulse" animation. 351 // Whole-tab throbbing "pulse" animation.
341 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; 352 scoped_ptr<gfx::ThrobAnimation> pulse_animation_;
342 353
343 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; 354 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_;
344 355
345 // Crash icon animation (in place of favicon). 356 // Crash icon animation (in place of favicon).
346 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; 357 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_;
347 358
348 scoped_refptr<gfx::AnimationContainer> animation_container_; 359 scoped_refptr<gfx::AnimationContainer> animation_container_;
349 360
350 ThrobberView* throbber_;
351 MediaIndicatorButton* media_indicator_button_; 361 MediaIndicatorButton* media_indicator_button_;
352 views::ImageButton* close_button_; 362 views::ImageButton* close_button_;
353 views::Label* title_; 363 views::Label* title_;
354 364
355 bool tab_activated_with_last_tap_down_; 365 bool tab_activated_with_last_tap_down_;
356 366
357 views::GlowHoverController hover_controller_; 367 views::GlowHoverController hover_controller_;
358 368
359 // The bounds of various sections of the display. 369 // The bounds of various sections of the display.
360 gfx::Rect favicon_bounds_; 370 gfx::Rect favicon_bounds_;
(...skipping 28 matching lines...) Expand all
389 SkColor button_color_; 399 SkColor button_color_;
390 400
391 // As the majority of the tabs are inactive, and painting tabs is slowish, 401 // As the majority of the tabs are inactive, and painting tabs is slowish,
392 // we cache a handful of the inactive tab backgrounds here. 402 // we cache a handful of the inactive tab backgrounds here.
393 static ImageCache* image_cache_; 403 static ImageCache* image_cache_;
394 404
395 DISALLOW_COPY_AND_ASSIGN(Tab); 405 DISALLOW_COPY_AND_ASSIGN(Tab);
396 }; 406 };
397 407
398 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ 408 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698