diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/theme/tab_active_nano_center.png | bin | 0 -> 164 bytes | |||
-rw-r--r-- | chrome/app/theme/tab_active_nano_left.png | bin | 0 -> 377 bytes | |||
-rw-r--r-- | chrome/app/theme/tab_active_nano_right.png | bin | 0 -> 326 bytes | |||
-rw-r--r-- | chrome/app/theme/tab_alpha_nano_left.png | bin | 0 -> 240 bytes | |||
-rw-r--r-- | chrome/app/theme/tab_alpha_nano_right.png | bin | 0 -> 239 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 5 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 134 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.h | 19 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 4 |
9 files changed, 101 insertions, 61 deletions
diff --git a/chrome/app/theme/tab_active_nano_center.png b/chrome/app/theme/tab_active_nano_center.png Binary files differnew file mode 100644 index 0000000..e625593 --- /dev/null +++ b/chrome/app/theme/tab_active_nano_center.png diff --git a/chrome/app/theme/tab_active_nano_left.png b/chrome/app/theme/tab_active_nano_left.png Binary files differnew file mode 100644 index 0000000..5512d60 --- /dev/null +++ b/chrome/app/theme/tab_active_nano_left.png diff --git a/chrome/app/theme/tab_active_nano_right.png b/chrome/app/theme/tab_active_nano_right.png Binary files differnew file mode 100644 index 0000000..ac970e1 --- /dev/null +++ b/chrome/app/theme/tab_active_nano_right.png diff --git a/chrome/app/theme/tab_alpha_nano_left.png b/chrome/app/theme/tab_alpha_nano_left.png Binary files differnew file mode 100644 index 0000000..2c294a4 --- /dev/null +++ b/chrome/app/theme/tab_alpha_nano_left.png diff --git a/chrome/app/theme/tab_alpha_nano_right.png b/chrome/app/theme/tab_alpha_nano_right.png Binary files differnew file mode 100644 index 0000000..b068a30 --- /dev/null +++ b/chrome/app/theme/tab_alpha_nano_right.png diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 47da596..6ae7e8d 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -79,6 +79,9 @@ <include name="IDR_TAB_ACTIVE_CENTER" file="tab_active_center.png" type="BINDATA" /> <include name="IDR_TAB_ACTIVE_LEFT" file="tab_active_left.png" type="BINDATA" /> <include name="IDR_TAB_ACTIVE_RIGHT" file="tab_active_right.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_NANO_CENTER" file="tab_active_nano_center.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_NANO_LEFT" file="tab_active_nano_left.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_NANO_RIGHT" file="tab_active_nano_right.png" type="BINDATA" /> <include name="IDR_TAB_CLOSE" file="tab_close.png" type="BINDATA" /> <include name="IDR_TAB_CLOSE_H" file="tab_close_h.png" type="BINDATA" /> <include name="IDR_TAB_CLOSE_P" file="tab_close_p.png" type="BINDATA" /> @@ -279,6 +282,8 @@ <include name="IDR_BOOKMARK_MANAGER_SEARCH_ICON" file="bookmark_manager_search.png" type="BINDATA" /> <include name="IDR_TAB_ALPHA_LEFT" file="tab_alpha_left.png" type="BINDATA" /> <include name="IDR_TAB_ALPHA_RIGHT" file="tab_alpha_right.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_NANO_LEFT" file="tab_alpha_nano_left.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_NANO_RIGHT" file="tab_alpha_nano_right.png" type="BINDATA" /> <include name="IDR_TAB_ALPHA_NEW_TAB" file="tab_alpha_new_tab.png" type="BINDATA" /> <include name="IDR_TAB_NEW_TAB_SHADOW" file="tab_new_tab_shadow.png" type="BINDATA" /> diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 68e19e1..f089393 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -88,7 +88,9 @@ static SkBitmap* new_tab_shadow = NULL; TabRenderer::TabImage TabRenderer::tab_alpha = {0}; TabRenderer::TabImage TabRenderer::tab_active = {0}; +TabRenderer::TabImage TabRenderer::tab_active_nano = {0}; TabRenderer::TabImage TabRenderer::tab_inactive = {0}; +TabRenderer::TabImage TabRenderer::tab_alpha_nano = {0}; // Max opacity for the mini-tab title change animation. const double kMiniTitleChangeThrobOpacity = 0.75; @@ -210,7 +212,7 @@ class TabCloseButton : public views::ImageButton { } private: - DISALLOW_EVIL_CONSTRUCTORS(TabCloseButton); + DISALLOW_COPY_AND_ASSIGN(TabCloseButton); }; } // namespace @@ -251,7 +253,7 @@ class TabRenderer::FavIconCrashAnimation : public Animation, private: TabRenderer* target_; - DISALLOW_EVIL_CONSTRUCTORS(FavIconCrashAnimation); + DISALLOW_COPY_AND_ASSIGN(FavIconCrashAnimation); }; //////////////////////////////////////////////////////////////////////////////// @@ -738,45 +740,47 @@ void TabRenderer::PaintInactiveTabBackground(gfx::Canvas* canvas) { int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ? 0 : background_offset_.y(); - // Draw left edge. Don't draw over the toolbar, as we're not the foreground - // tab. - SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( - *tab_bg, offset, bg_offset_y, tab_active.l_width, height()); - SkBitmap theme_l = - SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha.image_l); - canvas->DrawBitmapInt(theme_l, - 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, - 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, - false); - - // Draw right edge. Again, don't draw over the toolbar. - SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, - offset + width() - tab_active.r_width, bg_offset_y, - tab_active.r_width, height()); - SkBitmap theme_r = - SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha.image_r); - canvas->DrawBitmapInt(theme_r, - 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, - width() - theme_r.width(), 0, theme_r.width(), - theme_r.height() - kToolbarOverlap, false); - - // Draw center. Instead of masking out the top portion we simply skip over it - // by incrementing by kDropShadowHeight, since it's a simple rectangle. And - // again, don't draw over the toolbar. - canvas->TileImageInt(*tab_bg, - offset + tab_active.l_width, bg_offset_y + kDropShadowHeight, - tab_active.l_width, kDropShadowHeight, - width() - tab_active.l_width - tab_active.r_width, - height() - kDropShadowHeight - kToolbarOverlap); - - // Now draw the highlights/shadows around the tab edge. - canvas->DrawBitmapInt(*tab_inactive.image_l, 0, 0); - canvas->TileImageInt(*tab_inactive.image_c, - tab_inactive.l_width, 0, - width() - tab_inactive.l_width - tab_inactive.r_width, - height()); - canvas->DrawBitmapInt(*tab_inactive.image_r, - width() - tab_inactive.r_width, 0); + if (!data_.app) { + // Draw left edge. Don't draw over the toolbar, as we're not the foreground + // tab. + SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( + *tab_bg, offset, bg_offset_y, tab_active.l_width, height()); + SkBitmap theme_l = + SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha.image_l); + canvas->DrawBitmapInt(theme_l, + 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, + 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, + false); + + // Draw right edge. Again, don't draw over the toolbar. + SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, + offset + width() - tab_active.r_width, bg_offset_y, + tab_active.r_width, height()); + SkBitmap theme_r = + SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha.image_r); + canvas->DrawBitmapInt(theme_r, + 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, + width() - theme_r.width(), 0, theme_r.width(), + theme_r.height() - kToolbarOverlap, false); + + // Draw center. Instead of masking out the top portion we simply skip over + // it by incrementing by kDropShadowHeight, since it's a simple rectangle. + // And again, don't draw over the toolbar. + canvas->TileImageInt(*tab_bg, + offset + tab_active.l_width, bg_offset_y + kDropShadowHeight, + tab_active.l_width, kDropShadowHeight, + width() - tab_active.l_width - tab_active.r_width, + height() - kDropShadowHeight - kToolbarOverlap); + + // Now draw the highlights/shadows around the tab edge. + canvas->DrawBitmapInt(*tab_inactive.image_l, 0, 0); + canvas->TileImageInt(*tab_inactive.image_c, + tab_inactive.l_width, 0, + width() - tab_inactive.l_width - tab_inactive.r_width, + height()); + canvas->DrawBitmapInt(*tab_inactive.image_r, + width() - tab_inactive.r_width, 0); + } } void TabRenderer::PaintActiveTabBackground(gfx::Canvas* canvas) { @@ -788,33 +792,39 @@ void TabRenderer::PaintActiveTabBackground(gfx::Canvas* canvas) { SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); + // App tabs are drawn slightly differently (as nano tabs). + TabImage* tab_image = data_.app ? &tab_active_nano : &tab_active; + TabImage* alpha = data_.app ? &tab_alpha_nano : &tab_alpha; + // Draw left edge. SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( - *tab_bg, offset, 0, tab_active.l_width, height()); + *tab_bg, offset, 0, tab_image->l_width, height()); SkBitmap theme_l = - SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha.image_l); + SkBitmapOperations::CreateMaskedBitmap(tab_l, *alpha->image_l); canvas->DrawBitmapInt(theme_l, 0, 0); // Draw right edge. SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, - offset + width() - tab_active.r_width, 0, tab_active.r_width, height()); + offset + width() - tab_image->r_width, 0, tab_image->r_width, height()); SkBitmap theme_r = - SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha.image_r); - canvas->DrawBitmapInt(theme_r, width() - tab_active.r_width, 0); + SkBitmapOperations::CreateMaskedBitmap(tab_r, *alpha->image_r); + canvas->DrawBitmapInt(theme_r, width() - tab_image->r_width, 0); // Draw center. Instead of masking out the top portion we simply skip over it // by incrementing by kDropShadowHeight, since it's a simple rectangle. canvas->TileImageInt(*tab_bg, - offset + tab_active.l_width, kDropShadowHeight, - tab_active.l_width, kDropShadowHeight, - width() - tab_active.l_width - tab_active.r_width, - height() - kDropShadowHeight); + offset + tab_image->l_width, + kDropShadowHeight + tab_image->y_offset, + tab_image->l_width, + kDropShadowHeight + tab_image->y_offset, + width() - tab_image->l_width - tab_image->r_width, + height() - kDropShadowHeight - tab_image->y_offset); // Now draw the highlights/shadows around the tab edge. - canvas->DrawBitmapInt(*tab_active.image_l, 0, 0); - canvas->TileImageInt(*tab_active.image_c, tab_active.l_width, 0, - width() - tab_active.l_width - tab_active.r_width, height()); - canvas->DrawBitmapInt(*tab_active.image_r, width() - tab_active.r_width, 0); + canvas->DrawBitmapInt(*tab_image->image_l, 0, 0); + canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, 0, + width() - tab_image->l_width - tab_image->r_width, height()); + canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0); } void TabRenderer::PaintLoadingAnimation(gfx::Canvas* canvas) { @@ -959,16 +969,30 @@ void TabRenderer::LoadTabImages() { tab_alpha.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_LEFT); tab_alpha.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_RIGHT); + tab_alpha_nano.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_NANO_LEFT); + tab_alpha_nano.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_NANO_RIGHT); + tab_active.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_LEFT); tab_active.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_CENTER); tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); tab_active.l_width = tab_active.image_l->width(); tab_active.r_width = tab_active.image_r->width(); + // This is high much taller *visually* the regular tab is compared to the + // nano tabs. The images are the same height, this is really just the + // difference in whitespace above the tab image. + const int kMiniTabDiffHeight = 14; + + tab_active_nano.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_LEFT); + tab_active_nano.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_CENTER); + tab_active_nano.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_NANO_RIGHT); + tab_active_nano.l_width = tab_active_nano.image_l->width(); + tab_active_nano.r_width = tab_active_nano.image_r->width(); + tab_active_nano.y_offset = kMiniTabDiffHeight; + tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); - tab_inactive.l_width = tab_inactive.image_l->width(); tab_inactive.r_width = tab_inactive.image_r->width(); diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h index dfb7272..fc01a7a 100644 --- a/chrome/browser/views/tabs/tab_renderer.h +++ b/chrome/browser/views/tabs/tab_renderer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ -#define CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ +#ifndef CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H_ +#define CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H_ #include "app/animation.h" #include "base/ref_counted.h" @@ -39,7 +39,7 @@ class TabRenderer : public views::View, TabRenderer(); virtual ~TabRenderer(); - // Sizes the renderer to the size of the new tab images. This is used when + // Sizes the renderer to the size of the new tab images. This is used // during the new tab animation. See TabStrip's description of AnimationType // for details. void SizeToNewTabButtonImages(); @@ -62,6 +62,10 @@ class TabRenderer : public views::View, void set_mini(bool mini) { data_.mini = mini; } bool mini() const { return data_.mini; } + // Sets the mini-state of the tab. + void set_app(bool app) { data_.app = app; } + bool app() const { return data_.app; } + // Sets the phantom state of the tab. void set_phantom(bool phantom) { data_.phantom = phantom; } bool phantom() const { return data_.phantom; } @@ -235,6 +239,7 @@ class TabRenderer : public views::View, blocked(false), animating_mini_change(false), phantom(false), + app(false), render_as_new_tab(false), render_unselected(false), alpha(1) { @@ -250,6 +255,7 @@ class TabRenderer : public views::View, bool blocked; bool animating_mini_change; bool phantom; + bool app; bool render_as_new_tab; bool render_unselected; double alpha; @@ -262,10 +268,13 @@ class TabRenderer : public views::View, SkBitmap* image_r; int l_width; int r_width; + int y_offset; }; static TabImage tab_active; + static TabImage tab_active_nano; static TabImage tab_inactive; static TabImage tab_alpha; + static TabImage tab_alpha_nano; // Whether we're showing the icon. It is cached so that we can detect when it // changes and layout appropriately. @@ -294,7 +303,7 @@ class TabRenderer : public views::View, static void InitClass(); static bool initialized_; - DISALLOW_EVIL_CONSTRUCTORS(TabRenderer); + DISALLOW_COPY_AND_ASSIGN(TabRenderer); }; -#endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H__ +#endif // CHROME_BROWSER_VIEWS_TABS_TAB_RENDERER_H_ diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 56bf512..a28ff52b 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -695,6 +695,7 @@ void TabStrip::TabInsertedAt(TabContents* contents, tab->UpdateData(contents, model_->IsPhantomTab(model_index), false); } tab->set_mini(model_->IsMiniTab(model_index)); + tab->set_app(model_->IsAppTab(model_index)); tab->SetBlocked(model_->IsTabBlocked(model_index)); // We only add the tab to the child list if it's not already - an invisible @@ -1195,7 +1196,7 @@ bool TabStrip::IsCursorInTabStripZone() const { DWORD pos = GetMessagePos(); gfx::Point cursor_point(pos); #elif defined(OS_LINUX) - // TODO: make sure this is right with multiple monitors. + // TODO(sky): make sure this is right with multiple monitors. GdkScreen* screen = gdk_screen_get_default(); GdkDisplay* display = gdk_screen_get_display(screen); gint x, y; @@ -1599,6 +1600,7 @@ void TabStrip::StartMoveTabAnimation(int from_model_index, TabData data = {tab, gfx::Rect()}; tab->set_mini(model_->IsMiniTab(to_model_index)); + //tab->set_app(model_->IsAppTab(to_model_index)); tab->SetBlocked(model_->IsTabBlocked(to_model_index)); int to_tab_data_index = ModelIndexToTabDataIndex(to_model_index); |