summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 16:42:05 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 16:42:05 +0000
commit06f666707b420f11a454929e4de0fbb843d71d55 (patch)
treeb0e242e2edda142f36619046ce4936b19dd4b137 /chrome/browser/tabs
parent1cfe52b37f422bc5305e3f0a9c0172990312549e (diff)
downloadchromium_src-06f666707b420f11a454929e4de0fbb843d71d55.zip
chromium_src-06f666707b420f11a454929e4de0fbb843d71d55.tar.gz
chromium_src-06f666707b420f11a454929e4de0fbb843d71d55.tar.bz2
Reverting 14948.
Broke the Mac build. TBR=ben Review URL: http://codereview.chromium.org/99224 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc3
-rw-r--r--chrome/browser/tabs/tab_strip_model.h16
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc18
3 files changed, 8 insertions, 29 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 038f01c..3815232 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -515,9 +515,6 @@ bool TabStripModel::IsNewTabAtEndOfTabStrip(TabContents* contents) const {
bool TabStripModel::InternalCloseTabContentsAt(int index,
bool create_historical_tab) {
- if (!delegate_->CanCloseContentsAt(index))
- return false;
-
TabContents* detached_contents = GetContentsAt(index);
if (delegate_->RunUnloadListenerBeforeClosing(detached_contents))
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index fac1dbe..abc8051 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -109,7 +109,7 @@ class TabStripModelDelegate {
virtual TabContents* AddBlankTab(bool foreground) = 0;
virtual TabContents* AddBlankTabAt(int index, bool foreground) = 0;
- // Asks for a new TabStripModel to be created and the given tab contents to
+ // Ask for a new TabStripModel to be created and the given tab contents to
// be added to it. Its size and position are reflected in |window_bounds|.
// If |dock_info|'s type is other than NONE, the newly created window should
// be docked as identified by |dock_info|. Returns the Browser object
@@ -128,7 +128,7 @@ class TabStripModelDelegate {
TAB_TEAROFF_ACTION = 2
};
- // Determines what drag actions are possible for the specified strip.
+ // Determine what drag actions are possible for the specified strip.
virtual int GetDragActions() const = 0;
// Creates an appropriate TabContents for the given URL. This is handled by
@@ -144,10 +144,10 @@ class TabStripModelDelegate {
bool defer_load,
SiteInstance* instance) const = 0;
- // Returns whether some contents can be duplicated.
+ // Return whether some contents can be duplicated.
virtual bool CanDuplicateContentsAt(int index) = 0;
- // Duplicates the contents at the provided index and places it into its own
+ // Duplicate the contents at the provided index and places it into its own
// window.
virtual void DuplicateContentsAt(int index) = 0;
@@ -171,9 +171,6 @@ class TabStripModelDelegate {
// Restores the last closed tab if CanRestoreTab would return true.
virtual void RestoreTab() = 0;
-
- // Returns whether some contents can be closed.
- virtual bool CanCloseContentsAt(int index) = 0;
};
////////////////////////////////////////////////////////////////////////////////
@@ -257,9 +254,8 @@ class TabStripModel : public NotificationObserver {
// Closes the TabContents at the specified index. This causes the TabContents
// to be destroyed, but it may not happen immediately (e.g. if it's a
// WebContents).
- // Returns true if the TabContents was closed immediately, false if it was not
- // closed (we may be waiting for a response from an onunload handler, or
- // waiting for the user to confirm closure).
+ // Returns true if the TabContents was closed immediately, false if we are
+ // waiting for a response from an onunload handler.
bool CloseTabContentsAt(int index) {
return InternalCloseTabContentsAt(index, true);
}
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 3036ddc..8e052544 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -22,11 +22,9 @@
class TabStripDummyDelegate : public TabStripModelDelegate {
public:
explicit TabStripDummyDelegate(TabContents* dummy)
- : dummy_contents_(dummy), can_close_(true) {}
+ : dummy_contents_(dummy) {}
virtual ~TabStripDummyDelegate() {}
- void set_can_close(bool value) { can_close_ = value; }
-
// Overridden from TabStripModelDelegate:
virtual TabContents* AddBlankTab(bool foreground) { return NULL; }
virtual TabContents* AddBlankTabAt(int index, bool foreground) {
@@ -58,16 +56,12 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
}
virtual bool CanRestoreTab() { return false; }
virtual void RestoreTab() {}
- virtual bool CanCloseContentsAt(int index) { return can_close_ ; }
private:
// A dummy TabContents we give to callers that expect us to actually build a
// Destinations tab for them.
TabContents* dummy_contents_;
- // Whether tabs can be closed.
- bool can_close_;
-
DISALLOW_EVIL_CONSTRUCTORS(TabStripDummyDelegate);
};
@@ -317,15 +311,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// Test CloseTabContentsAt
{
- // Let's test nothing happens when the delegate veto the close.
- delegate.set_can_close(false);
- EXPECT_FALSE(tabstrip.CloseTabContentsAt(2));
- EXPECT_EQ(3, tabstrip.count());
- EXPECT_EQ(0, observer.GetStateCount());
-
- // Now let's close for real.
- delegate.set_can_close(true);
- EXPECT_TRUE(tabstrip.CloseTabContentsAt(2));
+ tabstrip.CloseTabContentsAt(2);
EXPECT_EQ(2, tabstrip.count());
EXPECT_EQ(3, observer.GetStateCount());