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

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

Issue 1393193002: Paint tab-loading throbbers into a ui::Layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: de-inline Created 5 years, 2 months 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') | chrome/browser/ui/views/tabs/tab.cc » ('J')
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. If the network state changes NetworkStateChanged is 92 // Sets the network state.
93 // invoked.
94 void UpdateLoadingAnimation(TabRendererData::NetworkState state); 93 void UpdateLoadingAnimation(TabRendererData::NetworkState state);
95 94
96 // Starts/Stops a pulse animation. 95 // Starts/Stops a pulse animation.
97 void StartPulse(); 96 void StartPulse();
98 void StopPulse(); 97 void StopPulse();
99 98
100 // Start/stop the pinned tab title animation. 99 // Start/stop the pinned tab title animation.
101 void StartPinnedTabTitleAnimation(); 100 void StartPinnedTabTitleAnimation();
102 void StopPinnedTabTitleAnimation(); 101 void StopPinnedTabTitleAnimation();
103 102
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 private: 155 private:
157 friend class TabTest; 156 friend class TabTest;
158 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout); 157 FRIEND_TEST_ALL_PREFIXES(TabTest, CloseButtonLayout);
159 158
160 friend class TabStripTest; 159 friend class TabStripTest;
161 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); 160 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked);
162 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked); 161 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibilityWhenStacked);
163 162
164 // The animation object used to swap the favicon with the sad tab icon. 163 // The animation object used to swap the favicon with the sad tab icon.
165 class FaviconCrashAnimation; 164 class FaviconCrashAnimation;
165
166 class TabCloseButton; 166 class TabCloseButton;
167 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(TabRendererData::NetworkState old_state, 250 void AdvanceLoadingAnimation(TabRendererData::NetworkState state);
250 TabRendererData::NetworkState state);
251 251
252 // Returns the number of favicon-size elements that can fit in the tab's 252 // Returns the number of favicon-size elements that can fit in the tab's
253 // current size. 253 // current size.
254 int IconCapacity() const; 254 int IconCapacity() const;
255 255
256 // Returns whether the Tab should display a favicon. 256 // Returns whether the Tab should display a favicon.
257 bool ShouldShowIcon() const; 257 bool ShouldShowIcon() const;
258 258
259 // Returns whether the Tab should display the media indicator. 259 // Returns whether the Tab should display the media indicator.
260 bool ShouldShowMediaIndicator() const; 260 bool ShouldShowMediaIndicator() const;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // True if the tab is being dragged. 334 // True if the tab is being dragged.
335 bool dragging_; 335 bool dragging_;
336 336
337 // True if the tab has been detached. 337 // True if the tab has been detached.
338 bool detached_; 338 bool detached_;
339 339
340 // The offset used to animate the favicon location. This is used when the tab 340 // The offset used to animate the favicon location. This is used when the tab
341 // crashes. 341 // crashes.
342 int favicon_hiding_offset_; 342 int favicon_hiding_offset_;
343 343
344 // The point in time when the tab icon was first painted in the waiting state.
345 base::TimeTicks waiting_start_time_;
346
347 // The point in time when the tab icon was first painted in the loading state.
348 base::TimeTicks loading_start_time_;
349
350 // Paint state for the throbber after the most recent waiting paint.
351 gfx::ThrobberWaitingState waiting_state_;
352
353 // Step in the immersive loading progress indicator. 344 // Step in the immersive loading progress indicator.
354 int immersive_loading_step_; 345 int immersive_loading_step_;
355 346
356 bool should_display_crashed_favicon_; 347 bool should_display_crashed_favicon_;
357 348
358 // Whole-tab throbbing "pulse" animation. 349 // Whole-tab throbbing "pulse" animation.
359 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; 350 scoped_ptr<gfx::ThrobAnimation> pulse_animation_;
360 351
361 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; 352 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_;
362 353
363 // Crash icon animation (in place of favicon). 354 // Crash icon animation (in place of favicon).
364 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; 355 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_;
365 356
366 scoped_refptr<gfx::AnimationContainer> animation_container_; 357 scoped_refptr<gfx::AnimationContainer> animation_container_;
367 358
359 ThrobberView* throbber_;
368 MediaIndicatorButton* media_indicator_button_; 360 MediaIndicatorButton* media_indicator_button_;
369 views::ImageButton* close_button_; 361 views::ImageButton* close_button_;
370 views::Label* title_; 362 views::Label* title_;
371 363
372 bool tab_activated_with_last_tap_down_; 364 bool tab_activated_with_last_tap_down_;
373 365
374 views::GlowHoverController hover_controller_; 366 views::GlowHoverController hover_controller_;
375 367
376 // The bounds of various sections of the display. 368 // The bounds of various sections of the display.
377 gfx::Rect favicon_bounds_; 369 gfx::Rect favicon_bounds_;
(...skipping 28 matching lines...) Expand all
406 SkColor button_color_; 398 SkColor button_color_;
407 399
408 // As the majority of the tabs are inactive, and painting tabs is slowish, 400 // As the majority of the tabs are inactive, and painting tabs is slowish,
409 // we cache a handful of the inactive tab backgrounds here. 401 // we cache a handful of the inactive tab backgrounds here.
410 static ImageCache* image_cache_; 402 static ImageCache* image_cache_;
411 403
412 DISALLOW_COPY_AND_ASSIGN(Tab); 404 DISALLOW_COPY_AND_ASSIGN(Tab);
413 }; 405 };
414 406
415 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ 407 #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') | chrome/browser/ui/views/tabs/tab.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698