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

Unified Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 2690443002: cros-md: Remove the non-MD immersive mode code paths (Closed)
Patch Set: rebase & code comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 9a51bd97d78b34a9c79a706a4d055070de23819d..a029c04b97aeea7186e68359aca3ccaf3eae24c7 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -98,25 +98,6 @@ const double kSelectedTabThrobScale = 0.95 - kSelectedTabOpacity;
// 8 = normal/incognito, active/inactive, 2 sizes within tabstrip.
const size_t kMaxImageCacheSize = 8;
-// Height of the miniature tab strip in immersive mode.
-const int kImmersiveTabHeight = 3;
-
-// Height of the small tab indicator rectangles in immersive mode.
-const int kImmersiveBarHeight = 2;
-
-// Color for active and inactive tabs in the immersive mode light strip. These
-// should be a little brighter than the color of the normal art assets for tabs,
-// which for active tabs is 230, 230, 230 and for inactive is 184, 184, 184.
-const SkColor kImmersiveActiveTabColor = SkColorSetRGB(235, 235, 235);
-const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190);
-
-// The minimum opacity (out of 1) when a tab (either active or inactive) is
-// throbbing in the immersive mode light strip.
-const double kImmersiveTabMinThrobOpacity = 0.66;
-
-// Number of steps in the immersive mode loading animation.
-const int kImmersiveLoadingStepCount = 32;
-
const char kTabCloseButtonName[] = "TabCloseButton";
////////////////////////////////////////////////////////////////////////////////
@@ -538,7 +519,6 @@ Tab::Tab(TabController* controller, gfx::AnimationContainer* container)
dragging_(false),
detached_(false),
favicon_hiding_offset_(0),
- immersive_loading_step_(0),
should_display_crashed_favicon_(false),
pulse_animation_(new gfx::ThrobAnimation(this)),
crash_icon_animation_(new FaviconCrashAnimation(this)),
@@ -747,11 +727,6 @@ int Tab::GetPinnedWidth() {
}
// static
-int Tab::GetImmersiveHeight() {
- return kImmersiveTabHeight;
-}
-
-// static
float Tab::GetInverseDiagonalSlope() {
// This is computed from the border path as follows:
// * The unscaled endcap width is enough for the whole stroke outer curve,
@@ -855,10 +830,7 @@ void Tab::OnPaint(gfx::Canvas* canvas) {
&clip))
return;
- if (controller_->IsImmersiveStyle())
- PaintImmersiveTab(canvas);
- else
- PaintTab(canvas, clip);
+ PaintTab(canvas, clip);
}
void Tab::Layout() {
@@ -1170,51 +1142,6 @@ void Tab::PaintTab(gfx::Canvas* canvas, const gfx::Path& clip) {
PaintIcon(canvas);
}
-void Tab::PaintImmersiveTab(gfx::Canvas* canvas) {
- // Use transparency for the draw-attention animation.
- int alpha = 255;
- if (pulse_animation_->is_animating() && !data().pinned) {
- alpha = pulse_animation_->CurrentValueBetween(
- 255, gfx::ToRoundedInt(255 * kImmersiveTabMinThrobOpacity));
- }
-
- // Draw a gray rectangle to represent the tab. This works for pinned tabs as
- // well as regular ones. The active tab has a brigher bar.
- SkColor color =
- IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor;
- gfx::Rect bar_rect = GetImmersiveBarRect();
- canvas->FillRect(bar_rect, SkColorSetA(color, alpha));
-
- // Paint network activity indicator.
- // TODO(jamescook): Replace this placeholder animation with a real one.
- // For now, let's go with a Cylon eye effect, but in blue.
- if (data().network_state != TabRendererData::NETWORK_STATE_NONE &&
- data().network_state != TabRendererData::NETWORK_STATE_ERROR) {
- const SkColor kEyeColor = SkColorSetARGB(alpha, 71, 138, 217);
- int eye_width = bar_rect.width() / 3;
- int eye_offset = bar_rect.width() * immersive_loading_step_ /
- kImmersiveLoadingStepCount;
- if (eye_offset + eye_width < bar_rect.width()) {
- // Draw a single indicator strip because it fits inside |bar_rect|.
- gfx::Rect eye_rect(
- bar_rect.x() + eye_offset, 0, eye_width, kImmersiveBarHeight);
- canvas->FillRect(eye_rect, kEyeColor);
- } else {
- // Draw two indicators to simulate the eye "wrapping around" to the left
- // side. The first part fills the remainder of the bar.
- int right_eye_width = bar_rect.width() - eye_offset;
- gfx::Rect right_eye_rect(
- bar_rect.x() + eye_offset, 0, right_eye_width, kImmersiveBarHeight);
- canvas->FillRect(right_eye_rect, kEyeColor);
- // The second part parts the remaining |eye_width| on the left.
- int left_eye_width = eye_offset + eye_width - bar_rect.width();
- gfx::Rect left_eye_rect(
- bar_rect.x(), 0, left_eye_width, kImmersiveBarHeight);
- canvas->FillRect(left_eye_rect, kEyeColor);
- }
- }
-}
-
void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas,
const gfx::Path& clip) {
bool has_custom_image;
@@ -1429,24 +1356,6 @@ void Tab::PaintIcon(gfx::Canvas* canvas) {
void Tab::AdvanceLoadingAnimation() {
const TabRendererData::NetworkState state = data().network_state;
- if (controller_->IsImmersiveStyle()) {
- throbber_->SetVisible(false);
- if (state == TabRendererData::NETWORK_STATE_WAITING) {
- // Waiting steps backwards.
- immersive_loading_step_ =
- (immersive_loading_step_ - 1 + kImmersiveLoadingStepCount) %
- kImmersiveLoadingStepCount;
- } else if (state == TabRendererData::NETWORK_STATE_LOADING) {
- immersive_loading_step_ =
- (immersive_loading_step_ + 1) % kImmersiveLoadingStepCount;
- } else {
- immersive_loading_step_ = 0;
- }
-
- SchedulePaintInRect(GetImmersiveBarRect());
- return;
- }
-
if (state == TabRendererData::NETWORK_STATE_NONE ||
state == TabRendererData::NETWORK_STATE_ERROR) {
throbber_->ResetStartTimes();
@@ -1584,11 +1493,3 @@ void Tab::ScheduleIconPaint() {
bounds.set_x(GetMirroredXForRect(bounds));
SchedulePaintInRect(bounds);
}
-
-gfx::Rect Tab::GetImmersiveBarRect() const {
- // The main bar is as wide as the normal tab's horizontal top line.
- gfx::Rect contents = GetContentsBounds();
- contents.set_y(0);
- contents.set_height(kImmersiveBarHeight);
- return contents;
-}
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698