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

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

Issue 22353017: Fix the "throb" animation for the immersive fullscreen light bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 #include "chrome/browser/ui/views/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 // Height of the small tab indicator rectangles in immersive mode. 232 // Height of the small tab indicator rectangles in immersive mode.
233 const int kImmersiveBarHeight = 2; 233 const int kImmersiveBarHeight = 2;
234 234
235 // Color for active and inactive tabs in the immersive mode light strip. These 235 // Color for active and inactive tabs in the immersive mode light strip. These
236 // should be a little brighter than the color of the normal art assets for tabs, 236 // should be a little brighter than the color of the normal art assets for tabs,
237 // which for active tabs is 230, 230, 230 and for inactive is 184, 184, 184. 237 // which for active tabs is 230, 230, 230 and for inactive is 184, 184, 184.
238 const SkColor kImmersiveActiveTabColor = SkColorSetRGB(235, 235, 235); 238 const SkColor kImmersiveActiveTabColor = SkColorSetRGB(235, 235, 235);
239 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190); 239 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190);
240 240
241 // The minimum opacity (out of 1) when a tab (either active or inactive) is
242 // throbbing in the immersive mode light strip.
243 const double kImmersiveTabMinThrobOpacity = 0.66;
244
241 // Number of steps in the immersive mode loading animation. 245 // Number of steps in the immersive mode loading animation.
242 const int kImmersiveLoadingStepCount = 32; 246 const int kImmersiveLoadingStepCount = 32;
243 247
244 // Scale to resize the current favicon by when projecting. 248 // Scale to resize the current favicon by when projecting.
245 const double kProjectingFaviconResizeScale = 0.75; 249 const double kProjectingFaviconResizeScale = 0.75;
246 250
247 // Scale to resize the projection sheet glow by. 251 // Scale to resize the projection sheet glow by.
248 const double kProjectingGlowResizeScale = 2.0; 252 const double kProjectingGlowResizeScale = 2.0;
249 253
250 void DrawIconAtLocation(gfx::Canvas* canvas, 254 void DrawIconAtLocation(gfx::Canvas* canvas,
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 close_button_color_ = title_color; 1112 close_button_color_ = title_color;
1109 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1110 close_button_->SetBackground(close_button_color_, 1114 close_button_->SetBackground(close_button_color_,
1111 rb.GetImageSkiaNamed(IDR_CLOSE_1), 1115 rb.GetImageSkiaNamed(IDR_CLOSE_1),
1112 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); 1116 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK));
1113 } 1117 }
1114 } 1118 }
1115 1119
1116 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { 1120 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) {
1117 // Use transparency for the draw-attention animation. 1121 // Use transparency for the draw-attention animation.
1118 int alpha = (tab_animation_ && tab_animation_->is_animating()) 1122 int alpha = 255;
1119 ? static_cast<int>(GetThrobValue() * 255) 1123 if (tab_animation_ &&
1120 : 255; 1124 tab_animation_->is_animating() &&
1125 !data().mini) {
1126 alpha = tab_animation_->CurrentValueBetween(
1127 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity));
1128 }
1121 1129
1122 // Draw a gray rectangle to represent the tab. This works for mini-tabs as 1130 // Draw a gray rectangle to represent the tab. This works for mini-tabs as
1123 // well as regular ones. The active tab has a brigher bar. 1131 // well as regular ones. The active tab has a brigher bar.
1124 SkColor color = 1132 SkColor color =
1125 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor; 1133 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor;
1126 gfx::Rect bar_rect = GetImmersiveBarRect(); 1134 gfx::Rect bar_rect = GetImmersiveBarRect();
1127 canvas->FillRect(bar_rect, SkColorSetA(color, alpha)); 1135 canvas->FillRect(bar_rect, SkColorSetA(color, alpha));
1128 1136
1129 // Paint network activity indicator. 1137 // Paint network activity indicator.
1130 // TODO(jamescook): Replace this placeholder animation with a real one. 1138 // TODO(jamescook): Replace this placeholder animation with a real one.
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 const gfx::ImageSkia& image) { 1834 const gfx::ImageSkia& image) {
1827 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1835 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1828 ImageCacheEntry entry; 1836 ImageCacheEntry entry;
1829 entry.resource_id = resource_id; 1837 entry.resource_id = resource_id;
1830 entry.scale_factor = scale_factor; 1838 entry.scale_factor = scale_factor;
1831 entry.image = image; 1839 entry.image = image;
1832 image_cache_->push_front(entry); 1840 image_cache_->push_front(entry);
1833 if (image_cache_->size() > kMaxImageCacheSize) 1841 if (image_cache_->size() > kMaxImageCacheSize)
1834 image_cache_->pop_back(); 1842 image_cache_->pop_back();
1835 } 1843 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698