summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tabs
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-02 17:29:43 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-02 17:29:43 +0000
commit8a34e660e7b6627b71a3b24e6800090f239075bb (patch)
treee76c3a12d82cd6e6d8dc467596316f0666fd1296 /chrome/browser/views/tabs
parent0b4158e6bc07aea93651c05c3bf26c2152bd9842 (diff)
downloadchromium_src-8a34e660e7b6627b71a3b24e6800090f239075bb.zip
chromium_src-8a34e660e7b6627b71a3b24e6800090f239075bb.tar.gz
chromium_src-8a34e660e7b6627b71a3b24e6800090f239075bb.tar.bz2
Rip out phantom tabs and corresponding unit tests.
Also get rid of the type enum passed to TabReplacedAt since it can only be one option after phantom tabs are removed. BUG=none TEST=compile? good. pass tests? good. Review URL: http://codereview.chromium.org/3539010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.cc1
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc4
-rw-r--r--chrome/browser/views/tabs/side_tab.cc18
-rw-r--r--chrome/browser/views/tabs/tab.cc16
-rw-r--r--chrome/browser/views/tabs/tab_renderer_data.h2
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc58
-rw-r--r--chrome/browser/views/tabs/tab_strip.h3
7 files changed, 18 insertions, 84 deletions
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
index 76de3ae..52d58a8 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
@@ -385,7 +385,6 @@ void BrowserTabStripController::SetTabRendererDataFromModel(
data->show_icon = contents->ShouldDisplayFavIcon();
data->mini = model_->IsMiniTab(model_index);
data->blocked = model_->IsTabBlocked(model_index);
- data->phantom = model_->IsPhantomTab(model_index);
data->app = contents->is_app();
}
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index b0dc9e3..3798180 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -886,7 +886,7 @@ void DraggedTabController::Detach() {
attached_tab_ = NULL;
// If we've removed the last Tab from the TabStrip, hide the frame now.
- if (!attached_model->HasNonPhantomTabs())
+ if (attached_model->empty())
HideFrame();
// Set up the photo booth to start capturing the contents of the dragged
@@ -1287,7 +1287,7 @@ void DraggedTabController::HideFrame() {
void DraggedTabController::CleanUpHiddenFrame() {
// If the model we started dragging from is now empty, we must ask the
// delegate to close the frame.
- if (!GetModel(source_tabstrip_)->HasNonPhantomTabs())
+ if (GetModel(source_tabstrip_)->empty())
GetModel(source_tabstrip_)->delegate()->CloseFrameAfterDragSession();
}
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc
index a73bdee..b42bca0 100644
--- a/chrome/browser/views/tabs/side_tab.cc
+++ b/chrome/browser/views/tabs/side_tab.cc
@@ -20,16 +20,12 @@ const int kTitleCloseSpacing = 4;
const SkScalar kRoundRectRadius = 4;
const SkColor kTabBackgroundColor = SK_ColorWHITE;
const SkColor kTextColor = SK_ColorBLACK;
-const SkColor kPhantomTextColor = SK_ColorGRAY;
// Padding between the edge and the icon.
const int kIconLeftPadding = 5;
// Location the title starts at.
const int kTitleX = kIconLeftPadding + kFavIconSize + 5;
-
-// Alpha value phantom tab icons are rendered at.
-const int kPhantomTabIconAlpha = 100;
};
////////////////////////////////////////////////////////////////////////////////
@@ -99,18 +95,10 @@ void SideTab::Paint(gfx::Canvas* canvas) {
paint);
}
- if (ShouldShowIcon()) {
- if (data().phantom) {
- canvas->SaveLayerAlpha(kPhantomTabIconAlpha,
- gfx::Rect(width(), height()));
- PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
- canvas->Restore();
- } else {
- PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
- }
- }
+ if (ShouldShowIcon())
+ PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
- PaintTitle(canvas, data().phantom ? kPhantomTextColor : kTextColor);
+ PaintTitle(canvas, kTextColor);
}
gfx::Size SideTab::GetPreferredSize() {
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 1f58245..dda22fb 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -177,15 +177,13 @@ int Tab::GetMiniWidth() {
// Tab, protected:
void Tab::DataChanged(const TabRendererData& old) {
- if (data().phantom)
- StopMiniTabTitleAnimation();
+ if (data().blocked == old.blocked)
+ return;
- if (data().blocked != old.blocked) {
- if (data().blocked)
- StartPulse();
- else
- StopPulse();
- }
+ if (data().blocked)
+ StartPulse();
+ else
+ StopPulse();
}
////////////////////////////////////////////////////////////////////////////////
@@ -198,7 +196,7 @@ void Tab::Paint(gfx::Canvas* canvas) {
return;
// See if the model changes whether the icons should be painted.
- const bool show_icon = ShouldShowIcon() && !data().phantom;
+ const bool show_icon = ShouldShowIcon();
const bool show_close_button = ShouldShowCloseBox();
if (show_icon != showing_icon_ || show_close_button != showing_close_button_)
Layout();
diff --git a/chrome/browser/views/tabs/tab_renderer_data.h b/chrome/browser/views/tabs/tab_renderer_data.h
index f91a3f9..31e84ed 100644
--- a/chrome/browser/views/tabs/tab_renderer_data.h
+++ b/chrome/browser/views/tabs/tab_renderer_data.h
@@ -28,7 +28,6 @@ struct TabRendererData {
show_icon(true),
mini(false),
blocked(false),
- phantom(false),
app(false) {
}
@@ -41,7 +40,6 @@ struct TabRendererData {
bool show_icon;
bool mini;
bool blocked;
- bool phantom;
bool app;
};
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index c408585..1a1a99e 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -51,12 +51,6 @@ static const int kSuspendAnimationsTimeMs = 200;
static const int kTabHOffset = -16;
static const int kTabStripAnimationVSlop = 40;
-// Alpha value phantom tabs are rendered at.
-static const int kPhantomTabAlpha = 105;
-
-// Alpha value phantom tab icons are rendered at.
-static const int kPhantomTabIconAlpha = 160;
-
// Size of the drop indicator.
static int drop_indicator_width;
static int drop_indicator_height;
@@ -280,37 +274,7 @@ BaseTab* TabStrip::CreateTabForDragging() {
void TabStrip::PaintChildren(gfx::Canvas* canvas) {
// Tabs are painted in reverse order, so they stack to the left.
- // Phantom tabs appear behind all other tabs and are rendered first. To make
- // them slightly transparent we render them to a different layer.
- if (HasPhantomTabs()) {
- gfx::Rect local_bounds = GetLocalBounds(true);
- canvas->SaveLayerAlpha(kPhantomTabAlpha, local_bounds);
- canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
- for (int i = tab_count() - 1; i >= 0; --i) {
- Tab* tab = GetTabAtTabDataIndex(i);
- if (tab->data().phantom)
- tab->ProcessPaint(canvas);
- }
- canvas->Restore();
-
- canvas->SaveLayerAlpha(kPhantomTabIconAlpha, local_bounds);
- canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
- for (int i = tab_count() - 1; i >= 0; --i) {
- Tab* tab = GetTabAtTabDataIndex(i);
- if (tab->data().phantom) {
- canvas->Save();
- canvas->ClipRectInt(tab->MirroredX(), tab->y(), tab->width(),
- tab->height());
- canvas->TranslateInt(tab->MirroredX(), tab->y());
- tab->PaintIcon(canvas);
- canvas->Restore();
- }
- }
- canvas->Restore();
- }
-
Tab* selected_tab = NULL;
-
Tab* dragging_tab = NULL;
for (int i = tab_count() - 1; i >= 0; --i) {
@@ -318,14 +282,12 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) {
// We must ask the _Tab's_ model, not ourselves, because in some situations
// the model will be different to this object, e.g. when a Tab is being
// removed after its TabContents has been destroyed.
- if (!tab->data().phantom) {
- if (tab->dragging()) {
- dragging_tab = tab;
- } else if (!tab->IsSelected()) {
- tab->ProcessPaint(canvas);
- } else {
- selected_tab = tab;
- }
+ if (tab->dragging()) {
+ dragging_tab = tab;
+ } else if (!tab->IsSelected()) {
+ tab->ProcessPaint(canvas);
+ } else {
+ selected_tab = tab;
}
}
@@ -1020,11 +982,3 @@ bool TabStrip::IsPointInTab(Tab* tab,
View::ConvertPointToView(this, tab, &point_in_tab_coords);
return tab->HitTest(point_in_tab_coords);
}
-
-bool TabStrip::HasPhantomTabs() const {
- for (int i = 0; i < tab_count(); ++i) {
- if (GetTabAtTabDataIndex(i)->data().phantom)
- return true;
- }
- return false;
-}
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index 64c23fe..188868d 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -234,9 +234,6 @@ class TabStrip : public BaseTabStrip,
// hit-test region of the specified Tab.
bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords);
- // Returns true if any of the tabs are phantom.
- bool HasPhantomTabs() const;
-
// -- Member Variables ------------------------------------------------------
// The "New Tab" button.