diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 17:51:25 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 17:51:25 +0000 |
commit | 3cf345b49d5211de2519b43e8ed54789f1f60f65 (patch) | |
tree | cec62098a029c0163235074b7c90eca909471500 /chrome | |
parent | 0f73de7165827924b7d386f88f4de221604f08ed (diff) | |
download | chromium_src-3cf345b49d5211de2519b43e8ed54789f1f60f65.zip chromium_src-3cf345b49d5211de2519b43e8ed54789f1f60f65.tar.gz chromium_src-3cf345b49d5211de2519b43e8ed54789f1f60f65.tar.bz2 |
views: remove vertical tabs
BUG=31763,99332
TEST=side tabs no longer work
Review URL: http://codereview.chromium.org/8166008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
54 files changed, 145 insertions, 1388 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 0cf617e..d676b5d 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -54,7 +54,6 @@ #define IDC_EXIT 34031 #define IDC_MOVE_TAB_NEXT 34032 #define IDC_MOVE_TAB_PREVIOUS 34033 -#define IDC_TOGGLE_VERTICAL_TABS 34034 #define IDC_SEARCH 34035 #define IDC_TABPOSE 34036 #define IDC_DEBUG_FRAME_TOGGLE 34038 diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 6931d94..2f9a968 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -90,13 +90,6 @@ const Experiment kExperiments[] = { #endif }, { - "vertical-tabs", // FLAGS:RECORD_UMA - IDS_FLAGS_SIDE_TABS_NAME, - IDS_FLAGS_SIDE_TABS_DESCRIPTION, - kOsWin | kOsCrOS, - SINGLE_VALUE_TYPE(switches::kEnableVerticalTabs) - }, - { "conflicting-modules-check", // FLAGS:RECORD_UMA IDS_FLAGS_CONFLICTS_CHECK_NAME, IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION, diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index bf54c1f..a58cb46 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc @@ -88,17 +88,6 @@ class AboutFlagsTest : public ::testing::Test { AboutFlagsTest() { prefs_.RegisterListPref(prefs::kEnabledLabsExperiments, PrefService::UNSYNCABLE_PREF); -#if defined(OS_CHROMEOS) - prefs_.RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, - false, - PrefService::UNSYNCABLE_PREF); - prefs_.RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, - false, - PrefService::UNSYNCABLE_PREF); - prefs_.RegisterBooleanPref(prefs::kUseVerticalTabs, - false, - PrefService::UNSYNCABLE_PREF); -#endif testing::ClearState(); } diff --git a/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc index 6af4457..3feb0d5 100644 --- a/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc +++ b/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc @@ -64,7 +64,7 @@ views::View* BrowserFrameViewChromeos::GetEventHandlerForPoint( int BrowserFrameViewChromeos::GetHorizontalTabStripVerticalOffset( bool restored) const { - return NonClientTopBorderHeight(restored, true) + kTopPad; + return NonClientTopBorderHeight(restored) + kTopPad; } void BrowserFrameViewChromeos::ModifyMaximizedFramePainting( diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index 7ba7ed0..2b905bc 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -49,8 +49,6 @@ namespace { -// Amount to offset the toolbar by when vertical tabs are enabled. -const int kVerticalTabStripToolbarOffset = 2; // Amount to tweak the position of the status area to get it to look right. const int kStatusAreaVerticalAdjustment = -1; @@ -169,19 +167,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { views::View::ConvertPointToView(browser_view_->parent(), browser_view_, &tabstrip_origin); tabstrip_bounds.set_origin(tabstrip_origin); - return browser_view_->UseVerticalTabs() ? - LayoutTitlebarComponentsWithVerticalTabs(tabstrip_bounds) : - LayoutTitlebarComponents(tabstrip_bounds); - } - - virtual int LayoutToolbar(int top) OVERRIDE { - if (!browser_view_->IsFullscreen() && browser_view_->IsTabStripVisible() && - browser_view_->UseVerticalTabs()) { - // For vertical tabs the toolbar is positioned in - // LayoutTitlebarComponentsWithVerticalTabs. - return top; - } - return ::BrowserViewLayout::LayoutToolbar(top); + return LayoutTitlebarComponents(tabstrip_bounds); } virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE { @@ -222,53 +208,6 @@ class BrowserViewLayout : public ::BrowserViewLayout { return false; } - // Positions the titlebar, toolbar and tabstrip. This is - // used when side tabs are enabled. - int LayoutTitlebarComponentsWithVerticalTabs(const gfx::Rect& bounds) { - if (bounds.IsEmpty()) - return 0; - - tabstrip_->SetVisible(true); - status_area_->SetVisible(true); - layout_mode_button_->SetVisible(false); - layout_mode_button_->SetBounds(0, 0, 0, 0); - - gfx::Size status_size = status_area_->GetPreferredSize(); - int status_height = status_size.height(); - - int status_x = bounds.x(); - // Layout the status area. - status_area_->SetBounds(status_x, bounds.bottom() - status_height, - status_size.width(), status_height); - UpdateStatusAreaBoundsProperty(); - - // The tabstrip's width is the bigger of its preferred width and the width - // the status area. - int tabstrip_w = std::max(status_x + status_size.width(), - tabstrip_->GetPreferredSize().width()); - tabstrip_->SetBounds(bounds.x(), bounds.y(), tabstrip_w, - bounds.height() - status_height); - - // The toolbar is promoted to the title for vertical tabs. - bool toolbar_visible = browser_view_->IsToolbarVisible(); - int toolbar_height = 0; - if (toolbar_) { - toolbar_->SetVisible(toolbar_visible); - if (toolbar_visible) - toolbar_height = toolbar_->GetPreferredSize().height(); - int tabstrip_max_x = tabstrip_->bounds().right(); - toolbar_->SetBounds(tabstrip_max_x, - bounds.y() - kVerticalTabStripToolbarOffset, - browser_view_->width() - tabstrip_max_x, - toolbar_height); - } - // Adjust the available bounds for other components. - gfx::Rect available_bounds = vertical_layout_rect(); - available_bounds.Inset(tabstrip_w, 0, 0, 0); - set_vertical_layout_rect(available_bounds); - return bounds.y() + toolbar_height; - } - // Lays out tabstrip, status area, and layout mode button in the title bar // area (given by |bounds|). int LayoutTitlebarComponents(const gfx::Rect& bounds) { diff --git a/chrome/browser/tabs/default_tab_handler.cc b/chrome/browser/tabs/default_tab_handler.cc index 5711237..14d7d0a 100644 --- a/chrome/browser/tabs/default_tab_handler.cc +++ b/chrome/browser/tabs/default_tab_handler.cc @@ -108,10 +108,6 @@ bool DefaultTabHandler::CanCloseTab() const { return delegate_->AsBrowser()->CanCloseTab(); } -void DefaultTabHandler::ToggleUseVerticalTabs() { - delegate_->AsBrowser()->ToggleUseVerticalTabs(); -} - bool DefaultTabHandler::CanRestoreTab() { return delegate_->AsBrowser()->CanRestoreTab(); } @@ -124,10 +120,6 @@ bool DefaultTabHandler::LargeIconsPermitted() const { return delegate_->AsBrowser()->LargeIconsPermitted(); } -bool DefaultTabHandler::UseVerticalTabs() const { - return delegate_->AsBrowser()->UseVerticalTabs(); -} - //////////////////////////////////////////////////////////////////////////////// // DefaultTabHandler, TabStripModelObserver implementation: diff --git a/chrome/browser/tabs/default_tab_handler.h b/chrome/browser/tabs/default_tab_handler.h index a612662..6145503 100644 --- a/chrome/browser/tabs/default_tab_handler.h +++ b/chrome/browser/tabs/default_tab_handler.h @@ -51,11 +51,9 @@ class DefaultTabHandler : public TabHandler, virtual bool CanBookmarkAllTabs() const; virtual void BookmarkAllTabs(); virtual bool CanCloseTab() const; - virtual void ToggleUseVerticalTabs(); virtual bool CanRestoreTab(); virtual void RestoreTab(); virtual bool LargeIconsPermitted() const; - virtual bool UseVerticalTabs() const; // Overridden from TabStripModelObserver: virtual void TabInsertedAt(TabContentsWrapper* contents, diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 32c6890..348f1835 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -785,9 +785,6 @@ bool TabStripModel::IsContextMenuCommandEnabled( return browser_defaults::bookmarks_enabled && delegate_->CanBookmarkAllTabs(); - case CommandUseVerticalTabs: - return true; - case CommandSelectByDomain: case CommandSelectByOpener: return true; @@ -798,19 +795,6 @@ bool TabStripModel::IsContextMenuCommandEnabled( return false; } -bool TabStripModel::IsContextMenuCommandChecked( - int context_index, - ContextMenuCommand command_id) const { - switch (command_id) { - case CommandUseVerticalTabs: - return delegate()->UseVerticalTabs(); - default: - NOTREACHED(); - break; - } - return false; -} - void TabStripModel::ExecuteContextMenuCommand( int context_index, ContextMenuCommand command_id) { DCHECK(command_id > CommandFirst && command_id < CommandLast); @@ -918,14 +902,6 @@ void TabStripModel::ExecuteContextMenuCommand( break; } - case CommandUseVerticalTabs: { - UserMetrics::RecordAction( - UserMetricsAction("TabContextMenu_UseVerticalTabs")); - - delegate()->ToggleUseVerticalTabs(); - break; - } - case CommandSelectByDomain: case CommandSelectByOpener: { std::vector<int> indices; @@ -1048,9 +1024,6 @@ bool TabStripModel::ContextMenuCommandToBrowserCommand(int cmd_id, case CommandBookmarkAllTabs: *browser_cmd = IDC_BOOKMARK_ALL_TABS; break; - case CommandUseVerticalTabs: - *browser_cmd = IDC_TOGGLE_VERTICAL_TABS; - break; default: *browser_cmd = 0; return false; diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index aa5c4b2..02872b9 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -432,7 +432,6 @@ class TabStripModel : public NotificationObserver { CommandRestoreTab, CommandTogglePinned, CommandBookmarkAllTabs, - CommandUseVerticalTabs, CommandUseCompactNavigationBar, CommandSelectByDomain, CommandSelectByOpener, @@ -444,10 +443,6 @@ class TabStripModel : public NotificationObserver { bool IsContextMenuCommandEnabled(int context_index, ContextMenuCommand command_id) const; - // Returns true if the specified command is checked. - bool IsContextMenuCommandChecked(int context_index, - ContextMenuCommand command_id) const; - // Performs the action associated with the specified command for the given // TabStripModel index |context_index|. If |context_index| is selected the // command applies to all selected tabs. diff --git a/chrome/browser/tabs/tab_strip_model_delegate.h b/chrome/browser/tabs/tab_strip_model_delegate.h index bae327e..e58d9e5 100644 --- a/chrome/browser/tabs/tab_strip_model_delegate.h +++ b/chrome/browser/tabs/tab_strip_model_delegate.h @@ -112,12 +112,6 @@ class TabStripModelDelegate { // Returns true if any of the tabs can be closed. virtual bool CanCloseTab() const = 0; - // Returns true if the vertical tabstrip presentation should be used. - virtual bool UseVerticalTabs() const = 0; - - // Toggles the use of the vertical tabstrip. - virtual void ToggleUseVerticalTabs() = 0; - // Returns true if the tab strip can use large icons. virtual bool LargeIconsPermitted() const = 0; diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index 64b40b0..a62b9e5 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -127,8 +127,6 @@ class TabStripDummyDelegate : public TabStripModelDelegate { virtual bool CanBookmarkAllTabs() const { return false; } virtual void BookmarkAllTabs() {} virtual bool CanCloseTab() const { return true; } - virtual bool UseVerticalTabs() const { return false; } - virtual void ToggleUseVerticalTabs() {} virtual bool LargeIconsPermitted() const { return true; } private: diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 67bbbb9..e16296c 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -338,15 +338,6 @@ Browser::Browser(Type type, Profile* profile) // or you'll get a nasty surprise when you run the incognito tests. encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, profile_->GetPrefs(), NULL); - use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); - - if (!TabMenuModel::AreVerticalTabsEnabled()) { - // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we - // might show vertical tabs but not show an option to turn them off. - use_vertical_tabs_.SetValue(false); - } - - UpdateTabStripModelInsertionPolicy(); tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); if (tab_restore_service_) { @@ -401,7 +392,6 @@ Browser::~Browser() { local_pref_registrar_.RemoveAll(); encoding_auto_detect_.Destroy(); - use_vertical_tabs_.Destroy(); if (profile_->IsOffTheRecord() && !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { @@ -1343,16 +1333,6 @@ TabContents* Browser::GetOrCloneTabForDisposition( return current_tab->tab_contents(); } -void Browser::UpdateTabStripModelInsertionPolicy() { - tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? - TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); -} - -void Browser::UseVerticalTabsChanged() { - UpdateTabStripModelInsertionPolicy(); - window()->ToggleTabStripMode(); -} - bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, bool check_fullscreen) const { // On Mac, fullscreen mode has most normal things (in a slide-down panel). On @@ -2280,9 +2260,6 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true, PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, - false, - PrefService::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableTranslate, true, PrefService::SYNCABLE_PREF); @@ -2629,7 +2606,6 @@ void Browser::ExecuteCommandWithDisposition( case IDC_PRESENTATION_MODE: TogglePresentationMode(); break; #endif case IDC_EXIT: Exit(); break; - case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; #if defined(OS_CHROMEOS) case IDC_SEARCH: Search(); break; case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; @@ -3122,11 +3098,6 @@ bool Browser::CanCloseTab() const { return !watcher || watcher->CanCloseTab(this); } -void Browser::ToggleUseVerticalTabs() { - use_vertical_tabs_.SetValue(!UseVerticalTabs()); - UseVerticalTabsChanged(); -} - bool Browser::LargeIconsPermitted() const { // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because // for those windows, we already have a big icon in the top-left outside any @@ -3525,10 +3496,6 @@ void Browser::UpdateDownloadShelfVisibility(bool visible) { GetStatusBubble()->UpdateDownloadShelfVisibility(visible); } -bool Browser::UseVerticalTabs() const { - return use_vertical_tabs_.GetValue(); -} - void Browser::ContentsZoomChange(bool zoom_in) { ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); } @@ -4072,9 +4039,7 @@ void Browser::Observe(int type, case chrome::NOTIFICATION_PREF_CHANGED: { const std::string& pref_name = *Details<std::string>(details).ptr(); - if (pref_name == prefs::kUseVerticalTabs) { - UseVerticalTabsChanged(); - } else if (pref_name == prefs::kPrintingEnabled) { + if (pref_name == prefs::kPrintingEnabled) { UpdatePrintingState(GetContentRestrictionsForSelectedTab()); } else if (pref_name == prefs::kInstantEnabled || pref_name == prefs::kMetricsReportingEnabled || @@ -4261,7 +4226,6 @@ void Browser::InitCommandState() { command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false); command_updater_.UpdateCommandEnabled(IDC_EXIT, true); - command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, true); command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); // Page-related commands @@ -4445,7 +4409,6 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); - command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); #endif diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 5040535..be68050 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -615,9 +615,6 @@ class Browser : public TabHandlerDelegate, virtual void UpdateDownloadShelfVisibility(bool visible); - // Overridden from TabStripModelDelegate: - virtual bool UseVerticalTabs() const; - ///////////////////////////////////////////////////////////////////////////// // Sets the value of homepage related prefs to new values. Since we do not @@ -787,7 +784,6 @@ class Browser : public TabHandlerDelegate, virtual bool CanBookmarkAllTabs() const; virtual void BookmarkAllTabs(); virtual bool CanCloseTab() const; - virtual void ToggleUseVerticalTabs(); virtual bool CanRestoreTab(); virtual void RestoreTab(); virtual bool LargeIconsPermitted() const; @@ -1207,14 +1203,6 @@ class Browser : public TabHandlerDelegate, // current tab. TabContents* GetOrCloneTabForDisposition(WindowOpenDisposition disposition); - // Sets the insertion policy of the tabstrip based on whether vertical tabs - // are enabled. - void UpdateTabStripModelInsertionPolicy(); - - // Invoked when the use vertical tabs preference changes. Resets the insertion - // policy of the tab strip model and notifies the window. - void UseVerticalTabsChanged(); - // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If // |check_fullscreen| is true, the set of features reflect the actual state of // the browser, otherwise the set of features reflect the possible state of @@ -1391,9 +1379,6 @@ class Browser : public TabHandlerDelegate, // from a TabContents. Currently, only one pending action is allowed. WebAppAction pending_web_app_action_; - // Tracks the display mode of the tabstrip. - mutable BooleanPrefMember use_vertical_tabs_; - // The profile's tab restore service. The service is owned by the profile, // and we install ourselves as an observer. TabRestoreService* tab_restore_service_; diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 7ef8523..4dfda90 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -298,9 +298,6 @@ class BrowserWindow { virtual void Copy() = 0; virtual void Paste() = 0; - // Switches between available tabstrip display modes. - virtual void ToggleTabStripMode() = 0; - #if defined(OS_MACOSX) // Opens the tabpose view. virtual void OpenTabpose() = 0; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index e1b0c3c..5dba0ca 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -103,7 +103,6 @@ class BrowserWindowCocoa : public BrowserWindow, virtual void Cut(); virtual void Copy(); virtual void Paste(); - virtual void ToggleTabStripMode(); virtual void OpenTabpose(); virtual void SetPresentationMode(bool presentation_mode); virtual bool InPresentationMode(); diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 9d7105f..42303bd 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -499,10 +499,6 @@ void BrowserWindowCocoa::Paste() { [NSApp sendAction:@selector(paste:) to:nil from:nil]; } -void BrowserWindowCocoa::ToggleTabStripMode() { - NOTIMPLEMENTED(); -} - void BrowserWindowCocoa::OpenTabpose() { [controller_ openTabpose]; } diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm index cc922cf..b4f9b8b 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm @@ -87,10 +87,6 @@ class TestTabStripDelegate : public TabStripModelDelegate { virtual void BookmarkAllTabs() {} - virtual bool UseVerticalTabs() const { return false; } - - virtual void ToggleUseVerticalTabs() {} - virtual bool LargeIconsPermitted() const { return true; } }; diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 2d9316c9..de392e4 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1148,9 +1148,6 @@ void BrowserWindowGtk::Paste() { gtk_util::DoPaste(this); } -void BrowserWindowGtk::ToggleTabStripMode() { -} - void BrowserWindowGtk::PrepareForInstant() { TabContentsWrapper* contents = contents_container_->tab(); if (contents) diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index 432beeb..2944172 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -140,7 +140,6 @@ class BrowserWindowGtk : public BrowserWindow, virtual void Cut(); virtual void Copy(); virtual void Paste(); - virtual void ToggleTabStripMode(); virtual void PrepareForInstant(); virtual void ShowInstant(TabContentsWrapper* preview); virtual void HideInstant(bool instant_is_active); diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index 2034a36..d977f94 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -457,10 +457,6 @@ void Panel::Paste() { native_panel_->PanelPaste(); } -void Panel::ToggleTabStripMode() { - NOTIMPLEMENTED(); -} - #if defined(OS_MACOSX) void Panel::OpenTabpose() { NOTIMPLEMENTED(); diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h index cad6684..7c93a75 100644 --- a/chrome/browser/ui/panels/panel.h +++ b/chrome/browser/ui/panels/panel.h @@ -142,7 +142,6 @@ class Panel : public BrowserWindow, public NotificationObserver { virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; - virtual void ToggleTabStripMode() OVERRIDE; #if defined(OS_MACOSX) virtual void OpenTabpose() OVERRIDE; virtual void SetPresentationMode(bool presentation_mode) OVERRIDE; diff --git a/chrome/browser/ui/tabs/tab_menu_model.cc b/chrome/browser/ui/tabs/tab_menu_model.cc index d9abf1d..c872e01 100644 --- a/chrome/browser/ui/tabs/tab_menu_model.cc +++ b/chrome/browser/ui/tabs/tab_menu_model.cc @@ -16,16 +16,6 @@ TabMenuModel::TabMenuModel(ui::SimpleMenuModel::Delegate* delegate, Build(tab_strip, index); } -// static -bool TabMenuModel::AreVerticalTabsEnabled() { -#if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) || defined(OS_CHROMEOS) - return CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableVerticalTabs); -#else - return false; -#endif -} - void TabMenuModel::Build(TabStripModel* tab_strip, int index) { bool affects_multiple_tabs = (tab_strip->IsTabSelected(index) && @@ -61,11 +51,6 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) { AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); - if (AreVerticalTabsEnabled()) { - AddSeparator(); - AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, - IDS_TAB_CXMENU_USE_VERTICAL_TABS); - } if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableTabGroupsContextMenu)) { AddSeparator(); diff --git a/chrome/browser/ui/tabs/tab_menu_model.h b/chrome/browser/ui/tabs/tab_menu_model.h index 25013db..da7ff3a 100644 --- a/chrome/browser/ui/tabs/tab_menu_model.h +++ b/chrome/browser/ui/tabs/tab_menu_model.h @@ -20,9 +20,6 @@ class TabMenuModel : public ui::SimpleMenuModel { int index); virtual ~TabMenuModel() {} - // Returns true if vertical tabs are enabled. - static bool AreVerticalTabsEnabled(); - private: void Build(TabStripModel* tab_strip, int index); diff --git a/chrome/browser/ui/touch/tabs/tab_strip_factory.cc b/chrome/browser/ui/touch/tabs/tab_strip_factory.cc index 8d6046c..5dbd533 100644 --- a/chrome/browser/ui/touch/tabs/tab_strip_factory.cc +++ b/chrome/browser/ui/touch/tabs/tab_strip_factory.cc @@ -12,8 +12,7 @@ // The implementation of CreateTabStrip for touchui creates a TouchTabStrip AbstractTabStripView* CreateTabStrip(Browser* browser, views::View* parent, - TabStripModel* model, - bool use_vertical_tabs) { + TabStripModel* model) { TouchTabStripController* tabstrip_controller = new TouchTabStripController(browser, model); // Ownership of this controller is given to a specific tabstrip when we diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip_unittest.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip_unittest.cc index c5d1b75..183cb0e 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip_unittest.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip_unittest.cc @@ -6,9 +6,6 @@ #include "chrome/browser/ui/views/tabs/base_tab_strip_test_fixture.h" #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" -#include "chrome/browser/ui/views/tabs/tab_strip.h" -#include "chrome/browser/ui/views/tabs/tab_strip_controller.h" #include "testing/gtest/include/gtest/gtest.h" // BaseTabStrip unit tests using TouchTabStrip. @@ -29,7 +26,3 @@ class TouchTabStripTestFixture : public testing::Test { TouchTabStrip tab_strip_; }; -TEST_F(TouchTabStripTestFixture, TouchTabStripIsHorizontal) { - EXPECT_EQ(BaseTabStrip::HORIZONTAL_TAB_STRIP, tab_strip()->type()); -} - diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 0d719df..28a27c2 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -193,8 +193,7 @@ void BrowserFrameWin::UpdateDWMFrame() { if (!browser_view_->IsFullscreen()) { gfx::Rect tabstrip_bounds( browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); - margins.cyTopHeight = (browser_view_->UseVerticalTabs() ? - tabstrip_bounds.y() : tabstrip_bounds.bottom()) + kDWMFrameTopOffset; + margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; } } else { // For popup and app windows we want to use the default margins. diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 51933e7..7d097c6 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -384,10 +384,6 @@ gfx::Rect BrowserView::GetToolbarBounds() const { gfx::Rect toolbar_bounds(toolbar_->bounds()); if (toolbar_bounds.IsEmpty()) return toolbar_bounds; - // When using vertical tabs, the toolbar appears to extend behind the tab - // column. - if (UseVerticalTabs()) - toolbar_bounds.Inset(tabstrip_->x() - toolbar_bounds.x(), 0, 0, 0); // The apparent toolbar edges are outside the "real" toolbar edges. toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); return toolbar_bounds; @@ -432,10 +428,6 @@ bool BrowserView::IsTabStripVisible() const { return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); } -bool BrowserView::UseVerticalTabs() const { - return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); -} - bool BrowserView::IsOffTheRecord() const { return browser_->profile()->IsOffTheRecord(); } @@ -1237,11 +1229,6 @@ void BrowserView::Paste() { true, false, false, false); } -void BrowserView::ToggleTabStripMode() { - InitTabStrip(browser_->tabstrip_model()); - frame_->TabStripDisplayModeChanged(); -} - void BrowserView::PrepareForInstant() { contents_->FadeActiveContents(); } @@ -1816,7 +1803,7 @@ void BrowserView::InitTabStrip(TabStripModel* model) { if (tabstrip_) tabstrip_->parent()->RemoveChildView(tabstrip_); - tabstrip_ = CreateTabStrip(browser_.get(), this, model, UseVerticalTabs()); + tabstrip_ = CreateTabStrip(browser_.get(), this, model); } ToolbarView* BrowserView::CreateToolbar() const { @@ -1976,9 +1963,6 @@ void BrowserView::LayoutStatusBubble() { // frame. int overlap = StatusBubbleViews::kShadowThickness + (IsMaximized() ? 0 : views::NonClientFrameView::kClientEdgeThickness); - int x = -overlap; - if (UseVerticalTabs() && IsTabStripVisible()) - x += tabstrip_->bounds().right(); int height = status_bubble_->GetPreferredSize().height(); int contents_height = status_bubble_->base_view()->bounds().height(); gfx::Point origin(-overlap, contents_height - height + overlap); diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index b949d3d..904c723 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -114,8 +114,7 @@ class BrowserView : public BrowserBubbleHost, // Returns the apparent bounds of the toolbar, in BrowserView coordinates. // These differ from |toolbar_.bounds()| in that they match where the toolbar // background image is drawn -- slightly outside the "true" bounds - // horizontally, and, when using vertical tabs, behind the tab column. Note - // that this returns the bounds for the toolbar area. + // horizontally. Note that this returns the bounds for the toolbar area. virtual gfx::Rect GetToolbarBounds() const; // Returns the bounds of the content area, in the coordinates of the @@ -151,9 +150,6 @@ class BrowserView : public BrowserBubbleHost, // Returns true if various window components are visible. virtual bool IsTabStripVisible() const; - // Returns true if the vertical tabstrip is in use. - bool UseVerticalTabs() const; - // Returns true if the profile associated with this Browser window is // incognito. bool IsOffTheRecord() const; @@ -316,7 +312,6 @@ class BrowserView : public BrowserBubbleHost, virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; - virtual void ToggleTabStripMode() OVERRIDE; virtual void PrepareForInstant() OVERRIDE; virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; virtual void HideInstant(bool instant_is_active) OVERRIDE; @@ -436,9 +431,7 @@ class BrowserView : public BrowserBubbleHost, // override to implement different layout policy. virtual views::LayoutManager* CreateLayoutManager() const; - // Initializes a new TabStrip for the browser view. This can be performed - // multiple times over the life of the browser, and is run when the display - // mode for the tabstrip changes from horizontal to vertical. + // Initializes a new TabStrip for the browser view. virtual void InitTabStrip(TabStripModel* tab_strip_model); // Factory Method. diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 68d5ce0..2aa05a4 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc @@ -263,7 +263,7 @@ void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { void BrowserViewLayout::Layout(views::View* host) { vertical_layout_rect_ = browser_view_->GetLocalBounds(); int top = LayoutTabStripRegion(); - if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { + if (browser_view_->IsTabStripVisible()) { tabstrip_->SetBackgroundOffset(gfx::Point( tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); @@ -318,13 +318,9 @@ int BrowserViewLayout::LayoutTabStripRegion() { &tabstrip_origin); tabstrip_bounds.set_origin(tabstrip_origin); - if (browser_view_->UseVerticalTabs()) - vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); - tabstrip_->SetVisible(true); tabstrip_->SetBoundsRect(tabstrip_bounds); - return browser_view_->UseVerticalTabs() ? - tabstrip_bounds.y() : tabstrip_bounds.bottom(); + return tabstrip_bounds.bottom(); } int BrowserViewLayout::LayoutToolbar(int top) { @@ -332,10 +328,8 @@ int BrowserViewLayout::LayoutToolbar(int top) { bool toolbar_visible = browser_view_->IsToolbarVisible(); toolbar_->location_bar()->set_focusable(toolbar_visible); int y = top; - if (!browser_view_->UseVerticalTabs()) { - y -= (toolbar_visible && browser_view_->IsTabStripVisible()) ? - kToolbarTabStripVerticalOverlap : 0; - } + y -= (toolbar_visible && browser_view_->IsTabStripVisible()) ? + kToolbarTabStripVerticalOverlap : 0; int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0; toolbar_->SetVisible(toolbar_visible); toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); diff --git a/chrome/browser/ui/views/frame/browser_view_layout.h b/chrome/browser/ui/views/frame/browser_view_layout.h index ae43f98..6c7fbde 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.h +++ b/chrome/browser/ui/views/frame/browser_view_layout.h @@ -118,9 +118,8 @@ class BrowserViewLayout : public views::LayoutManager { BrowserView* browser_view_; // The bounds within which the vertically-stacked contents of the BrowserView - // should be laid out within. When the SideTabstrip is not visible, this is - // just the local bounds of the BrowserView, otherwise it's the local bounds - // of the BrowserView less the width of the SideTabstrip. + // should be laid out within. This is just the local bounds of the + // BrowserView. gfx::Rect vertical_layout_rect_; // The distance the FindBar is from the top of the window, in pixels. diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index 3a277c7..b205560 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -16,7 +16,6 @@ #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/views/avatar_menu_button.h" #include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/common/chrome_notification_types.h" @@ -41,8 +40,6 @@ HICON GlassBrowserFrameView::throbber_icons_[ namespace { // There are 3 px of client edge drawn inside the outer frame borders. const int kNonClientBorderThickness = 3; -// Vertical tabs have 4 px border. -const int kNonClientVerticalTabStripBorderThickness = 4; // Besides the frame border, there's another 11 px of empty space atop the // window in restored mode, to use to drag the window around. const int kNonClientRestoredExtraThickness = 11; @@ -99,12 +96,6 @@ GlassBrowserFrameView::~GlassBrowserFrameView() { gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( views::View* tabstrip) const { - if (browser_view_->UseVerticalTabs()) { - gfx::Size ps = tabstrip->GetPreferredSize(); - return gfx::Rect(NonClientBorderThickness(), - NonClientTopBorderHeight(false, false), ps.width(), - browser_view_->height()); - } int minimize_button_offset = std::min(frame_->GetMinimizeButtonOffset(), width()); int tabstrip_x = browser_view_->ShouldShowAvatar() ? @@ -130,7 +121,7 @@ gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( int GlassBrowserFrameView::GetHorizontalTabStripVerticalOffset( bool restored) const { - return NonClientTopBorderHeight(restored, true); + return NonClientTopBorderHeight(restored); } void GlassBrowserFrameView::UpdateThrobber(bool running) { @@ -159,13 +150,9 @@ gfx::Size GlassBrowserFrameView::GetMinimumSize() { if (browser_view_->IsTabStripVisible()) { AbstractTabStripView* tabstrip = browser_view_->tabstrip(); int min_tabstrip_width = tabstrip->GetMinimumSize().width(); - if (browser_view_->UseVerticalTabs()) { - min_size.Enlarge(min_tabstrip_width, 0); - } else { - int min_tabstrip_area_width = - width() - GetBoundsForTabStrip(tabstrip).width() + min_tabstrip_width; - min_size.set_width(std::max(min_tabstrip_area_width, min_size.width())); - } + int min_tabstrip_area_width = + width() - GetBoundsForTabStrip(tabstrip).width() + min_tabstrip_width; + min_size.set_width(std::max(min_tabstrip_area_width, min_size.width())); } return min_size; @@ -269,22 +256,16 @@ int GlassBrowserFrameView::NonClientBorderThickness() const { if (frame_->IsMaximized() || frame_->IsFullscreen()) return 0; - return browser_view_->UseVerticalTabs() ? - kNonClientVerticalTabStripBorderThickness : - kNonClientBorderThickness; + return kNonClientBorderThickness; } int GlassBrowserFrameView::NonClientTopBorderHeight( - bool restored, - bool ignore_vertical_tabs) const { + bool restored) const { if (!restored && frame_->IsFullscreen()) return 0; // We'd like to use FrameBorderThickness() here, but the maximized Aero glass // frame has a 0 frame border around most edges and a CYSIZEFRAME-thick border // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). - if (browser_view_->IsTabStripVisible() && !ignore_vertical_tabs && - browser_view_->UseVerticalTabs()) - return GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION); return GetSystemMetrics(SM_CYSIZEFRAME) + ((!restored && browser_view_->IsMaximized()) ? -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); @@ -305,80 +286,44 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); SkBitmap* toolbar_center = tp->GetBitmapNamed(IDR_CONTENT_TOP_CENTER); - if (browser_view_->UseVerticalTabs()) { - gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin()); - View::ConvertPointToView(browser_view_, this, &tabstrip_origin); - int y = tabstrip_origin.y(); - - // Tile the toolbar image starting at the frame edge on the left and where - // the horizontal tabstrip would be on the top. - canvas->TileImageInt(*theme_toolbar, x, - y - GetHorizontalTabStripVerticalOffset(false), x, y, - w, theme_toolbar->height()); - - // Draw left edge. - int dest_y = y - kNonClientBorderThickness; - canvas->DrawBitmapInt(*toolbar_left, 0, 0, kNonClientBorderThickness, - kNonClientBorderThickness, left_x, dest_y, - kNonClientBorderThickness, kNonClientBorderThickness, - false); - - // Draw center edge. We need to draw a white line above the toolbar for the - // image to overlay nicely. - int center_offset = - -kContentEdgeShadowThickness + kNonClientBorderThickness; - canvas->FillRectInt(SK_ColorWHITE, x + center_offset, y - 1, - w - (2 * center_offset), 1); - canvas->TileImageInt(*toolbar_center, x + center_offset, dest_y, - w - (2 * center_offset), toolbar_center->height()); - - // Right edge. - SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER); - canvas->DrawBitmapInt(*toolbar_right, - toolbar_right->width() - kNonClientBorderThickness, 0, - kNonClientBorderThickness, kNonClientBorderThickness, - x + w - center_offset, dest_y, kNonClientBorderThickness, - kNonClientBorderThickness, false); - } else { - // Tile the toolbar image starting at the frame edge on the left and where - // the tabstrip is on the top. - int y = toolbar_bounds.y(); - int dest_y = y + (kFrameShadowThickness * 2); - canvas->TileImageInt(*theme_toolbar, x, - dest_y - GetHorizontalTabStripVerticalOffset(false), x, - dest_y, w, theme_toolbar->height()); - - // Draw rounded corners for the tab. - SkBitmap* toolbar_left_mask = - tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); - SkBitmap* toolbar_right_mask = - tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); - - // We mask out the corners by using the DestinationIn transfer mode, - // which keeps the RGB pixels from the destination and the alpha from - // the source. - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kDstIn_Mode); - - // Mask out the top left corner. - canvas->DrawBitmapInt(*toolbar_left_mask, left_x, y, paint); - - // Mask out the top right corner. - int right_x = - x + w + kContentEdgeShadowThickness - toolbar_right_mask->width(); - canvas->DrawBitmapInt(*toolbar_right_mask, right_x, y, paint); - - // Draw left edge. - canvas->DrawBitmapInt(*toolbar_left, left_x, y); - - // Draw center edge. - canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, - right_x - (left_x + toolbar_left->width()), toolbar_center->height()); - - // Right edge. - canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), - right_x, y); - } + // Tile the toolbar image starting at the frame edge on the left and where + // the tabstrip is on the top. + int y = toolbar_bounds.y(); + int dest_y = y + (kFrameShadowThickness * 2); + canvas->TileImageInt(*theme_toolbar, x, + dest_y - GetHorizontalTabStripVerticalOffset(false), x, + dest_y, w, theme_toolbar->height()); + + // Draw rounded corners for the tab. + SkBitmap* toolbar_left_mask = + tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); + SkBitmap* toolbar_right_mask = + tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); + + // We mask out the corners by using the DestinationIn transfer mode, + // which keeps the RGB pixels from the destination and the alpha from + // the source. + SkPaint paint; + paint.setXfermodeMode(SkXfermode::kDstIn_Mode); + + // Mask out the top left corner. + canvas->DrawBitmapInt(*toolbar_left_mask, left_x, y, paint); + + // Mask out the top right corner. + int right_x = + x + w + kContentEdgeShadowThickness - toolbar_right_mask->width(); + canvas->DrawBitmapInt(*toolbar_right_mask, right_x, y, paint); + + // Draw left edge. + canvas->DrawBitmapInt(*toolbar_left, left_x, y); + + // Draw center edge. + canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, + right_x - (left_x + toolbar_left->width()), toolbar_center->height()); + + // Right edge. + canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), + right_x, y); // Draw the content/toolbar separator. canvas->FillRectInt(ResourceBundle::toolbar_separator_color, @@ -392,11 +337,9 @@ void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { // The client edges start below the toolbar upper corner images regardless // of how tall the toolbar itself is. - int client_area_top = browser_view_->UseVerticalTabs() ? - client_area_bounds.y() : - (frame_->client_view()->y() + + int client_area_top = frame_->client_view()->y() + browser_view_->GetToolbarBounds().y() + - tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height()); + tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); int client_area_bottom = std::max(client_area_top, height() - NonClientBorderThickness()); int client_area_height = client_area_bottom - client_area_top; @@ -450,18 +393,11 @@ void GlassBrowserFrameView::LayoutAvatar() { if (base::i18n::IsRTL()) avatar_x += width() - frame_->GetMinimizeButtonOffset(); - int avatar_bottom, avatar_restored_y; - if (browser_view_->UseVerticalTabs()) { - avatar_bottom = NonClientTopBorderHeight(false, false) - - kAvatarBottomSpacing; - avatar_restored_y = kFrameShadowThickness; - } else { - avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + - browser_view_->GetTabStripHeight() - kAvatarBottomSpacing; - avatar_restored_y = avatar_bottom - incognito_icon.height(); - } + int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + + browser_view_->GetTabStripHeight() - kAvatarBottomSpacing; + int avatar_restored_y = avatar_bottom - incognito_icon.height(); int avatar_y = frame_->IsMaximized() ? - (NonClientTopBorderHeight(false, true) + kTabstripTopShadowThickness) : + (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : avatar_restored_y; avatar_bounds_.SetRect(avatar_x, avatar_y, incognito_icon.width(), browser_view_->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); @@ -478,7 +414,7 @@ gfx::Insets GlassBrowserFrameView::GetClientAreaInsets() const { if (!browser_view_->IsTabStripVisible()) return gfx::Insets(); - const int top_height = NonClientTopBorderHeight(false, false); + const int top_height = NonClientTopBorderHeight(false); const int border_thickness = NonClientBorderThickness(); return gfx::Insets(top_height, border_thickness, diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h index 143fa4e..bb8f96f 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h @@ -59,10 +59,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, // Returns the height of the entire nonclient top border, including the window // frame, any title area, and any connected client edge. If |restored| is - // true, acts as if the window is restored regardless of the real mode. If - // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless - // of the real state. - int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; + // true, acts as if the window is restored regardless of the real mode. + int NonClientTopBorderHeight(bool restored) const; // Paint various sub-components of this view. void PaintToolbarBackground(gfx::Canvas* canvas); diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 14e1d47..e0b594e 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -104,9 +104,6 @@ const int kNewTabCaptionMaximizedSpacing = 16; // How far to indent the tabstrip from the left side of the screen when there // is no avatar icon. const int kTabStripIndent = 1; -// Inset from the top of the toolbar/tabstrip to the shadow. Used only for -// vertical tabs. -const int kVerticalTabBorderInset = 3; // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if // |pt| is contained within. @@ -238,15 +235,12 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForReservedArea() const { } int OpaqueBrowserFrameView::NonClientTopBorderHeight( - bool restored, - bool ignore_vertical_tabs) const { + bool restored) const { views::WidgetDelegate* delegate = frame_->widget_delegate(); // |delegate| may be NULL if called from callback of InputMethodChanged while // a window is being destroyed. // See more discussion at http://crosbug.com/8958 - if ((delegate && delegate->ShouldShowWindowTitle()) || - (browser_view_->IsTabStripVisible() && !ignore_vertical_tabs && - browser_view_->UseVerticalTabs())) { + if (delegate && delegate->ShouldShowWindowTitle()) { return std::max(FrameBorderThickness(restored) + IconSize(), CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + TitlebarBottomThickness(restored); @@ -265,13 +259,6 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( if (!tabstrip) return gfx::Rect(); - if (browser_view_->UseVerticalTabs()) { - gfx::Size ps = tabstrip->GetPreferredSize(); - return gfx::Rect(NonClientBorderThickness(), - NonClientTopBorderHeight(false, false), ps.width(), - browser_view_->height()); - } - int tabstrip_x = browser_view_->ShouldShowAvatar() ? (avatar_bounds_.right() + kAvatarSideSpacing) : NonClientBorderThickness() + kTabStripIndent; @@ -286,7 +273,7 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( int OpaqueBrowserFrameView::GetHorizontalTabStripVerticalOffset( bool restored) const { - return NonClientTopBorderHeight(restored, true) + ((!restored && + return NonClientTopBorderHeight(restored) + ((!restored && (frame_->IsMaximized() || frame_->IsFullscreen())) ? 0 : kNonClientRestoredExtraThickness); @@ -301,7 +288,7 @@ gfx::Size OpaqueBrowserFrameView::GetMinimumSize() { gfx::Size min_size(browser_view_->GetMinimumSize()); int border_thickness = NonClientBorderThickness(); min_size.Enlarge(2 * border_thickness, - NonClientTopBorderHeight(false, false) + border_thickness); + NonClientTopBorderHeight(false) + border_thickness); views::WidgetDelegate* delegate = frame_->widget_delegate(); int min_titlebar_width = (2 * FrameBorderThickness(false)) + @@ -327,7 +314,7 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const { - int top_height = NonClientTopBorderHeight(false, false); + int top_height = NonClientTopBorderHeight(false); int border_thickness = NonClientBorderThickness(); return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), std::max(0, client_bounds.y() - top_height), @@ -449,8 +436,7 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { gfx::Point tabstrip_origin(tabstrip_bounds.origin()); View::ConvertPointToView(frame_->client_view(), this, &tabstrip_origin); tabstrip_bounds.set_origin(tabstrip_origin); - if (browser_view_->UseVerticalTabs() ? - (l.x() > tabstrip_bounds.right()) : (l.y() > tabstrip_bounds.bottom())) + if (l.y() > tabstrip_bounds.bottom()) return false; // We convert from our parent's coordinates since we assume we fill its bounds @@ -585,7 +571,7 @@ gfx::Rect OpaqueBrowserFrameView::IconBounds() const { // restored windows) below looks (to the eye) more like additional space // than does the 3D edge (or nothing at all, for maximized windows) above; // hence the +1. - y = unavailable_px_at_top + (NonClientTopBorderHeight(false, false) - + y = unavailable_px_at_top + (NonClientTopBorderHeight(false) - unavailable_px_at_top - size - TitlebarBottomThickness(false) + 1) / 2; } else { // For "browser mode" windows, we use the native positioning, which is just @@ -614,7 +600,7 @@ void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { // areas not covered by the theme image. SkBitmap* theme_frame = GetFrameBitmap(); int top_area_height = theme_frame->height(); - if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { + if (browser_view_->IsTabStripVisible()) { top_area_height = std::max(top_area_height, GetBoundsForTabStrip(browser_view_->tabstrip()).bottom()); } @@ -776,16 +762,8 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { int x = toolbar_bounds.x(); int w = toolbar_bounds.width(); - int y, h; - if (browser_view_->UseVerticalTabs()) { - gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin()); - ConvertPointToView(browser_view_, this, &tabstrip_origin); - y = tabstrip_origin.y() - kVerticalTabBorderInset; - h = toolbar_bounds.bottom() - y; - } else { - y = toolbar_bounds.y(); - h = toolbar_bounds.bottom(); - } + int y = toolbar_bounds.y(); + int h = toolbar_bounds.bottom(); // Gross hack: We split the toolbar images into two pieces, since sometimes // (popup mode) the toolbar isn't tall enough to show the whole image. The @@ -893,10 +871,6 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); client_area_top = std::min(image_top, client_area_top + toolbar_bounds.bottom() - kClientEdgeThickness); - if (browser_view_->UseVerticalTabs()) { - client_area_top -= kVerticalTabBorderInset; - image_top -= kVerticalTabBorderInset; - } } else if (!browser_view_->IsTabStripVisible()) { // The toolbar isn't going to draw a client edge for us, so draw one // ourselves. @@ -1115,18 +1089,11 @@ void OpaqueBrowserFrameView::LayoutAvatar() { // can be customized so we can't depend on its size to perform layout. SkBitmap incognito_icon = browser_view_->GetOTRAvatarIcon(); - int avatar_bottom, avatar_restored_y; - if (browser_view_->UseVerticalTabs()) { - avatar_bottom = NonClientTopBorderHeight(false, false) - - kAvatarBottomSpacing; - avatar_restored_y = kFrameShadowThickness; - } else { - avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + - browser_view_->GetTabStripHeight() - kAvatarBottomSpacing; - avatar_restored_y = avatar_bottom - incognito_icon.height(); - } + int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + + browser_view_->GetTabStripHeight() - kAvatarBottomSpacing; + int avatar_restored_y = avatar_bottom - incognito_icon.height(); int avatar_y = frame_->IsMaximized() ? - (NonClientTopBorderHeight(false, true) + kTabstripTopShadowThickness) : + (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : avatar_restored_y; avatar_bounds_.SetRect(NonClientBorderThickness() + kAvatarSideSpacing, avatar_y, incognito_icon.width(), @@ -1138,7 +1105,7 @@ void OpaqueBrowserFrameView::LayoutAvatar() { gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, int height) const { - int top_height = NonClientTopBorderHeight(false, false); + int top_height = NonClientTopBorderHeight(false); int border_thickness = NonClientBorderThickness(); return gfx::Rect(border_thickness, top_height, std::max(0, width - (2 * border_thickness)), diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index bcf4e79..d678ec4 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h @@ -55,10 +55,8 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, // Returns the height of the entire nonclient top border, including the window // frame, any title area, and any connected client edge. If |restored| is - // true, acts as if the window is restored regardless of the real mode. If - // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless - // of the real state. - int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; + // true, acts as if the window is restored regardless of the real mode. + int NonClientTopBorderHeight(bool restored) const; // Allows a subclass to tweak the frame. Chromeos uses this to support // drawing themes correctly. |theme_offset| is used to adjust the y offset diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index 5dbff36..85f07cb 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -115,9 +115,8 @@ class BaseTabStrip::RemoveTabDelegate DISALLOW_COPY_AND_ASSIGN(RemoveTabDelegate); }; -BaseTabStrip::BaseTabStrip(TabStripController* controller, Type type) +BaseTabStrip::BaseTabStrip(TabStripController* controller) : controller_(controller), - type_(type), attaching_dragged_tab_(false), ALLOW_THIS_IN_INITIALIZER_LIST(bounds_animator_(this)) { } @@ -329,10 +328,7 @@ void BaseTabStrip::MaybeStartDrag(BaseTab* tab, tabs.push_back(other_tab); if (other_tab == tab) { size_to_selected = GetSizeNeededForTabs(tabs); - if (type() == HORIZONTAL_TAB_STRIP) - x = size_to_selected - tab->width() + x; - else - y = size_to_selected - tab->height() + y; + x = size_to_selected - tab->width() + x; } } } @@ -438,10 +434,7 @@ void BaseTabStrip::StartRemoveTabAnimation(int model_index) { // Animate the tab being closed to 0x0. gfx::Rect tab_bounds = tab->bounds(); - if (type() == HORIZONTAL_TAB_STRIP) - tab_bounds.set_width(0); - else - tab_bounds.set_height(0); + tab_bounds.set_width(0); bounds_animator_.AnimateViewTo(tab, tab_bounds); // Register delegate to do cleanup when done, BoundsAnimator takes diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.h b/chrome/browser/ui/views/tabs/base_tab_strip.h index 691ed07..4648371 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.h +++ b/chrome/browser/ui/views/tabs/base_tab_strip.h @@ -24,16 +24,9 @@ class TabStripSelectionModel; class BaseTabStrip : public AbstractTabStripView, public TabController { public: - enum Type { - HORIZONTAL_TAB_STRIP, - VERTICAL_TAB_STRIP - }; - - BaseTabStrip(TabStripController* controller, Type type); + explicit BaseTabStrip(TabStripController* controller); virtual ~BaseTabStrip(); - Type type() const { return type_; } - // Starts highlighting the tab at the specified index. virtual void StartHighlight(int model_index) = 0; @@ -258,8 +251,6 @@ class BaseTabStrip : public AbstractTabStripView, scoped_ptr<TabStripController> controller_; - const Type type_; - std::vector<TabData> tab_data_; // The controller for a drag initiated from a Tab. Valid for the lifetime of diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index 4f322438..a5788fc 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -73,9 +73,7 @@ class BrowserTabStripController::TabContextMenuContents // Overridden from ui::SimpleMenuModel::Delegate: virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { - return controller_->IsCommandCheckedForTab( - static_cast<TabStripModel::ContextMenuCommand>(command_id), - tab_); + return false; } virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { return controller_->IsCommandEnabledForTab( @@ -99,8 +97,7 @@ class BrowserTabStripController::TabContextMenuContents } virtual void ExecuteCommand(int command_id) OVERRIDE { // Executing the command destroys |this|, and can also end up destroying - // |controller_| (e.g. for |CommandUseVerticalTabs|). So stop the highlights - // before executing the command. + // |controller_|. So stop the highlights before executing the command. controller_->tabstrip_->StopAllHighlighting(); controller_->ExecuteCommandForTab( static_cast<TabStripModel::ContextMenuCommand>(command_id), @@ -172,14 +169,6 @@ bool BrowserTabStripController::IsCommandEnabledForTab( model_->IsContextMenuCommandEnabled(model_index, command_id) : false; } -bool BrowserTabStripController::IsCommandCheckedForTab( - TabStripModel::ContextMenuCommand command_id, - BaseTab* tab) const { - int model_index = tabstrip_->GetModelIndexOfBaseTab(tab); - return model_->ContainsIndex(model_index) ? - model_->IsContextMenuCommandChecked(model_index, command_id) : false; -} - void BrowserTabStripController::ExecuteCommandForTab( TabStripModel::ContextMenuCommand command_id, BaseTab* tab) { diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h index d08147e..e2085e4 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h @@ -35,8 +35,6 @@ class BrowserTabStripController : public TabStripController, bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, BaseTab* tab) const; - bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id, - BaseTab* tab) const; void ExecuteCommandForTab(TabStripModel::ContextMenuCommand command_id, BaseTab* tab); bool IsTabPinned(BaseTab* tab) const; diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index 31c0166..e518d27 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -19,8 +19,6 @@ #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" -#include "chrome/browser/ui/views/tabs/side_tab.h" -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "content/browser/tab_contents/tab_contents.h" @@ -45,10 +43,6 @@ static const int kHorizontalMoveThreshold = 16; // Pixels. -// Distance in pixels the user must move the mouse before we consider moving -// an attached vertical tab. -static const int kVerticalMoveThreshold = 8; - // If non-null there is a drag underway. static DraggedTabController* instance_; @@ -174,8 +168,7 @@ class DockView : public views::View { // Returns the the x-coordinate of |point| if the type of tabstrip is horizontal // otherwise returns the y-coordinate. int MajorAxisValue(const gfx::Point& point, BaseTabStrip* tabstrip) { - return (tabstrip->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) ? - point.x() : point.y(); + return point.x(); } } // namespace @@ -584,15 +577,6 @@ gfx::Point DraggedTabController::GetWindowCreatePoint() const { void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) { // Update the DockInfo for the current mouse coordinates. DockInfo dock_info = GetDockInfoAtPoint(screen_point); - if (source_tabstrip_->type() == BaseTabStrip::VERTICAL_TAB_STRIP && - ((dock_info.type() == DockInfo::LEFT_OF_WINDOW && - !base::i18n::IsRTL()) || - (dock_info.type() == DockInfo::RIGHT_OF_WINDOW && - base::i18n::IsRTL()))) { - // For side tabs it's way to easy to trigger to docking along the left/right - // edge, so we disable it. - dock_info = DockInfo(); - } if (!dock_info.equals(dock_info_)) { // DockInfo for current position differs. if (dock_info_.type() != DockInfo::NONE && @@ -692,18 +676,15 @@ void DraggedTabController::MoveAttached(const gfx::Point& screen_point) { gfx::Point dragged_view_point = GetAttachedDragPoint(screen_point); - int threshold = kVerticalMoveThreshold; - if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - TabStrip* tab_strip = static_cast<TabStrip*>(attached_tabstrip_); - - // Determine the horizontal move threshold. This is dependent on the width - // of tabs. The smaller the tabs compared to the standard size, the smaller - // the threshold. - double unselected, selected; - tab_strip->GetCurrentTabWidths(&unselected, &selected); - double ratio = unselected / Tab::GetStandardSize().width(); - threshold = static_cast<int>(ratio * kHorizontalMoveThreshold); - } + TabStrip* tab_strip = static_cast<TabStrip*>(attached_tabstrip_); + + // Determine the horizontal move threshold. This is dependent on the width + // of tabs. The smaller the tabs compared to the standard size, the smaller + // the threshold. + double unselected, selected; + tab_strip->GetCurrentTabWidths(&unselected, &selected); + double ratio = unselected / Tab::GetStandardSize().width(); + int threshold = static_cast<int>(ratio * kHorizontalMoveThreshold); std::vector<BaseTab*> tabs(drag_data_.size()); for (size_t i = 0; i < drag_data_.size(); ++i) @@ -816,32 +797,18 @@ BaseTabStrip* DraggedTabController::GetTabStripIfItContains( BaseTabStrip* tabstrip, const gfx::Point& screen_point) const { static const int kVerticalDetachMagnetism = 15; - static const int kHorizontalDetachMagnetism = 15; // Make sure the specified screen point is actually within the bounds of the // specified tabstrip... gfx::Rect tabstrip_bounds = GetViewScreenBounds(tabstrip); - if (tabstrip->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - if (screen_point.x() < tabstrip_bounds.right() && - screen_point.x() >= tabstrip_bounds.x()) { - // TODO(beng): make this be relative to the start position of the mouse - // for the source TabStrip. - int upper_threshold = tabstrip_bounds.bottom() + kVerticalDetachMagnetism; - int lower_threshold = tabstrip_bounds.y() - kVerticalDetachMagnetism; - if (screen_point.y() >= lower_threshold && - screen_point.y() <= upper_threshold) { - return tabstrip; - } - } - } else { - if (screen_point.y() < tabstrip_bounds.bottom() && - screen_point.y() >= tabstrip_bounds.y()) { - int upper_threshold = tabstrip_bounds.right() + - kHorizontalDetachMagnetism; - int lower_threshold = tabstrip_bounds.x() - kHorizontalDetachMagnetism; - if (screen_point.x() >= lower_threshold && - screen_point.x() <= upper_threshold) { - return tabstrip; - } + if (screen_point.x() < tabstrip_bounds.right() && + screen_point.x() >= tabstrip_bounds.x()) { + // TODO(beng): make this be relative to the start position of the mouse + // for the source TabStrip. + int upper_threshold = tabstrip_bounds.bottom() + kVerticalDetachMagnetism; + int lower_threshold = tabstrip_bounds.y() - kVerticalDetachMagnetism; + if (screen_point.y() >= lower_threshold && + screen_point.y() <= upper_threshold) { + return tabstrip; } } return NULL; @@ -909,18 +876,16 @@ void DraggedTabController::Attach(BaseTabStrip* attached_tabstrip, ResetSelection(GetModel(attached_tabstrip_)); - if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - // The size of the dragged tab may have changed. Adjust the x offset so that - // ratio of mouse_offset_ to original width is maintained. - std::vector<BaseTab*> tabs_to_source(tabs); - tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, - tabs_to_source.end()); - int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - - tabs[source_tab_index_]->width() + - static_cast<int>(offset_to_width_ratio_ * - tabs[source_tab_index_]->width()); - mouse_offset_.set_x(new_x); - } + // The size of the dragged tab may have changed. Adjust the x offset so that + // ratio of mouse_offset_ to original width is maintained. + std::vector<BaseTab*> tabs_to_source(tabs); + tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, + tabs_to_source.end()); + int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - + tabs[source_tab_index_]->width() + + static_cast<int>(offset_to_width_ratio_ * + tabs[source_tab_index_]->width()); + mouse_offset_.set_x(new_x); // Move the corresponding window to the front. attached_tabstrip_->GetWidget()->Activate(); @@ -971,42 +936,24 @@ void DraggedTabController::Detach() { int DraggedTabController::GetInsertionIndexForDraggedBounds( const gfx::Rect& dragged_bounds) const { int right_tab_x = 0; - int bottom_tab_y = 0; int index = -1; for (int i = 0; i < attached_tabstrip_->tab_count(); ++i) { const gfx::Rect& ideal_bounds = attached_tabstrip_->ideal_bounds(i); - if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - gfx::Rect left_half, right_half; - ideal_bounds.SplitVertically(&left_half, &right_half); - right_tab_x = right_half.right(); - if (dragged_bounds.x() >= right_half.x() && - dragged_bounds.x() < right_half.right()) { - index = i + 1; - break; - } else if (dragged_bounds.x() >= left_half.x() && - dragged_bounds.x() < left_half.right()) { - index = i; - break; - } - } else { - // Vertical tab strip. - int max_y = ideal_bounds.bottom(); - int mid_y = ideal_bounds.y() + ideal_bounds.height() / 2; - bottom_tab_y = max_y; - if (dragged_bounds.y() < mid_y) { - index = i; - break; - } else if (dragged_bounds.y() >= mid_y && dragged_bounds.y() < max_y) { - index = i + 1; - break; - } + gfx::Rect left_half, right_half; + ideal_bounds.SplitVertically(&left_half, &right_half); + right_tab_x = right_half.right(); + if (dragged_bounds.x() >= right_half.x() && + dragged_bounds.x() < right_half.right()) { + index = i + 1; + break; + } else if (dragged_bounds.x() >= left_half.x() && + dragged_bounds.x() < left_half.right()) { + index = i; + break; } } if (index == -1) { - if ((attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP && - dragged_bounds.right() > right_tab_x) || - (attached_tabstrip_->type() == BaseTabStrip::VERTICAL_TAB_STRIP && - dragged_bounds.y() >= bottom_tab_y)) { + if (dragged_bounds.right() > right_tab_x) { index = GetModel(attached_tabstrip_)->count(); } else { index = 0; @@ -1033,18 +980,12 @@ gfx::Rect DraggedTabController::GetDraggedViewTabStripBounds( source_tab_drag_data()->attached_tab->height()); } - if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - double sel_width, unselected_width; - static_cast<TabStrip*>(attached_tabstrip_)->GetCurrentTabWidths( - &sel_width, &unselected_width); - return gfx::Rect(tab_strip_point.x(), tab_strip_point.y(), - static_cast<int>(sel_width), - Tab::GetStandardSize().height()); - } - + double sel_width, unselected_width; + static_cast<TabStrip*>(attached_tabstrip_)->GetCurrentTabWidths( + &sel_width, &unselected_width); return gfx::Rect(tab_strip_point.x(), tab_strip_point.y(), - attached_tabstrip_->width(), - SideTab::GetPreferredHeight()); + static_cast<int>(sel_width), + Tab::GetStandardSize().height()); } gfx::Point DraggedTabController::GetAttachedDragPoint( @@ -1064,15 +1005,9 @@ gfx::Point DraggedTabController::GetAttachedDragPoint( int size = attached_tabstrip_->GetSizeNeededForTabs(attached_tabs); - if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { - int max_x = attached_tabstrip_->width() - size; - x = std::min(std::max(x, 0), max_x); - y = 0; - } else { - x = SideTabStrip::kTabStripInset; - int max_y = attached_tabstrip_->height() - size; - y = std::min(std::max(y, SideTabStrip::kTabStripInset), max_y); - } + int max_x = attached_tabstrip_->width() - size; + x = std::min(std::max(x, 0), max_x); + y = 0; return gfx::Point(x, y); } diff --git a/chrome/browser/ui/views/tabs/side_tab.cc b/chrome/browser/ui/views/tabs/side_tab.cc deleted file mode 100644 index 335d8a9..0000000 --- a/chrome/browser/ui/views/tabs/side_tab.cc +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/tabs/side_tab.h" - -#include "base/utf_string_conversions.h" -#include "grit/theme_resources.h" -#include "grit/theme_resources_standard.h" -#include "grit/ui_resources.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/canvas_skia.h" -#include "ui/gfx/favicon_size.h" -#include "ui/gfx/path.h" -#include "ui/gfx/skia_util.h" -#include "views/controls/button/image_button.h" - -namespace { -const int kVerticalTabHeight = 27; -const int kTitleCloseSpacing = 4; -const int kRoundRectRadius = 4; -const SkColor kTabBackgroundColor = SK_ColorWHITE; -const SkColor kTextColor = SK_ColorBLACK; - -// Padding between the edge and the icon. -const int kIconLeftPadding = 5; - -// Location the title starts at. -const int kTitleX = kIconLeftPadding + gfx::kFaviconSize + 5; -}; - -//////////////////////////////////////////////////////////////////////////////// -// SideTab, public: - -SideTab::SideTab(TabController* controller) - : BaseTab(controller) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - close_button()->SetBackground(kTextColor, - rb.GetBitmapNamed(IDR_TAB_CLOSE), - rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); -} - -SideTab::~SideTab() { -} - -// static -int SideTab::GetPreferredHeight() { - return 27; -} - -//////////////////////////////////////////////////////////////////////////////// -// SideTab, views::View overrides: - -void SideTab::Layout() { - if (ShouldShowIcon()) { - int icon_y = (height() - gfx::kFaviconSize) / 2; - icon_bounds_.SetRect( - kIconLeftPadding, icon_y, gfx::kFaviconSize, gfx::kFaviconSize); - } else { - icon_bounds_ = gfx::Rect(); - } - - gfx::Size ps = close_button()->GetPreferredSize(); - int close_y = (height() - ps.height()) / 2; - close_button()->SetBounds( - std::max(0, width() - ps.width() - - (GetPreferredHeight() - ps.height()) / 2), - close_y, - ps.width(), - ps.height()); - - int title_y = (height() - font_height()) / 2; - title_bounds_.SetRect( - kTitleX, - title_y, - std::max(0, close_button()->x() - kTitleCloseSpacing - kTitleX), - font_height()); -} - -void SideTab::OnPaint(gfx::Canvas* canvas) { - // TODO: should render the active tab differently. - if (ShouldPaintHighlight()) { - SkPaint paint; - paint.setColor(kTabBackgroundColor); - paint.setAntiAlias(true); - SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0), - SkIntToScalar(width()), SkIntToScalar(height()) }; - canvas->GetSkCanvas()->drawRoundRect(border_rect, - SkIntToScalar(kRoundRectRadius), - SkIntToScalar(kRoundRectRadius), - paint); - } - - if (ShouldShowIcon()) - PaintIcon(canvas); - - PaintTitle(canvas, kTextColor); -} - -gfx::Size SideTab::GetPreferredSize() { - return gfx::Size(0, GetPreferredHeight()); -} - -const gfx::Rect& SideTab::GetTitleBounds() const { - return title_bounds_; -} - -const gfx::Rect& SideTab::GetIconBounds() const { - return icon_bounds_; -} - -bool SideTab::ShouldPaintHighlight() const { - return IsSelected() || !controller(); -} - -bool SideTab::ShouldShowIcon() const { - return data().mini || data().show_icon; -} diff --git a/chrome/browser/ui/views/tabs/side_tab.h b/chrome/browser/ui/views/tabs/side_tab.h deleted file mode 100644 index a04c79f..0000000 --- a/chrome/browser/ui/views/tabs/side_tab.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_H_ -#define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_H_ -#pragma once - -#include "chrome/browser/ui/views/tabs/base_tab.h" -#include "ui/gfx/font.h" - -class SideTab; -class TabStripController; - -class SideTab : public BaseTab { - public: - explicit SideTab(TabController* controller); - virtual ~SideTab(); - - // Returns the preferred height of side tabs. - static int GetPreferredHeight(); - - // views::View Overrides: - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; - - protected: - virtual const gfx::Rect& GetTitleBounds() const OVERRIDE; - virtual const gfx::Rect& GetIconBounds() const OVERRIDE; - - // Returns true if the selected highlight should be rendered. - virtual bool ShouldPaintHighlight() const; - - private: - // Returns true if the icon should be shown. - bool ShouldShowIcon() const; - - gfx::Rect icon_bounds_; - gfx::Rect title_bounds_; - - DISALLOW_COPY_AND_ASSIGN(SideTab); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_H_ diff --git a/chrome/browser/ui/views/tabs/side_tab_strip.cc b/chrome/browser/ui/views/tabs/side_tab_strip.cc deleted file mode 100644 index 82c457f..0000000 --- a/chrome/browser/ui/views/tabs/side_tab_strip.cc +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" - -#include "chrome/browser/tabs/tab_strip_selection_model.h" -#include "chrome/browser/ui/view_ids.h" -#include "chrome/browser/ui/views/tabs/side_tab.h" -#include "chrome/browser/ui/views/tabs/tab_strip_controller.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/canvas.h" -#include "views/background.h" -#include "views/controls/button/image_button.h" -#include "views/controls/button/text_button.h" - -namespace { - -const int kVerticalTabSpacing = 2; -const int kTabStripWidth = 140; -const SkColor kBackgroundColor = SkColorSetARGB(255, 209, 220, 248); -const SkColor kSeparatorColor = SkColorSetARGB(255, 151, 159, 179); - -// Height of the scroll buttons. -const int kScrollButtonHeight = 20; - -// Height of the separator. -const int kSeparatorHeight = 1; - -// Padding between tabs and scroll button. -const int kScrollButtonVerticalPadding = 2; - -// The new tab button is rendered using a SideTab. -class SideTabNewTabButton : public SideTab { - public: - explicit SideTabNewTabButton(TabStripController* controller); - - virtual bool ShouldPaintHighlight() const OVERRIDE { return false; } - virtual bool IsSelected() const OVERRIDE { return false; } - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; - - private: - TabStripController* controller_; - - DISALLOW_COPY_AND_ASSIGN(SideTabNewTabButton); -}; - -SideTabNewTabButton::SideTabNewTabButton(TabStripController* controller) - : SideTab(NULL), - controller_(controller) { - // Never show a close button for the new tab button. - close_button()->SetVisible(false); - TabRendererData data; - data.favicon = *ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_SIDETABS_NEW_TAB); - data.title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); - SetData(data); -} - -bool SideTabNewTabButton::OnMousePressed(const views::MouseEvent& event) { - return true; -} - -void SideTabNewTabButton::OnMouseReleased(const views::MouseEvent& event) { - if (event.IsOnlyLeftMouseButton() && HitTest(event.location())) - controller_->CreateNewTab(); -} - -// Button class used for the scroll buttons. -class ScrollButton : public views::TextButton { - public: - enum Type { - UP, - DOWN - }; - - ScrollButton(views::ButtonListener* listener, Type type); - - protected: - // views::View overrides. - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - - private: - const Type type_; - - DISALLOW_COPY_AND_ASSIGN(ScrollButton); -}; - -ScrollButton::ScrollButton(views::ButtonListener* listener, - Type type) - : views::TextButton(listener, std::wstring()), - type_(type) { -} - -void ScrollButton::OnPaint(gfx::Canvas* canvas) { - TextButton::OnPaint(canvas); - - // Draw the arrow. - SkColor arrow_color = IsEnabled() ? SK_ColorBLACK : SK_ColorGRAY; - int arrow_height = 5; - int x = width() / 2; - int y = (height() - arrow_height) / 2; - int delta_y = 1; - if (type_ == DOWN) { - delta_y = -1; - y += arrow_height; - } - for (int i = 0; i < arrow_height; ++i, --x, y += delta_y) - canvas->FillRectInt(arrow_color, x, y, (i * 2) + 1, 1); -} - -} // namespace - -// static -const int SideTabStrip::kTabStripInset = 3; - -//////////////////////////////////////////////////////////////////////////////// -// SideTabStrip, public: - -SideTabStrip::SideTabStrip(TabStripController* controller) - : BaseTabStrip(controller, BaseTabStrip::VERTICAL_TAB_STRIP), - newtab_button_(new SideTabNewTabButton(controller)), - scroll_up_button_(NULL), - scroll_down_button_(NULL), - separator_(new views::View()), - first_tab_y_offset_(0), - ideal_height_(0) { - set_id(VIEW_ID_TAB_STRIP); - set_background(views::Background::CreateSolidBackground(kBackgroundColor)); - AddChildView(newtab_button_); - separator_->set_background( - views::Background::CreateSolidBackground(kSeparatorColor)); - AddChildView(separator_); - scroll_up_button_ = new ScrollButton(this, ScrollButton::UP); - AddChildView(scroll_up_button_); - scroll_down_button_ = new ScrollButton(this, ScrollButton::DOWN); - AddChildView(scroll_down_button_); -} - -SideTabStrip::~SideTabStrip() { - DestroyDragController(); -} - -//////////////////////////////////////////////////////////////////////////////// -// SideTabStrip, AbstractTabStripView implementation: - -bool SideTabStrip::IsPositionInWindowCaption(const gfx::Point& point) { - return GetEventHandlerForPoint(point) == this; -} - -void SideTabStrip::SetBackgroundOffset(const gfx::Point& offset) { -} - -views::View* SideTabStrip::GetNewTabButton() { - return newtab_button_; -} - -//////////////////////////////////////////////////////////////////////////////// -// SideTabStrip, BaseTabStrip implementation: - -void SideTabStrip::StartHighlight(int model_index) { -} - -void SideTabStrip::StopAllHighlighting() { -} - -BaseTab* SideTabStrip::CreateTabForDragging() { - SideTab* tab = new SideTab(NULL); - // Make sure the dragged tab shares our theme provider. We need to explicitly - // do this as during dragging there isn't a theme provider. - tab->set_theme_provider(GetThemeProvider()); - return tab; -} - -void SideTabStrip::RemoveTabAt(int model_index) { - StartRemoveTabAnimation(model_index); -} - -void SideTabStrip::SetSelection(const TabStripSelectionModel& old_selection, - const TabStripSelectionModel& new_selection) { - GetBaseTabAtModelIndex(new_selection.active())->SchedulePaint(); - if (old_selection.active() != new_selection.active()) - MakeTabVisible(ModelIndexToTabIndex(new_selection.active())); -} - -void SideTabStrip::TabTitleChangedNotLoading(int model_index) { -} - -gfx::Size SideTabStrip::GetPreferredSize() { - return gfx::Size(kTabStripWidth, 0); -} - -void SideTabStrip::PaintChildren(gfx::Canvas* canvas) { - // Make sure any tabs being dragged appear on top of all others by painting - // them last. - std::vector<BaseTab*> dragging_tabs; - - // Make sure nothing draws on top of the scroll buttons. - canvas->Save(); - canvas->ClipRectInt(kTabStripInset, kTabStripInset, - width() - kTabStripInset - kTabStripInset, - GetMaxTabY() - kTabStripInset); - - // Paint the new tab and separator first so that any tabs animating appear on - // top. - separator_->Paint(canvas); - newtab_button_->Paint(canvas); - - for (int i = tab_count() - 1; i >= 0; --i) { - BaseTab* tab = base_tab_at_tab_index(i); - if (tab->dragging()) - dragging_tabs.push_back(tab); - else - tab->Paint(canvas); - } - - for (size_t i = 0; i < dragging_tabs.size(); ++i) - dragging_tabs[i]->Paint(canvas); - - canvas->Restore(); - - scroll_down_button_->Paint(canvas); - scroll_up_button_->Paint(canvas); -} - -views::View* SideTabStrip::GetEventHandlerForPoint(const gfx::Point& point) { - // Check the scroll buttons first as they visually appear on top of everything - // else. - if (scroll_down_button_->IsVisible()) { - gfx::Point local_point(point); - View::ConvertPointToView(this, scroll_down_button_, &local_point); - if (scroll_down_button_->HitTest(local_point)) - return scroll_down_button_->GetEventHandlerForPoint(local_point); - } - - if (scroll_up_button_->IsVisible()) { - gfx::Point local_point(point); - View::ConvertPointToView(this, scroll_up_button_, &local_point); - if (scroll_up_button_->HitTest(local_point)) - return scroll_up_button_->GetEventHandlerForPoint(local_point); - } - return views::View::GetEventHandlerForPoint(point); -} - -void SideTabStrip::ButtonPressed(views::Button* sender, - const views::Event& event) { - int max_offset = GetMaxOffset(); - if (max_offset == 0) { - // All the tabs fit, no need to scroll. - return; - } - - // Determine the index of the first visible tab. - int initial_y = kTabStripInset; - int first_vis_index = -1; - for (int i = 0; i < tab_count(); ++i) { - if (ideal_bounds(i).bottom() > initial_y) { - first_vis_index = i; - break; - } - } - if (first_vis_index == -1) - return; - - int delta = 0; - if (sender == scroll_up_button_) { - delta = initial_y - ideal_bounds(first_vis_index).y(); - if (delta <= 0) { - if (first_vis_index == 0) { - delta = -first_tab_y_offset_; - } else { - delta = initial_y - ideal_bounds(first_vis_index - 1).y(); - DCHECK_NE(0, delta); // Not fatal, but indicates we aren't scrolling. - } - } - } else { - DCHECK_EQ(sender, scroll_down_button_); - if (ideal_bounds(first_vis_index).y() > initial_y) { - delta = initial_y - ideal_bounds(first_vis_index).y(); - } else if (first_vis_index + 1 == tab_count()) { - delta = -first_tab_y_offset_; - } else { - delta = initial_y - ideal_bounds(first_vis_index + 1).y(); - } - } - SetFirstTabYOffset(first_tab_y_offset_ + delta); -} - -BaseTab* SideTabStrip::CreateTab() { - return new SideTab(this); -} - -void SideTabStrip::GenerateIdealBounds() { - gfx::Rect layout_rect = GetContentsBounds(); - layout_rect.Inset(kTabStripInset, kTabStripInset); - - int y = layout_rect.y() + first_tab_y_offset_; - bool last_was_mini = true; - bool has_non_closing_tab = false; - separator_bounds_.SetRect(0, -kSeparatorHeight, width(), kSeparatorHeight); - for (int i = 0; i < tab_count(); ++i) { - BaseTab* tab = base_tab_at_tab_index(i); - if (!tab->closing()) { - if (last_was_mini != tab->data().mini) { - if (has_non_closing_tab) { - separator_bounds_.SetRect(0, y, width(), kSeparatorHeight); - y += kSeparatorHeight + kVerticalTabSpacing; - } - newtab_button_bounds_.SetRect( - layout_rect.x(), y, layout_rect.width(), - newtab_button_->GetPreferredSize().height()); - y = newtab_button_bounds_.bottom() + kVerticalTabSpacing; - last_was_mini = tab->data().mini; - } - gfx::Rect bounds = gfx::Rect(layout_rect.x(), y, layout_rect.width(), - tab->GetPreferredSize().height()); - set_ideal_bounds(i, bounds); - y = bounds.bottom() + kVerticalTabSpacing; - has_non_closing_tab = true; - } - } - - if (last_was_mini) { - if (has_non_closing_tab) { - separator_bounds_.SetRect(0, y, width(), kSeparatorHeight); - y += kSeparatorHeight + kVerticalTabSpacing; - } - newtab_button_bounds_ = - gfx::Rect(layout_rect.x(), y, layout_rect.width(), - newtab_button_->GetPreferredSize().height()); - y += newtab_button_->GetPreferredSize().height(); - } - - ideal_height_ = y - layout_rect.y() - first_tab_y_offset_; - - scroll_up_button_->SetEnabled(first_tab_y_offset_ != 0); - scroll_down_button_->SetEnabled(GetMaxOffset() != 0 && - first_tab_y_offset_ != GetMaxOffset()); -} - -void SideTabStrip::StartInsertTabAnimation(int model_index) { - PrepareForAnimation(); - - GenerateIdealBounds(); - - int tab_data_index = ModelIndexToTabIndex(model_index); - BaseTab* tab = base_tab_at_tab_index(tab_data_index); - if (model_index == 0) { - tab->SetBounds(ideal_bounds(tab_data_index).x(), 0, - ideal_bounds(tab_data_index).width(), 0); - } else { - BaseTab* last_tab = base_tab_at_tab_index(tab_data_index - 1); - tab->SetBounds(last_tab->x(), last_tab->bounds().bottom(), - ideal_bounds(tab_data_index).width(), 0); - } - - AnimateToIdealBounds(); -} - -void SideTabStrip::AnimateToIdealBounds() { - for (int i = 0; i < tab_count(); ++i) { - BaseTab* tab = base_tab_at_tab_index(i); - if (!tab->closing() && !tab->dragging()) - bounds_animator().AnimateViewTo(tab, ideal_bounds(i)); - } - - bounds_animator().AnimateViewTo(newtab_button_, newtab_button_bounds_); - - bounds_animator().AnimateViewTo(separator_, separator_bounds_); -} - -void SideTabStrip::DoLayout() { - BaseTabStrip::DoLayout(); - newtab_button_->SetBoundsRect(newtab_button_bounds_); - separator_->SetBoundsRect(separator_bounds_); - int scroll_button_y = height() - kScrollButtonHeight; - scroll_up_button_->SetBounds(0, scroll_button_y, width() / 2, - kScrollButtonHeight); - scroll_down_button_->SetBounds(width() / 2, scroll_button_y, width() / 2, - kScrollButtonHeight); -} - -void SideTabStrip::LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, - BaseTab* active_tab, - const gfx::Point& location, - bool initial_drag) { - // TODO: add support for initial_drag (see TabStrip's implementation). - gfx::Rect layout_rect = GetContentsBounds(); - layout_rect.Inset(kTabStripInset, kTabStripInset); - int y = location.y(); - for (size_t i = 0; i < tabs.size(); ++i) { - BaseTab* tab = tabs[i]; - tab->SchedulePaint(); - tab->SetBounds(layout_rect.x(), y, layout_rect.width(), - tab->GetPreferredSize().height()); - tab->SchedulePaint(); - y += tab->height() + kVerticalTabSpacing; - } -} - -void SideTabStrip::CalculateBoundsForDraggedTabs( - const std::vector<BaseTab*>& tabs, - std::vector<gfx::Rect>* bounds) { - int y = 0; - for (size_t i = 0; i < tabs.size(); ++i) { - BaseTab* tab = tabs[i]; - gfx::Rect tab_bounds(tab->bounds()); - tab_bounds.set_y(y); - y += tab->height() + kVerticalTabSpacing; - bounds->push_back(tab_bounds); - } -} - -int SideTabStrip::GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs) { - return static_cast<int>(tabs.size()) * SideTab::GetPreferredHeight(); -} - -void SideTabStrip::OnBoundsChanged(const gfx::Rect& previous_bounds) { - // When our height changes we may be able to show more. - first_tab_y_offset_ = std::max(GetMaxOffset(), - std::min(0, first_tab_y_offset_)); - for (int i = 0; i < controller()->GetCount(); ++i) { - if (controller()->IsActiveTab(i)) { - MakeTabVisible(ModelIndexToTabIndex(i)); - break; - } - } -} - -void SideTabStrip::SetFirstTabYOffset(int new_offset) { - int max_offset = GetMaxOffset(); - if (max_offset == 0) { - // All the tabs fit, no need to scroll. - return; - } - new_offset = std::max(max_offset, std::min(0, new_offset)); - if (new_offset == first_tab_y_offset_) - return; - - StopAnimating(false); - first_tab_y_offset_ = new_offset; - GenerateIdealBounds(); - DoLayout(); - -} - -int SideTabStrip::GetMaxOffset() const { - int available_height = GetMaxTabY() - kTabStripInset; - return std::min(0, available_height - ideal_height_); -} - -int SideTabStrip::GetMaxTabY() const { - return height() - kTabStripInset - kScrollButtonVerticalPadding - - kScrollButtonHeight; -} - -void SideTabStrip::MakeTabVisible(int tab_index) { - if (height() == 0) - return; - - if (ideal_bounds(tab_index).y() < kTabStripInset) { - SetFirstTabYOffset(first_tab_y_offset_ - ideal_bounds(tab_index).y() + - kTabStripInset); - } else if (ideal_bounds(tab_index).bottom() > GetMaxTabY()) { - SetFirstTabYOffset(GetMaxTabY() - (ideal_bounds(tab_index).bottom() - - first_tab_y_offset_)); - } -} diff --git a/chrome/browser/ui/views/tabs/side_tab_strip.h b/chrome/browser/ui/views/tabs/side_tab_strip.h deleted file mode 100644 index 9fc316f..0000000 --- a/chrome/browser/ui/views/tabs/side_tab_strip.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_ -#define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_ -#pragma once - -#include "chrome/browser/ui/views/tabs/base_tab_strip.h" -#include "views/controls/button/button.h" - -struct TabRendererData; -class TabStripSelectionModel; - -class SideTabStrip : public BaseTabStrip, public views::ButtonListener { - public: - // The tabs are inset by this much along all axis. - static const int kTabStripInset; - - explicit SideTabStrip(TabStripController* controller); - virtual ~SideTabStrip(); - - // AbstractTabStripView implementation: - virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE; - virtual void SetBackgroundOffset(const gfx::Point& offset) OVERRIDE; - virtual views::View* GetNewTabButton() OVERRIDE; - - // BaseTabStrip implementation: - virtual void StartHighlight(int model_index) OVERRIDE; - virtual void StopAllHighlighting() OVERRIDE; - virtual BaseTab* CreateTabForDragging() OVERRIDE; - virtual void RemoveTabAt(int model_index) OVERRIDE; - virtual void SetSelection( - const TabStripSelectionModel& old_selection, - const TabStripSelectionModel& new_selection) OVERRIDE; - virtual void TabTitleChangedNotLoading(int model_index) OVERRIDE; - - // views::View overrides: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; - virtual views::View* GetEventHandlerForPoint( - const gfx::Point& point) OVERRIDE; - - // views::ButtonListener overrides: - virtual void ButtonPressed(views::Button* sender, - const views::Event& event) OVERRIDE; - - protected: - // BaseTabStrip overrides: - virtual BaseTab* CreateTab() OVERRIDE; - virtual void GenerateIdealBounds() OVERRIDE; - virtual void StartInsertTabAnimation(int model_index) OVERRIDE; - virtual void AnimateToIdealBounds() OVERRIDE; - virtual void DoLayout() OVERRIDE; - virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, - BaseTab* active_tab, - const gfx::Point& location, - bool initial_drag) OVERRIDE; - virtual void CalculateBoundsForDraggedTabs( - const std::vector<BaseTab*>& tabs, - std::vector<gfx::Rect>* bounds) OVERRIDE; - virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs) OVERRIDE; - - // views::View protected overrides: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - - private: - // Sets |first_tab_y_offset_|. This ensures |new_offset| is legal. - void SetFirstTabYOffset(int new_offset); - - // Returns the max y offset. - int GetMaxOffset() const; - - // Returns the max visible y-coordinate for tabs. - int GetMaxTabY() const; - - // Make sure the tab at |tab_index| is visible. - void MakeTabVisible(int tab_index); - - // The "New Tab" button. - views::View* newtab_button_; - - // Ideal bounds of the new tab button. - gfx::Rect newtab_button_bounds_; - - // Scroll buttons. - views::View* scroll_up_button_; - views::View* scroll_down_button_; - - // Separator between mini-tabs and the new tab button. The separator is - // positioned above the visible area if there are no mini-tabs. - views::View* separator_; - - // Bounds of the sepatator. - gfx::Rect separator_bounds_; - - // Offset the first tab (or new tab button) is positioned at. If the user has - // scrolled the tabs this is non-zero. - int first_tab_y_offset_; - - // Height needed to display the tabs, separator and new tab button. Doesn't - // include any padding. - int ideal_height_; - - DISALLOW_COPY_AND_ASSIGN(SideTabStrip); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_ diff --git a/chrome/browser/ui/views/tabs/side_tab_strip_unittest.cc b/chrome/browser/ui/views/tabs/side_tab_strip_unittest.cc deleted file mode 100644 index d2fb1ddb..0000000 --- a/chrome/browser/ui/views/tabs/side_tab_strip_unittest.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" - -#include "chrome/browser/ui/views/tabs/base_tab_strip_test_fixture.h" - -// BaseTabStrip unit tests using SideTabStrip. -INSTANTIATE_TYPED_TEST_CASE_P(SideTabStrip, - BaseTabStripTestFixture, - SideTabStrip); - diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 4492140..ea03d92 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -117,7 +117,7 @@ class NewTabButton : public views::ImageButton { const int TabStrip::mini_to_non_mini_gap_ = 3; TabStrip::TabStrip(TabStripController* controller) - : BaseTabStrip(controller, BaseTabStrip::HORIZONTAL_TAB_STRIP), + : BaseTabStrip(controller), newtab_button_(NULL), current_unselected_width_(Tab::GetStandardSize().width()), current_selected_width_(Tab::GetStandardSize().width()), @@ -1012,10 +1012,7 @@ void TabStrip::StartMouseInitiatedRemoveTabAnimation(int model_index) { AnimateToIdealBounds(); gfx::Rect tab_bounds = tab_closing->bounds(); - if (type() == HORIZONTAL_TAB_STRIP) - tab_bounds.set_width(0); - else - tab_bounds.set_height(0); + tab_bounds.set_width(0); bounds_animator().AnimateViewTo(tab_closing, tab_bounds); // Register delegate to do cleanup when done, BoundsAnimator takes diff --git a/chrome/browser/ui/views/tabs/tab_strip_factory.cc b/chrome/browser/ui/views/tabs/tab_strip_factory.cc index 59667f8..e2fec1b 100644 --- a/chrome/browser/ui/views/tabs/tab_strip_factory.cc +++ b/chrome/browser/ui/views/tabs/tab_strip_factory.cc @@ -5,26 +5,18 @@ #include "chrome/browser/ui/views/tabs/tab_strip_factory.h" #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" -#include "chrome/browser/ui/views/tabs/side_tab_strip.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" -// This default implementation of CreateTabStrip creates a TabStrip or a -// SideTabStrip, depending on whether we are using vertical tabs. +// This default implementation of CreateTabStrip creates a TabStrip. AbstractTabStripView* CreateTabStrip(Browser* browser, views::View* parent, - TabStripModel* model, - bool use_vertical_tabs) { + TabStripModel* model) { BrowserTabStripController* tabstrip_controller = new BrowserTabStripController(browser, model); // Ownership of this controller is given to a specific tabstrip when we // construct it below. - BaseTabStrip* tabstrip = NULL; - - if (use_vertical_tabs) - tabstrip = new SideTabStrip(tabstrip_controller); - else - tabstrip = new TabStrip(tabstrip_controller); + BaseTabStrip* tabstrip = new TabStrip(tabstrip_controller); parent->AddChildView(tabstrip); tabstrip_controller->InitFromModel(tabstrip); return tabstrip; diff --git a/chrome/browser/ui/views/tabs/tab_strip_factory.h b/chrome/browser/ui/views/tabs/tab_strip_factory.h index d32f96c..cf436e1 100644 --- a/chrome/browser/ui/views/tabs/tab_strip_factory.h +++ b/chrome/browser/ui/views/tabs/tab_strip_factory.h @@ -17,7 +17,6 @@ class View; // Creates and returns a new tabstrip. The tabstrip should be added to |parent|. AbstractTabStripView* CreateTabStrip(Browser* browser, views::View* parent, - TabStripModel* model, - bool use_vertical_tabs); + TabStripModel* model); #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_FACTORY_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index ff39e2f..df831e3 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3495,10 +3495,6 @@ 'browser/ui/views/tabs/native_view_photobooth_gtk.h', 'browser/ui/views/tabs/native_view_photobooth_win.cc', 'browser/ui/views/tabs/native_view_photobooth_win.h', - 'browser/ui/views/tabs/side_tab.cc', - 'browser/ui/views/tabs/side_tab.h', - 'browser/ui/views/tabs/side_tab_strip.cc', - 'browser/ui/views/tabs/side_tab_strip.h', 'browser/ui/views/tabs/tab.cc', 'browser/ui/views/tabs/tab.h', 'browser/ui/views/tabs/tab_controller.h', @@ -4748,10 +4744,6 @@ ['include', '^browser/ui/views/tabs/native_view_photobooth.h'], ['include', '^browser/ui/views/tabs/native_view_photobooth_gtk.cc'], ['include', '^browser/ui/views/tabs/native_view_photobooth_gtk.h'], - ['include', '^browser/ui/views/tabs/side_tab.cc'], - ['include', '^browser/ui/views/tabs/side_tab.h'], - ['include', '^browser/ui/views/tabs/side_tab_strip.cc'], - ['include', '^browser/ui/views/tabs/side_tab_strip.h'], ['include', '^browser/ui/views/tabs/tab.cc'], ['include', '^browser/ui/views/tabs/tab.h'], ['include', '^browser/ui/views/tabs/tab_controller.h'], diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index d9d5f40..5b53005 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1764,7 +1764,6 @@ 'browser/ui/views/tabs/base_tab_strip_test_fixture.h', 'browser/ui/views/tabs/fake_base_tab_strip_controller.cc', 'browser/ui/views/tabs/fake_base_tab_strip_controller.h', - 'browser/ui/views/tabs/side_tab_strip_unittest.cc', 'browser/ui/views/tabs/tab_strip_unittest.cc', 'browser/ui/webui/chrome_web_ui_data_source_unittest.cc', 'browser/ui/webui/chromeos/enterprise_enrollment_ui_unittest.cc', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index d3e1eec..6204e68 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -537,10 +537,6 @@ const char kEnableTabGroupsContextMenu[] = "enable-tab-groups-context-menu"; // Enable the "synced bookmarks" folder. const char kEnableSyncedBookmarksFolder[] = "enable-synced-bookmarks-folder"; -// Enables the option to show tabs as a vertical stack down the side of the -// browser window. -const char kEnableVerticalTabs[] = "enable-vertical-tabs"; - // Spawn threads to watch for excessive delays in specified message loops. // User should set breakpoints on Alarm() to examine problematic thread. // Usage: -enable-watchdog=[ui][io] diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 0ad80c9..98ab18b 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -158,7 +158,6 @@ extern const char kEnableSyncTabsForOtherClients[]; extern const char kEnableSyncedBookmarksFolder[]; extern const char kEnableTabGroupsContextMenu[]; extern const char kEnableTopSites[]; -extern const char kEnableVerticalTabs[]; extern const char kEnableWatchdog[]; extern const char kEnableWebSocketOverSpdy[]; extern const char kEnableWebUITaskManager[]; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 269a389..fb36309 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -766,10 +766,6 @@ const char kAutofillPersonalDataManagerFirstRun[] = "autofill.pdm.first_run"; // Modifying bookmarks is completely disabled when this is set to false. const char kEditBookmarksEnabled[] = "bookmarks.editing_enabled"; -// Boolean that is true when the tabstrip is to be laid out vertically down the -// side of the browser window. -const char kUseVerticalTabs[] = "tabs.use_vertical_tabs"; - // Boolean that is true when the translate feature is enabled. const char kEnableTranslate[] = "translate.enabled"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index c87fe22..941f747 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -278,7 +278,6 @@ extern const char kAutofillNegativeUploadRate[]; extern const char kAutofillPersonalDataManagerFirstRun[]; extern const char kEditBookmarksEnabled[]; -extern const char kUseVerticalTabs[]; extern const char kEnableTranslate[]; extern const char kEnableBookmarkBar[]; extern const char kPinnedTabs[]; diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index 497a7f3..4f9703d 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h @@ -98,7 +98,6 @@ class TestBrowserWindow : public BrowserWindow { virtual void Cut() OVERRIDE {} virtual void Copy() OVERRIDE {} virtual void Paste() OVERRIDE {} - virtual void ToggleTabStripMode() OVERRIDE {} #if defined(OS_MACOSX) virtual void OpenTabpose() OVERRIDE {} virtual void SetPresentationMode(bool presentation_mode) OVERRIDE {} |