summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 05:37:53 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 05:37:53 +0000
commit12c68c2f1f05cd8fbe453694b4c04ac25d08c1a8 (patch)
treeb7f34c6082f0251e5237db4c524a7b46acc5980e /chrome
parentf381dfa196a8da9382ff6c4b109216b5d166c148 (diff)
downloadchromium_src-12c68c2f1f05cd8fbe453694b4c04ac25d08c1a8.zip
chromium_src-12c68c2f1f05cd8fbe453694b4c04ac25d08c1a8.tar.gz
chromium_src-12c68c2f1f05cd8fbe453694b4c04ac25d08c1a8.tar.bz2
Revert 45906 - Relands your patch to have an option for enabling vertical tabs. I've
added the following additions: . made the layout work for opaque_browser_frame. . Only show the menu if the user supplied enableverticaltabs. BUG=none TEST=none Review URL: http://codereview.chromium.org/1708014 TBR=sky@chromium.org Review URL: http://codereview.chromium.org/1795010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc26
-rw-r--r--chrome/browser/browser.h5
-rw-r--r--chrome/browser/browser_window.h3
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.h1
-rw-r--r--chrome/browser/cocoa/tab_strip_controller_unittest.mm4
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h1
-rw-r--r--chrome/browser/tab_menu_model.cc17
-rw-r--r--chrome/browser/tab_menu_model.h3
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc25
-rw-r--r--chrome/browser/tabs/tab_strip_model.h11
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc2
-rw-r--r--chrome/browser/views/frame/browser_frame.h8
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.cc7
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.h2
-rw-r--r--chrome/browser/views/frame/browser_frame_win.cc13
-rw-r--r--chrome/browser/views/frame/browser_frame_win.h2
-rw-r--r--chrome/browser/views/frame/browser_view.cc47
-rw-r--r--chrome/browser/views/frame/browser_view.h10
-rw-r--r--chrome/browser/views/frame/browser_view_layout.cc14
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.cc12
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc17
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.cc107
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.h17
-rw-r--r--chrome/browser/views/tabs/side_tab.cc26
-rw-r--r--chrome/browser/views/tabs/side_tab.h9
-rw-r--r--chrome/browser/views/tabs/side_tab_strip.cc22
-rw-r--r--chrome/browser/views/tabs/side_tab_strip.h9
-rw-r--r--chrome/browser/views/tabs/side_tab_strip_model.h9
-rw-r--r--chrome/browser/views/tabs/tab.cc4
-rw-r--r--chrome/browser/views/tabs/tab.h4
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc20
-rw-r--r--chrome/browser/views/tabs/tab_strip.h7
-rw-r--r--chrome/common/notification_type.h3
-rw-r--r--chrome/test/test_browser_window.h1
34 files changed, 85 insertions, 383 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 11c0c83..a346eb9 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -67,7 +67,6 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
-#include "chrome/browser/tab_menu_model.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_constants.h"
@@ -202,12 +201,6 @@ Browser::Browser(Type type, Profile* profile)
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);
- }
}
Browser::~Browser() {
@@ -1706,7 +1699,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true);
prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true);
prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true);
- prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false);
+ prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, true);
prefs->RegisterBooleanPref(prefs::kEnableTranslate, true);
}
@@ -2135,15 +2128,6 @@ void Browser::BookmarkAllTabs() {
BookmarkEditor::SHOW_TREE);
}
-bool Browser::UseVerticalTabs() const {
- return use_vertical_tabs_.GetValue();
-}
-
-void Browser::ToggleUseVerticalTabs() {
- use_vertical_tabs_.SetValue(!UseVerticalTabs());
- window()->ToggleTabStripMode();
-}
-
///////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModelObserver implementation:
@@ -2800,14 +2784,6 @@ void Browser::Observe(NotificationType type,
break;
}
- case NotificationType::PREF_CHANGED: {
- if (*(Details<std::wstring>(details).ptr()) == prefs::kUseVerticalTabs)
- window()->ToggleTabStripMode();
- else
- NOTREACHED();
- break;
- }
-
default:
NOTREACHED() << "Got a notification we didn't register for.";
}
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 65eb214..dfd89f1 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -623,8 +623,6 @@ class Browser : public TabStripModelDelegate,
virtual bool CanCloseContentsAt(int index);
virtual bool CanBookmarkAllTabs() const;
virtual void BookmarkAllTabs();
- virtual bool UseVerticalTabs() const;
- virtual void ToggleUseVerticalTabs();
// Overridden from TabStripModelObserver:
virtual void TabInsertedAt(TabContents* contents,
@@ -986,9 +984,6 @@ class Browser : public TabStripModelDelegate,
// The extension app associated with this window, if any.
Extension* extension_app_;
- // Tracks the display mode of the tabstrip.
- mutable BooleanPrefMember use_vertical_tabs_;
-
DISALLOW_COPY_AND_ASSIGN(Browser);
};
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index fa7b22b..4d2b461 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -304,9 +304,6 @@ class BrowserWindow {
virtual void Copy() = 0;
virtual void Paste() = 0;
- // Switches between available tabstrip display modes.
- virtual void ToggleTabStripMode() = 0;
-
// Construct a BrowserWindow implementation for the specified |browser|.
static BrowserWindow* CreateBrowserWindow(Browser* browser);
diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h
index dc760f8..b79712a 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/cocoa/browser_window_cocoa.h
@@ -102,7 +102,6 @@ class BrowserWindowCocoa : public BrowserWindow,
virtual void Cut();
virtual void Copy();
virtual void Paste();
- virtual void ToggleTabStripMode() {}
// Overridden from NotificationObserver
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/cocoa/tab_strip_controller_unittest.mm b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
index 2a161ab..82cea8e 100644
--- a/chrome/browser/cocoa/tab_strip_controller_unittest.mm
+++ b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
@@ -63,10 +63,6 @@ class TestTabStripDelegate : public TabStripModelDelegate {
virtual bool CanBookmarkAllTabs() const { return false; }
virtual void BookmarkAllTabs() {}
-
- virtual bool UseVerticalTabs() const { return false; }
-
- virtual void ToggleUseVerticalTabs() {}
};
class TabStripControllerTest : public CocoaTest {
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index d193d13..3f10f57 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -120,7 +120,6 @@ class BrowserWindowGtk : public BrowserWindow,
virtual void Cut();
virtual void Copy();
virtual void Paste();
- virtual void ToggleTabStripMode() {}
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/tab_menu_model.cc b/chrome/browser/tab_menu_model.cc
index f955837..bb0ba34 100644
--- a/chrome/browser/tab_menu_model.cc
+++ b/chrome/browser/tab_menu_model.cc
@@ -4,9 +4,7 @@
#include "chrome/browser/tab_menu_model.h"
-#include "base/command_line.h"
#include "chrome/browser/tabs/tab_strip_model.h"
-#include "chrome/common/chrome_switches.h"
#include "grit/generated_resources.h"
TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate,
@@ -15,16 +13,6 @@ TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate,
Build(is_pinned);
}
-// static
-bool TabMenuModel::AreVerticalTabsEnabled() {
-#if defined(TOOLKIT_VIEWS)
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableVerticalTabs);
-#else
- return false;
-#endif
-}
-
void TabMenuModel::Build(bool is_pinned) {
AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB);
AddSeparator();
@@ -47,9 +35,4 @@ void TabMenuModel::Build(bool is_pinned) {
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);
- }
}
diff --git a/chrome/browser/tab_menu_model.h b/chrome/browser/tab_menu_model.h
index 189fefe..dca49af 100644
--- a/chrome/browser/tab_menu_model.h
+++ b/chrome/browser/tab_menu_model.h
@@ -18,9 +18,6 @@ class TabMenuModel : public menus::SimpleMenuModel {
TabMenuModel(menus::SimpleMenuModel::Delegate* delegate, bool is_pinned);
virtual ~TabMenuModel() {}
- // Returns true if vertical tabs are enabled.
- static bool AreVerticalTabsEnabled();
-
private:
void Build(bool is_pinned);
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index a1b1355..b5095a2 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -574,24 +574,11 @@ bool TabStripModel::IsContextMenuCommandEnabled(
return delegate_->CanRestoreTab();
case CommandTogglePinned:
return true;
- case CommandBookmarkAllTabs:
+ case CommandBookmarkAllTabs: {
return delegate_->CanBookmarkAllTabs();
- case CommandUseVerticalTabs:
- return true;
- default:
- NOTREACHED();
- }
- 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;
}
@@ -668,14 +655,6 @@ void TabStripModel::ExecuteContextMenuCommand(
delegate_->BookmarkAllTabs();
break;
}
- case CommandUseVerticalTabs: {
- UserMetrics::RecordAction(
- UserMetricsAction("TabContextMenu_UseVerticalTabs"),
- profile_);
-
- delegate()->ToggleUseVerticalTabs();
- break;
- }
default:
NOTREACHED();
}
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 90b4419..427fb6e 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -223,12 +223,6 @@ class TabStripModelDelegate {
// Creates a bookmark folder containing a bookmark for all open tabs.
virtual void BookmarkAllTabs() = 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;
};
////////////////////////////////////////////////////////////////////////////////
@@ -553,7 +547,6 @@ class TabStripModel : public NotificationObserver {
CommandRestoreTab,
CommandTogglePinned,
CommandBookmarkAllTabs,
- CommandUseVerticalTabs,
CommandLast
};
@@ -561,10 +554,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|.
void ExecuteContextMenuCommand(int context_index,
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 44c56e6..451cc81 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -71,8 +71,6 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
virtual bool CanCloseContentsAt(int index) { return can_close_ ; }
virtual bool CanBookmarkAllTabs() const { return false; }
virtual void BookmarkAllTabs() {}
- virtual bool UseVerticalTabs() const { return false; }
- virtual void ToggleUseVerticalTabs() {}
private:
// A dummy TabContents we give to callers that expect us to actually build a
diff --git a/chrome/browser/views/frame/browser_frame.h b/chrome/browser/views/frame/browser_frame.h
index 392200d..fd94d51 100644
--- a/chrome/browser/views/frame/browser_frame.h
+++ b/chrome/browser/views/frame/browser_frame.h
@@ -41,6 +41,10 @@ class BrowserFrame {
// construction.
virtual views::Window* GetWindow() = 0;
+ // Notification that the tab strip has been created. This should let the
+ // BrowserRootView know about it so it can enable drag and drop.
+ virtual void TabStripCreated(BaseTabStrip* tabstrip) = 0;
+
// Determine the distance of the left edge of the minimize button from the
// left edge of the window. Used in our Non-Client View's Layout.
virtual int GetMinimizeButtonOffset() const = 0;
@@ -70,10 +74,6 @@ class BrowserFrame {
// calls this method _after_ the TabStrip has painted itself so the shadow is
// rendered above the tabs.
virtual void PaintTabStripShadow(gfx::Canvas* canvas) = 0;
-
- // Notifies the frame that the tab strip display mode changed so it can update
- // its frame treatment if necessary.
- virtual void TabStripDisplayModeChanged() = 0;
};
#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_H_
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc
index cb67b3b..ef6f5a1 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/views/frame/browser_frame_gtk.cc
@@ -102,6 +102,9 @@ views::Window* BrowserFrameGtk::GetWindow() {
return this;
}
+void BrowserFrameGtk::TabStripCreated(BaseTabStrip* tabstrip) {
+}
+
int BrowserFrameGtk::GetMinimizeButtonOffset() const {
NOTIMPLEMENTED();
return 0;
@@ -136,10 +139,6 @@ views::View* BrowserFrameGtk::GetFrameView() const {
void BrowserFrameGtk::PaintTabStripShadow(gfx::Canvas* canvas) {
}
-void BrowserFrameGtk::TabStripDisplayModeChanged() {
- GetRootView()->Layout();
-}
-
ThemeProvider* BrowserFrameGtk::GetThemeProvider() const {
return profile_->GetThemeProvider();
}
diff --git a/chrome/browser/views/frame/browser_frame_gtk.h b/chrome/browser/views/frame/browser_frame_gtk.h
index f8e8f2a..93330c1 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.h
+++ b/chrome/browser/views/frame/browser_frame_gtk.h
@@ -28,6 +28,7 @@ class BrowserFrameGtk : public BrowserFrame,
// Overridden from BrowserFrame:
virtual views::Window* GetWindow();
+ virtual void TabStripCreated(BaseTabStrip* tabstrip);
virtual int GetMinimizeButtonOffset() const;
virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
virtual void UpdateThrobber(bool running);
@@ -36,7 +37,6 @@ class BrowserFrameGtk : public BrowserFrame,
virtual bool AlwaysUseNativeFrame() const;
virtual views::View* GetFrameView() const;
virtual void PaintTabStripShadow(gfx::Canvas* canvas);
- virtual void TabStripDisplayModeChanged();
// Overridden from views::Widget:
virtual ThemeProvider* GetThemeProvider() const;
diff --git a/chrome/browser/views/frame/browser_frame_win.cc b/chrome/browser/views/frame/browser_frame_win.cc
index e0b420e..7239b53 100644
--- a/chrome/browser/views/frame/browser_frame_win.cc
+++ b/chrome/browser/views/frame/browser_frame_win.cc
@@ -72,6 +72,9 @@ views::Window* BrowserFrameWin::GetWindow() {
return this;
}
+void BrowserFrameWin::TabStripCreated(BaseTabStrip* tabstrip) {
+}
+
int BrowserFrameWin::GetMinimizeButtonOffset() const {
TITLEBARINFOEX titlebar_info;
titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
@@ -130,12 +133,6 @@ void BrowserFrameWin::PaintTabStripShadow(gfx::Canvas* canvas) {
browser_frame_view_->PaintTabStripShadow(canvas);
}
-void BrowserFrameWin::TabStripDisplayModeChanged() {
- GetRootView()->Layout();
- UpdateDWMFrame();
- GetRootView()->Layout();
-}
-
///////////////////////////////////////////////////////////////////////////////
// BrowserFrame, views::WindowWin overrides:
@@ -306,7 +303,7 @@ void BrowserFrameWin::UpdateDWMFrame() {
// In maximized mode, we only have a titlebar strip of glass, no side/bottom
// borders.
if (!browser_view_->IsFullscreen()) {
- if (browser_view_->UseVerticalTabs()) {
+ if (browser_view_->UsingSideTabs()) {
margins.cxLeftWidth +=
GetBoundsForTabStrip(browser_view_->tabstrip()).right();
margins.cyTopHeight += GetSystemMetrics(SM_CYSIZEFRAME);
@@ -322,7 +319,7 @@ void BrowserFrameWin::UpdateDWMFrame() {
DwmExtendFrameIntoClientArea(GetNativeView(), &margins);
DWORD window_style = GetWindowLong(GWL_STYLE);
- if (browser_view_->UseVerticalTabs()) {
+ if (browser_view_->UsingSideTabs()) {
if (window_style & WS_CAPTION)
SetWindowLong(GWL_STYLE, window_style & ~WS_CAPTION);
} else {
diff --git a/chrome/browser/views/frame/browser_frame_win.h b/chrome/browser/views/frame/browser_frame_win.h
index 42e8974..d928f93 100644
--- a/chrome/browser/views/frame/browser_frame_win.h
+++ b/chrome/browser/views/frame/browser_frame_win.h
@@ -37,6 +37,7 @@ class BrowserFrameWin : public BrowserFrame, public views::WindowWin {
// BrowserFrame implementation.
virtual views::Window* GetWindow();
+ virtual void TabStripCreated(BaseTabStrip* tabstrip);
virtual int GetMinimizeButtonOffset() const;
virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const;
virtual void UpdateThrobber(bool running);
@@ -45,7 +46,6 @@ class BrowserFrameWin : public BrowserFrame, public views::WindowWin {
virtual bool AlwaysUseNativeFrame() const;
virtual views::View* GetFrameView() const;
virtual void PaintTabStripShadow(gfx::Canvas* canvas);
- virtual void TabStripDisplayModeChanged();
protected:
// Overridden from views::WindowWin:
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 70fcc10..e8ee1d9 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -530,8 +530,8 @@ bool BrowserView::IsTabStripVisible() const {
return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
}
-bool BrowserView::UseVerticalTabs() const {
- return browser_->tabstrip_model()->delegate()->UseVerticalTabs();
+bool BrowserView::UsingSideTabs() const {
+ return SideTabStrip::Visible(browser_->profile());
}
bool BrowserView::IsOffTheRecord() const {
@@ -1206,11 +1206,6 @@ void BrowserView::Paste() {
false, false);
}
-void BrowserView::ToggleTabStripMode() {
- InitTabStrip(browser_->tabstrip_model());
- frame_->TabStripDisplayModeChanged();
-}
-
///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindowTesting implementation:
@@ -1614,34 +1609,13 @@ views::LayoutManager* BrowserView::CreateLayoutManager() const {
return new BrowserViewLayout;
}
-void BrowserView::InitTabStrip(TabStripModel* model) {
-// Throw away the existing tabstrip if we're switching display modes.
- if (tabstrip_) {
- tabstrip_->GetParent()->RemoveChildView(tabstrip_);
- delete tabstrip_;
- }
-
- TabStrip* tabstrip_as_tabstrip = NULL;
- BrowserTabStripController* tabstrip_controller = NULL;
-
- if (UseVerticalTabs()) {
+BaseTabStrip* BrowserView::CreateTabStrip(TabStripModel* model) {
+ if (UsingSideTabs()) {
SideTabStrip* tabstrip = new SideTabStrip;
- tabstrip_controller = new BrowserTabStripController(model, tabstrip);
- tabstrip->SetModel(tabstrip_controller);
- tabstrip_ = tabstrip;
- } else {
- tabstrip_as_tabstrip = new TabStrip(model);
- tabstrip_ = tabstrip_as_tabstrip;
+ tabstrip->SetModel(new BrowserTabStripController(model, tabstrip));
+ return tabstrip;
}
- tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
- if (browser_->extension_app() && tabstrip_->AsTabStrip())
- tabstrip_->AsTabStrip()->set_new_tab_button_enabled(false);
- AddChildView(tabstrip_);
-
- if (tabstrip_controller)
- tabstrip_controller->InitFromModel();
- else
- tabstrip_as_tabstrip->InitFromModel();
+ return new TabStrip(model);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1700,7 +1674,12 @@ void BrowserView::Init() {
}
}
- InitTabStrip(browser_->tabstrip_model());
+ tabstrip_ = CreateTabStrip(browser_->tabstrip_model());
+ tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
+ if (browser_->extension_app() && tabstrip_->AsTabStrip())
+ tabstrip_->AsTabStrip()->set_new_tab_button_enabled(false);
+ AddChildView(tabstrip_);
+ frame_->TabStripCreated(tabstrip_);
toolbar_ = new ToolbarView(browser_.get());
AddChildView(toolbar_);
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 4e13040..7e52404 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -167,7 +167,7 @@ class BrowserView : public BrowserBubbleHost,
bool IsTabStripVisible() const;
// Returns true if the vertical tabstrip is in use.
- bool UseVerticalTabs() const;
+ bool UsingSideTabs() const;
// Returns true if the profile associated with this Browser window is
// off the record.
@@ -336,7 +336,6 @@ class BrowserView : public BrowserBubbleHost,
virtual void Cut();
virtual void Copy();
virtual void Paste();
- virtual void ToggleTabStripMode();
// Overridden from BrowserWindowTesting:
virtual BookmarkBarView* GetBookmarkBarView() const;
@@ -410,10 +409,9 @@ class BrowserView : public BrowserBubbleHost,
// override to implemnet different layout pocily.
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.
- void InitTabStrip(TabStripModel* tab_strip_model);
+ // Returns a new TabStrip for the browser view. A subclass may
+ // override to return a different TabStrip implementation.
+ virtual BaseTabStrip* CreateTabStrip(TabStripModel* tab_strip_model);
// Browser window related initializations.
virtual void Init();
diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/views/frame/browser_view_layout.cc
index 8f2588d..505a913 100644
--- a/chrome/browser/views/frame/browser_view_layout.cc
+++ b/chrome/browser/views/frame/browser_view_layout.cc
@@ -321,7 +321,7 @@ int BrowserViewLayout::LayoutTabStrip() {
gfx::Rect layout_bounds =
browser_view_->frame()->GetBoundsForTabStrip(tabstrip_);
- if (browser_view_->UseVerticalTabs()) {
+ if (browser_view_->UsingSideTabs()) {
vertical_layout_rect_.Inset(
layout_bounds.right() - kBrowserViewTabStripHorizontalOverlap, 0, 0, 0);
} else {
@@ -337,18 +337,18 @@ int BrowserViewLayout::LayoutTabStrip() {
layout_bounds.set_origin(tabstrip_origin);
tabstrip_->SetVisible(true);
tabstrip_->SetBounds(layout_bounds);
- return browser_view_->UseVerticalTabs() ?
- layout_bounds.y() : layout_bounds.bottom();
+ return browser_view_->UsingSideTabs() ? 0 : layout_bounds.bottom();
}
int BrowserViewLayout::LayoutToolbar(int top) {
int browser_view_width = vertical_layout_rect_.width();
bool visible = browser_view_->IsToolbarVisible();
toolbar_->location_bar()->SetFocusable(visible);
- int y = top;
- if (!browser_view_->UseVerticalTabs()) {
- y -= ((visible && browser_view_->IsTabStripVisible()) ?
- kToolbarTabStripVerticalOverlap : 0);
+ int y = 0;
+ if (!browser_view_->UsingSideTabs()) {
+ y = top -
+ ((visible && browser_view_->IsTabStripVisible())
+ ? kToolbarTabStripVerticalOverlap : 0);
}
int height = 0;
if (visible) {
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc
index 0026e60..9a665f7 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/views/frame/glass_browser_frame_view.cc
@@ -77,7 +77,7 @@ GlassBrowserFrameView::~GlassBrowserFrameView() {
gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip(
BaseTabStrip* tabstrip) const {
- if (browser_view_->UseVerticalTabs()) {
+ if (browser_view_->UsingSideTabs()) {
gfx::Size ps = tabstrip->GetPreferredSize();
return gfx::Rect(0, NonClientTopBorderHeight(), ps.width(),
browser_view_->height());
@@ -114,10 +114,8 @@ void GlassBrowserFrameView::UpdateThrobber(bool running) {
}
void GlassBrowserFrameView::PaintTabStripShadow(gfx::Canvas* canvas) {
- if (!browser_view_->UILayoutIsRightToLeft() ||
- !browser_view_->UseVerticalTabs()) {
+ if (!browser_view_->UILayoutIsRightToLeft())
return;
- }
ThemeProvider* tp = GetThemeProvider();
SkBitmap* shadow_top = tp->GetBitmapNamed(IDR_SIDETABS_SHADOW_TOP);
@@ -239,7 +237,7 @@ int GlassBrowserFrameView::NonClientTopBorderHeight() const {
// We'd like to use FrameBorderThickness() here, but the maximized Aero glass
// frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border
// at the top (see AeroGlassFrame::OnGetMinMaxInfo()).
- const int kRestoredHeight = browser_view_->UseVerticalTabs() ?
+ const int kRestoredHeight = browser_view_->UsingSideTabs() ?
-2 : kNonClientRestoredExtraThickness;
return GetSystemMetrics(SM_CXSIZEFRAME) + (browser_view_->IsMaximized() ?
-kTabstripTopShadowThickness : kRestoredHeight);
@@ -258,7 +256,7 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
// Draw the toolbar background, setting src_y of the paint to the tab
// strip height as the toolbar background begins at the top of the tabs.
- int src_y = browser_view_->UseVerticalTabs()
+ int src_y = browser_view_->UsingSideTabs()
? TabRenderer::GetMinimumUnselectedSize().height()
: browser_view_->GetTabStripHeight() - 1;
canvas->TileImageInt(*theme_toolbar, 0, src_y,
@@ -335,7 +333,7 @@ void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {
tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height();
gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
- if (browser_view_->UseVerticalTabs()) {
+ if (browser_view_->UsingSideTabs()) {
client_area_bounds.Inset(
GetBoundsForTabStrip(browser_view_->tabstrip()).width() - 4, 0, 0, 0);
}
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index 3b92e3b..5014ef42 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -194,14 +194,9 @@ OpaqueBrowserFrameView::~OpaqueBrowserFrameView() {
gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
BaseTabStrip* tabstrip) const {
- if (browser_view_->UseVerticalTabs()) {
- // Position the tab strip slightly below the caption buttons.
- // TODO(sky): adjust the 2.
- int y = CaptionButtonY() + minimize_button_->GetPreferredSize().height() +
- 2;
- gfx::Size ps = tabstrip->GetPreferredSize();
- return gfx::Rect(0, y, ps.width(), browser_view_->height());
- }
+ int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ?
+ (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) :
+ NonClientBorderThickness() + kTabStripIndent;
int tabstrip_y = NonClientTopBorderHeight();
if (!frame_->GetWindow()->IsMaximized() &&
@@ -209,10 +204,6 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
tabstrip_y += kNonClientRestoredExtraThickness;
}
- int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ?
- (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) :
- NonClientBorderThickness() + kTabStripIndent;
-
int tabstrip_width = minimize_button_->x() - tabstrip_x -
(frame_->GetWindow()->IsMaximized() ?
kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing);
@@ -256,7 +247,7 @@ gfx::Size OpaqueBrowserFrameView::GetMinimumSize() {
}
void OpaqueBrowserFrameView::PaintTabStripShadow(gfx::Canvas* canvas) {
- // TODO(sky): SIDE tabs.
+ // TODO(beng): SIDE tabs.
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
index e828326..343ee09 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
@@ -5,69 +5,7 @@
#include "chrome/browser/views/tabs/browser_tab_strip_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/tab_menu_model.h"
#include "chrome/browser/views/tabs/side_tab_strip.h"
-#include "views/controls/menu/menu_2.h"
-#include "views/widget/widget.h"
-
-class BrowserTabStripController::TabContextMenuContents
- : public menus::SimpleMenuModel::Delegate {
- public:
- TabContextMenuContents(int tab_index, BrowserTabStripController* controller)
- : ALLOW_THIS_IN_INITIALIZER_LIST(
- model_(this, controller->IsTabPinned(tab_index))),
- tab_index_(tab_index),
- controller_(controller) {
- Build();
- }
- virtual ~TabContextMenuContents() {
- menu_->CancelMenu();
- }
-
- void RunMenuAt(const gfx::Point& point) {
- menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPLEFT);
- }
-
- // Overridden from menus::SimpleMenuModel::Delegate:
- virtual bool IsCommandIdChecked(int command_id) const {
- return controller_->IsCommandCheckedForTab(
- static_cast<TabStripModel::ContextMenuCommand>(command_id),
- tab_index_);
- }
- virtual bool IsCommandIdEnabled(int command_id) const {
- return controller_->IsCommandEnabledForTab(
- static_cast<TabStripModel::ContextMenuCommand>(command_id),
- tab_index_);
- }
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- menus::Accelerator* accelerator) {
- return controller_->tabstrip_->GetWidget()->GetAccelerator(command_id,
- accelerator);
- }
- virtual void ExecuteCommand(int command_id) {
- controller_->ExecuteCommandForTab(
- static_cast<TabStripModel::ContextMenuCommand>(command_id),
- tab_index_);
- }
-
- private:
- void Build() {
- menu_.reset(new views::Menu2(&model_));
- }
-
- TabMenuModel model_;
- scoped_ptr<views::Menu2> menu_;
-
- // The index of the tab we are showing the context menu for.
- int tab_index_;
-
- // A pointer back to our hosting controller, for command state information.
- BrowserTabStripController* controller_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContextMenuContents);
-};
-
////////////////////////////////////////////////////////////////////////////////
// BrowserTabStripController, public:
@@ -80,45 +18,6 @@ BrowserTabStripController::BrowserTabStripController(TabStripModel* model,
}
BrowserTabStripController::~BrowserTabStripController() {
- model_->RemoveObserver(this);
-}
-
-void BrowserTabStripController::InitFromModel() {
- // Walk the model, calling our insertion observer method for each item within
- // it.
- for (int i = 0; i < model_->count(); ++i) {
- TabInsertedAt(model_->GetTabContentsAt(i), i,
- i == model_->selected_index());
- }
-}
-
-bool BrowserTabStripController::IsCommandEnabledForTab(
- TabStripModel::ContextMenuCommand command_id, int tab_index) const {
- if (model_->ContainsIndex(tab_index))
- return model_->IsContextMenuCommandEnabled(tab_index, command_id);
- return false;
-}
-
-bool BrowserTabStripController::IsCommandCheckedForTab(
- TabStripModel::ContextMenuCommand command_id, int tab_index) const {
- // TODO(beng): move to TabStripModel, see note in IsTabPinned.
- if (command_id == TabStripModel::CommandTogglePinned)
- return false;
-
- if (model_->ContainsIndex(tab_index))
- return model_->IsContextMenuCommandChecked(tab_index, command_id);
- return false;
-}
-
-void BrowserTabStripController::ExecuteCommandForTab(
- TabStripModel::ContextMenuCommand command_id, int tab_index) {
- if (model_->ContainsIndex(tab_index))
- model_->ExecuteContextMenuCommand(tab_index, command_id);
-}
-
-bool BrowserTabStripController::IsTabPinned(int tab_index) {
- return model_->ContainsIndex(tab_index) ?
- model_->IsTabPinned(tab_index) : false;
}
////////////////////////////////////////////////////////////////////////////////
@@ -154,12 +53,6 @@ void BrowserTabStripController::CloseTab(int index) {
model_->CloseTabContentsAt(index);
}
-void BrowserTabStripController::ShowContextMenu(int index,
- const gfx::Point& p) {
- context_menu_contents_.reset(new TabContextMenuContents(index, this));
- context_menu_contents_->RunMenuAt(p);
-}
-
////////////////////////////////////////////////////////////////////////////////
// BrowserTabStripController, TabStripModelObserver implementation:
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.h b/chrome/browser/views/tabs/browser_tab_strip_controller.h
index f4a0295..e127659 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
#define CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
-#include "base/scoped_ptr.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/views/tabs/side_tab_strip_model.h"
@@ -19,16 +18,6 @@ class BrowserTabStripController : public SideTabStripModel,
BrowserTabStripController(TabStripModel* model, SideTabStrip* tabstrip);
virtual ~BrowserTabStripController();
- void InitFromModel();
-
- bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id,
- int tab_index) const;
- bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id,
- int tab_index) const;
- void ExecuteCommandForTab(TabStripModel::ContextMenuCommand command_id,
- int tab_index);
- bool IsTabPinned(int tab_index);
-
// SideTabStripModel implementation:
virtual SkBitmap GetIcon(int index) const;
virtual string16 GetTitle(int index) const;
@@ -36,7 +25,6 @@ class BrowserTabStripController : public SideTabStripModel,
virtual NetworkState GetNetworkState(int index) const;
virtual void SelectTab(int index);
virtual void CloseTab(int index);
- virtual void ShowContextMenu(int index, const gfx::Point& p);
// TabStripModelObserver implementation:
virtual void TabInsertedAt(TabContents* contents, int index,
@@ -55,14 +43,9 @@ class BrowserTabStripController : public SideTabStripModel,
virtual void TabBlockedStateChanged(TabContents* contents, int index);
private:
- class TabContextMenuContents;
-
TabStripModel* model_;
SideTabStrip* tabstrip_;
- // If non-NULL it means we're showing a menu for the tab.
- scoped_ptr<TabContextMenuContents> context_menu_contents_;
-
DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController);
};
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc
index dfa18e1..9c45dd2 100644
--- a/chrome/browser/views/tabs/side_tab.cc
+++ b/chrome/browser/views/tabs/side_tab.cc
@@ -57,8 +57,6 @@ SideTab::SideTab(SideTabModel* model)
hover_animation_.reset(new SlideAnimation(this));
hover_animation_->SetSlideDuration(kHoverDurationMs);
-
- SetContextMenuController(this);
}
SideTab::~SideTab() {
@@ -113,15 +111,6 @@ void SideTab::ButtonPressed(views::Button* sender, const views::Event& event) {
}
////////////////////////////////////////////////////////////////////////////////
-// SideTab, views::ContextMenuController implementation:
-
-void SideTab::ShowContextMenu(views::View* source,
- const gfx::Point& p,
- bool is_mouse_gesture) {
- model_->ShowContextMenu(this, p);
-}
-
-////////////////////////////////////////////////////////////////////////////////
// SideTab, views::View overrides:
void SideTab::Layout() {
@@ -131,19 +120,14 @@ void SideTab::Layout() {
gfx::Size ps = close_button_->GetPreferredSize();
int close_y = (height() - ps.height()) / 2;
- close_button_->SetBounds(
- std::max(0, width() - ps.width() - close_y),
- close_y,
- ps.width(),
- ps.height());
+ close_button_->SetBounds(width() - ps.width() - close_y, close_y, ps.width(),
+ ps.height());
int title_y = (height() - font_->height()) / 2;
int title_x = icon_bounds_.right() + kIconTitleSpacing;
- title_bounds_.SetRect(
- title_x,
- title_y,
- std::max(0, close_button_->x() - kTitleCloseSpacing - title_x),
- font_->height());
+ title_bounds_.SetRect(title_x, title_y,
+ close_button_->x() - kTitleCloseSpacing - title_x,
+ font_->height());
}
void SideTab::Paint(gfx::Canvas* canvas) {
diff --git a/chrome/browser/views/tabs/side_tab.h b/chrome/browser/views/tabs/side_tab.h
index 7c0e9d6..b267d5a 100644
--- a/chrome/browser/views/tabs/side_tab.h
+++ b/chrome/browser/views/tabs/side_tab.h
@@ -26,13 +26,9 @@ class SideTabModel {
// Closes the tab.
virtual void CloseTab(SideTab* tab) = 0;
-
- // Shows a context menu for the tab at the specified point in screen coords.
- virtual void ShowContextMenu(SideTab* tab, const gfx::Point& p) = 0;
};
class SideTab : public views::View,
- public views::ContextMenuController,
public views::ButtonListener,
public AnimationDelegate {
public:
@@ -52,11 +48,6 @@ class SideTab : public views::View,
// views::ButtonListener implementation:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::ContextMenuController implementation:
- virtual void ShowContextMenu(views::View* source,
- const gfx::Point& p,
- bool is_mouse_gesture);
-
// views::View Overrides:
virtual void Layout();
virtual void Paint(gfx::Canvas* canvas);
diff --git a/chrome/browser/views/tabs/side_tab_strip.cc b/chrome/browser/views/tabs/side_tab_strip.cc
index c7a343c..7ef38d6 100644
--- a/chrome/browser/views/tabs/side_tab_strip.cc
+++ b/chrome/browser/views/tabs/side_tab_strip.cc
@@ -4,7 +4,13 @@
#include "chrome/browser/views/tabs/side_tab_strip.h"
+#include "base/command_line.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/view_ids.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+#include "gfx/canvas.h"
namespace {
const int kVerticalTabSpacing = 2;
@@ -26,6 +32,18 @@ void SideTabStrip::SetModel(SideTabStripModel* model) {
model_.reset(model);
}
+// static
+bool SideTabStrip::Available() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableVerticalTabs);
+}
+
+// static
+bool SideTabStrip::Visible(Profile* profile) {
+ return Available() &&
+ profile->GetPrefs()->GetBoolean(prefs::kUseVerticalTabs);
+}
+
void SideTabStrip::AddTabAt(int index) {
SideTab* tab = new SideTab(this);
AddChildView(tab);
@@ -70,10 +88,6 @@ void SideTabStrip::CloseTab(SideTab* tab) {
model_->CloseTab(GetIndexOfSideTab(tab));
}
-void SideTabStrip::ShowContextMenu(SideTab* tab, const gfx::Point& p) {
- model_->ShowContextMenu(GetIndexOfSideTab(tab), p);
-}
-
////////////////////////////////////////////////////////////////////////////////
// SideTabStrip, BaseTabStrip implementation:
diff --git a/chrome/browser/views/tabs/side_tab_strip.h b/chrome/browser/views/tabs/side_tab_strip.h
index 558d1a1..71b704a 100644
--- a/chrome/browser/views/tabs/side_tab_strip.h
+++ b/chrome/browser/views/tabs/side_tab_strip.h
@@ -21,6 +21,14 @@ class SideTabStrip : public BaseTabStrip,
// Associate a model with this SideTabStrip. The SideTabStrip owns its model.
void SetModel(SideTabStripModel* model);
+ // Whether or not the browser has been run with the "enable-vertical-tabs"
+ // command line flag that allows the SideTabStrip to be optionally shown.
+ static bool Available();
+
+ // Whether or not the vertical tabstrip is shown. Only valid if Available()
+ // returns true.
+ static bool Visible(Profile* profile);
+
// Notifies the SideTabStrip that a tab was added in the model at |index|.
void AddTabAt(int index);
@@ -40,7 +48,6 @@ class SideTabStrip : public BaseTabStrip,
virtual bool IsSelected(SideTab* tab) const;
virtual void SelectTab(SideTab* tab);
virtual void CloseTab(SideTab* tab);
- virtual void ShowContextMenu(SideTab* tab, const gfx::Point& p);
// BaseTabStrip implementation:
virtual int GetPreferredHeight();
diff --git a/chrome/browser/views/tabs/side_tab_strip_model.h b/chrome/browser/views/tabs/side_tab_strip_model.h
index 835e5ba..a456c36 100644
--- a/chrome/browser/views/tabs/side_tab_strip_model.h
+++ b/chrome/browser/views/tabs/side_tab_strip_model.h
@@ -7,17 +7,12 @@
#include "base/string16.h"
-namespace gfx {
-class Point;
-}
class SkBitmap;
// A model interface implemented by an object that can provide information
// about SideTabs in a SideTabStrip.
class SideTabStripModel {
public:
- virtual ~SideTabStripModel() {}
-
// Returns metadata about the tab at the specified index.
virtual SkBitmap GetIcon(int index) const = 0;
virtual string16 GetTitle(int index) const = 0;
@@ -40,10 +35,6 @@ class SideTabStripModel {
// Closes the tab at the specified index in the model.
virtual void CloseTab(int index) = 0;
-
- // Shows a context menu for the tab at the specified index at the specified
- // point in screen coords.
- virtual void ShowContextMenu(int index, const gfx::Point& p) = 0;
};
#endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_MODEL_H_
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 4f3989c..eb80e89 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -52,9 +52,7 @@ class Tab::TabContextMenuContents : public menus::SimpleMenuModel::Delegate {
// Overridden from menus::SimpleMenuModel::Delegate:
virtual bool IsCommandIdChecked(int command_id) const {
- return tab_ && tab_->delegate()->IsCommandCheckedForTab(
- static_cast<TabStripModel::ContextMenuCommand>(command_id),
- tab_);
+ return false;
}
virtual bool IsCommandIdEnabled(int command_id) const {
return tab_ && tab_->delegate()->IsCommandEnabledForTab(
diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h
index 2276239..79b08f2 100644
--- a/chrome/browser/views/tabs/tab.h
+++ b/chrome/browser/views/tabs/tab.h
@@ -46,10 +46,6 @@ class Tab : public TabRenderer,
virtual bool IsCommandEnabledForTab(
TabStripModel::ContextMenuCommand command_id, const Tab* tab) const = 0;
- // Returns true if the specified command is checked for the specified Tab.
- virtual bool IsCommandCheckedForTab(
- TabStripModel::ContextMenuCommand command_id, const Tab* tab) const = 0;
-
// Executes the specified command for the specified Tab.
virtual void ExecuteCommandForTab(
TabStripModel::ContextMenuCommand command_id, Tab* tab) = 0;
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index a6e11d3..7f31722 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -265,7 +265,8 @@ TabStrip::~TabStrip() {
// delete the tabs.
StopAnimating(false);
- model_->RemoveObserver(this);
+ // TODO(beng): (1031854) Restore this line once XPFrame/VistaFrame are dead.
+ // model_->RemoveObserver(this);
// TODO(beng): remove this if it doesn't work to fix the TabSelectedAt bug.
drag_controller_.reset(NULL);
@@ -340,15 +341,6 @@ gfx::Rect TabStrip::GetNewTabButtonBounds() {
return newtab_button_->bounds();
}
-void TabStrip::InitFromModel() {
- // Walk the model, calling our insertion observer method for each item within
- // it.
- for (int i = 0; i < model_->count(); ++i) {
- TabInsertedAt(model_->GetTabContentsAt(i), i,
- i == model_->selected_index());
- }
-}
-
////////////////////////////////////////////////////////////////////////////////
// TabStrip, BaseTabStrip implementation:
@@ -874,14 +866,6 @@ bool TabStrip::IsCommandEnabledForTab(
return false;
}
-bool TabStrip::IsCommandCheckedForTab(
- TabStripModel::ContextMenuCommand command_id, const Tab* tab) const {
- int model_index = GetModelIndexOfTab(tab);
- if (model_->ContainsIndex(model_index))
- return model_->IsContextMenuCommandChecked(model_index, command_id);
- return false;
-}
-
void TabStrip::ExecuteCommandForTab(
TabStripModel::ContextMenuCommand command_id, Tab* tab) {
int model_index = GetModelIndexOfTab(tab);
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index 8752bf1..95ccfdb 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -95,11 +95,6 @@ class TabStrip : public BaseTabStrip,
// Returns the bounds of the new tab button.
gfx::Rect GetNewTabButtonBounds();
- // Populates the BaseTabStrip implementation from its model. This is primarily
- // useful when switching between display types and there are existing tabs.
- // Upon initial creation the TabStrip is empty.
- void InitFromModel();
-
// BaseTabStrip implementation:
virtual int GetPreferredHeight();
virtual void SetBackgroundOffset(const gfx::Point& offset);
@@ -166,8 +161,6 @@ class TabStrip : public BaseTabStrip,
virtual void CloseTab(Tab* tab);
virtual bool IsCommandEnabledForTab(
TabStripModel::ContextMenuCommand command_id, const Tab* tab) const;
- virtual bool IsCommandCheckedForTab(
- TabStripModel::ContextMenuCommand command_id, const Tab* tab) const;
virtual void ExecuteCommandForTab(
TabStripModel::ContextMenuCommand command_id, Tab* tab);
virtual void StartHighlightTabsForCommand(
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index d2463a5..eb9c51aa 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -629,8 +629,7 @@ class NotificationType {
// the profile. No details are provided.
WEB_APP_INSTALL_CHANGED,
- // This is sent to a pref observer when a pref is changed. The source is the
- // PrefService and the details a std::wstring of the changed path.
+ // This is sent to a pref observer when a pref is changed.
PREF_CHANGED,
// Sent when a default request context has been created, so calling
diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h
index 701ccf0..9f384f6 100644
--- a/chrome/test/test_browser_window.h
+++ b/chrome/test/test_browser_window.h
@@ -100,7 +100,6 @@ class TestBrowserWindow : public BrowserWindow {
virtual void Cut() { }
virtual void Copy() { }
virtual void Paste() { }
- virtual void ToggleTabStripMode() {}
protected:
virtual void DestroyBrowser() {}